diff options
author | tle | 2008-04-16 21:02:27 +0000 |
---|---|---|
committer | tle | 2008-04-16 21:02:27 +0000 |
commit | 6f23299bfe26ec018b8c7dba78e1196940196ab2 (patch) | |
tree | 62b556e727b5efd0a0a686cbece7302fc25cbf04 /jpa | |
parent | 69b70cf1a173a0d4a1c291532376bb09439dc409 (diff) | |
download | webtools.dali-6f23299bfe26ec018b8c7dba78e1196940196ab2.tar.gz webtools.dali-6f23299bfe26ec018b8c7dba78e1196940196ab2.tar.xz webtools.dali-6f23299bfe26ec018b8c7dba78e1196940196ab2.zip |
Refactored verifyPutProperty method.
Diffstat (limited to 'jpa')
11 files changed, 100 insertions, 159 deletions
diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/caching/CachingAdapterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/caching/CachingAdapterTests.java index b098cabc2d..a5f85e9d77 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/caching/CachingAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/caching/CachingAdapterTests.java @@ -22,7 +22,6 @@ import org.eclipse.jpt.eclipselink.core.internal.context.caching.EclipseLinkCach import org.eclipse.jpt.eclipselink.core.tests.internal.PersistenceUnitTestCase; import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter; import org.eclipse.jpt.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.utility.model.event.PropertyChangeEvent; import org.eclipse.jpt.utility.model.listener.ListChangeListener; import org.eclipse.jpt.utility.model.listener.PropertyChangeListener; import org.eclipse.jpt.utility.model.value.ListValueModel; @@ -136,20 +135,6 @@ public class CachingAdapterTests extends PersistenceUnitTestCase }; } - private PropertyChangeListener buildPropertyChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - CachingAdapterTests.this.propertyChangedEvent = event; - CachingAdapterTests.this.propertyChangedEventCount++; - } - - @Override - public String toString() { - return "Caching listener"; - } - }; - } - @Override protected void clearEvent() { super.clearEvent(); @@ -422,6 +407,7 @@ public class CachingAdapterTests extends PersistenceUnitTestCase } } + // ********** get/set property ********** @Override protected void setProperty(String propertyName, Object newValue) throws Exception { if (propertyName.equals(Caching.CACHE_TYPE_DEFAULT_PROPERTY)) @@ -446,14 +432,16 @@ public class CachingAdapterTests extends PersistenceUnitTestCase } @Override - protected void verifyPutProperty(String propertyName, Object expectedValue) throws NoSuchFieldException { + protected Object getProperty(String propertyName) throws NoSuchFieldException { + Object modelValue = null; if (propertyName.equals(Caching.CACHE_TYPE_DEFAULT_PROPERTY)) - this.verifyPutProperty(propertyName, this.caching.getCacheTypeDefault(), expectedValue); + modelValue = this.caching.getCacheTypeDefault(); else if (propertyName.equals(Caching.CACHE_SIZE_DEFAULT_PROPERTY)) - this.verifyPutProperty(propertyName, this.caching.getCacheSizeDefault(), expectedValue); + modelValue = this.caching.getCacheSizeDefault(); else if (propertyName.equals(Caching.SHARED_CACHE_DEFAULT_PROPERTY)) - this.verifyPutProperty(propertyName, this.caching.getSharedCacheDefault(), expectedValue); + modelValue = this.caching.getSharedCacheDefault(); else - this.throwMissingDefinition("verifyPutProperty", propertyName); + 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/caching/CachingValueModelTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/caching/CachingValueModelTests.java index 62a60184ee..7f7132ab60 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/caching/CachingValueModelTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/caching/CachingValueModelTests.java @@ -384,12 +384,15 @@ public class CachingValueModelTests extends PersistenceUnitTestCase Caching.ECLIPSELINK_CACHE_SHARED_DEFAULT); } - + + // ********** get/set property ********** + @Override protected void setProperty(String propertyName, Object newValue) throws Exception { throw new UnsupportedOperationException(); } - protected void verifyPutProperty(String propertyName, Object expectedValue) throws Exception { + @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/customization/CustomizationAdapterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/customization/CustomizationAdapterTests.java index 39738e7268..7b2c35af62 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/customization/CustomizationAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/customization/CustomizationAdapterTests.java @@ -22,7 +22,6 @@ import org.eclipse.jpt.eclipselink.core.internal.context.customization.Weaving; import org.eclipse.jpt.eclipselink.core.tests.internal.PersistenceUnitTestCase; import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter; import org.eclipse.jpt.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.utility.model.event.PropertyChangeEvent; import org.eclipse.jpt.utility.model.listener.ListChangeListener; import org.eclipse.jpt.utility.model.listener.PropertyChangeListener; import org.eclipse.jpt.utility.model.value.ListValueModel; @@ -143,20 +142,6 @@ public class CustomizationAdapterTests extends PersistenceUnitTestCase }; } - private PropertyChangeListener buildPropertyChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - CustomizationAdapterTests.this.propertyChangedEvent = event; - CustomizationAdapterTests.this.propertyChangedEventCount++; - } - - @Override - public String toString() { - return "Customization listener"; - } - }; - } - @Override protected void clearEvent() { super.clearEvent(); @@ -440,7 +425,7 @@ public class CustomizationAdapterTests extends PersistenceUnitTestCase this.throwMissingDefinition("setCustomizationProperty", propertyName); } - // ********** setting properties ********** + // ********** get/set property ********** @Override protected void setProperty(String propertyName, Object newValue) throws Exception { if (propertyName.equals(Customization.THROW_EXCEPTIONS_PROPERTY)) @@ -460,23 +445,25 @@ public class CustomizationAdapterTests extends PersistenceUnitTestCase } @Override - protected void verifyPutProperty(String propertyName, Object expectedValue) throws NoSuchFieldException { + protected Object getProperty(String propertyName) throws NoSuchFieldException { + Object modelValue = null; if (propertyName.equals(Customization.THROW_EXCEPTIONS_PROPERTY)) - this.verifyPutProperty(propertyName, this.customization.getThrowExceptions(), expectedValue); + modelValue = this.customization.getThrowExceptions(); else if (propertyName.equals(Customization.WEAVING_PROPERTY)) - this.verifyPutProperty(propertyName, this.customization.getWeaving(), expectedValue); + modelValue = this.customization.getWeaving(); else if (propertyName.equals(Customization.WEAVING_LAZY_PROPERTY)) - this.verifyPutProperty(propertyName, this.customization.getWeavingLazy(), expectedValue); + modelValue = this.customization.getWeavingLazy(); else if (propertyName.equals(Customization.WEAVING_CHANGE_TRACKING_PROPERTY)) - this.verifyPutProperty(propertyName, this.customization.getWeavingChangeTracking(), expectedValue); + modelValue = this.customization.getWeavingChangeTracking(); else if (propertyName.equals(Customization.WEAVING_FETCH_GROUPS_PROPERTY)) - this.verifyPutProperty(propertyName, this.customization.getWeavingFetchGroups(), expectedValue); + modelValue = this.customization.getWeavingFetchGroups(); else if (propertyName.equals(Customization.SESSION_CUSTOMIZER_PROPERTY)) - this.verifyPutProperty(propertyName, this.customization.getSessionCustomizer(), expectedValue); + modelValue = this.customization.getSessionCustomizer(); else - this.throwMissingDefinition("verifyPutProperty", propertyName); + this.throwMissingDefinition("getProperty", propertyName); + return modelValue; } - + protected PersistenceUnitProperties model() { return this.customization; } diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/customization/CustomizationValueModelTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/customization/CustomizationValueModelTests.java index 9122910d29..8c6bb1f06f 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/customization/CustomizationValueModelTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/customization/CustomizationValueModelTests.java @@ -146,12 +146,15 @@ public class CustomizationValueModelTests extends PersistenceUnitTestCase this.throwExceptionsHolder, Customization.ECLIPSELINK_THROW_EXCEPTIONS); } - + + // ********** get/set property ********** + @Override protected void setProperty(String propertyName, Object newValue) throws Exception { throw new UnsupportedOperationException(); } - protected void verifyPutProperty(String propertyName, Object expectedValue) throws Exception { + @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/logging/LoggingAdapterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/logging/LoggingAdapterTests.java index dd19708873..74c5afc9f2 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/logging/LoggingAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/logging/LoggingAdapterTests.java @@ -21,7 +21,6 @@ import org.eclipse.jpt.eclipselink.core.internal.context.logging.Logging; import org.eclipse.jpt.eclipselink.core.internal.context.logging.LoggingLevel; import org.eclipse.jpt.eclipselink.core.tests.internal.PersistenceUnitTestCase; import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter; -import org.eclipse.jpt.utility.model.event.PropertyChangeEvent; import org.eclipse.jpt.utility.model.listener.PropertyChangeListener; import org.eclipse.jpt.utility.model.value.ListValueModel; @@ -107,20 +106,6 @@ public class LoggingAdapterTests extends PersistenceUnitTestCase // ********** Listeners ********** - private PropertyChangeListener buildPropertyChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - LoggingAdapterTests.this.propertyChangedEvent = event; - LoggingAdapterTests.this.propertyChangedEventCount++; - } - - @Override - public String toString() { - return "Logging listener"; - } - }; - } - // ********** Listeners tests ********** public void testHasListeners() throws Exception { // new @@ -132,6 +117,7 @@ public class LoggingAdapterTests extends PersistenceUnitTestCase assertTrue(propertiesAdapter.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); assertTrue(ctdProperty.hasAnyPropertyChangeListeners(Property.VALUE_PROPERTY)); this.verifyHasListeners(this.logging, Logging.TIMESTAMP_PROPERTY); +//TODO ADD OTHER PROPERTIES this.verifyHasListeners(propertyListAdapter); EclipseLinkLogging elLogging = (EclipseLinkLogging) this.logging; @@ -283,7 +269,7 @@ public class LoggingAdapterTests extends PersistenceUnitTestCase LOGGER_TEST_VALUE_2); } - // ********** setting properties ********** + // ********** get/set property ********** @Override protected void setProperty(String propertyName, Object newValue) throws Exception { if (propertyName.equals(Logging.LEVEL_PROPERTY)) @@ -305,34 +291,37 @@ public class LoggingAdapterTests extends PersistenceUnitTestCase } @Override - protected void verifyPutProperty(String propertyName, Object expectedValue) throws NoSuchFieldException { + protected Object getProperty(String propertyName) throws NoSuchFieldException { + Object modelValue = null; if (propertyName.equals(Logging.LEVEL_PROPERTY)) - this.verifyPutProperty(propertyName, this.logging.getLevel(), expectedValue); + modelValue = this.logging.getLevel(); else if (propertyName.equals(Logging.TIMESTAMP_PROPERTY)) - this.verifyPutProperty(propertyName, this.logging.getTimestamp(), expectedValue); + modelValue = this.logging.getTimestamp(); else if (propertyName.equals(Logging.THREAD_PROPERTY)) - this.verifyPutProperty(propertyName, this.logging.getThread(), expectedValue); + modelValue = this.logging.getThread(); else if (propertyName.equals(Logging.SESSION_PROPERTY)) - this.verifyPutProperty(propertyName, this.logging.getSession(), expectedValue); + modelValue = this.logging.getSession(); else if (propertyName.equals(Logging.EXCEPTIONS_PROPERTY)) - this.verifyPutProperty(propertyName, this.logging.getExceptions(), expectedValue); + modelValue = this.logging.getExceptions(); else if (propertyName.equals(Logging.LOG_FILE_LOCATION_PROPERTY)) - this.verifyPutProperty(propertyName, this.logging.getLogFileLocation(), expectedValue); - else if (propertyName.equals(Logging.LOGGER_PROPERTY)) { - if(expectedValue == null) { - this.verifyPutProperty(propertyName, this.logging.getLogger(), null); - } - else if(expectedValue.getClass().isEnum()) { - this.verifyPutProperty( - propertyName, - this.logging.getLogger(), - this.getEclipseLinkStringValueOf(LOGGER_TEST_VALUE)); // model is storing EclipseLinkStringValue - } - else - this.verifyPutProperty(propertyName, this.logging.getLogger(), expectedValue); - } + modelValue = this.logging.getLogFileLocation(); + else if (propertyName.equals(Logging.LOGGER_PROPERTY)) + modelValue = this.logging.getLogger(); else - this.throwMissingDefinition("verifyPutProperty", propertyName); + 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_); } protected PersistenceUnitProperties model() { diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/logging/LoggingValueModelTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/logging/LoggingValueModelTests.java index d9c42f7095..77d9bda2f6 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/logging/LoggingValueModelTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/logging/LoggingValueModelTests.java @@ -145,12 +145,15 @@ public class LoggingValueModelTests extends PersistenceUnitTestCase this.timestampHolder, Logging.ECLIPSELINK_TIMESTAMP); } - + + // ********** get/set property ********** + @Override protected void setProperty(String propertyName, Object newValue) throws Exception { throw new UnsupportedOperationException(); } - protected void verifyPutProperty(String propertyName, Object expectedValue) throws Exception { + @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/options/OptionsAdapterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/options/OptionsAdapterTests.java index 63e8624e55..b006bf2b05 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/options/OptionsAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/options/OptionsAdapterTests.java @@ -20,7 +20,6 @@ import org.eclipse.jpt.eclipselink.core.internal.context.options.Options; import org.eclipse.jpt.eclipselink.core.internal.context.options.TargetDatabase; import org.eclipse.jpt.eclipselink.core.tests.internal.PersistenceUnitTestCase; import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter; -import org.eclipse.jpt.utility.model.event.PropertyChangeEvent; import org.eclipse.jpt.utility.model.listener.PropertyChangeListener; import org.eclipse.jpt.utility.model.value.ListValueModel; @@ -95,20 +94,6 @@ public class OptionsAdapterTests extends PersistenceUnitTestCase // ********** Listeners ********** - private PropertyChangeListener buildPropertyChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - OptionsAdapterTests.this.propertyChangedEvent = event; - OptionsAdapterTests.this.propertyChangedEventCount++; - } - - @Override - public String toString() { - return "Options listener"; - } - }; - } - // ********** Listeners tests ********** public void testHasListeners() throws Exception { // new @@ -238,7 +223,7 @@ public class OptionsAdapterTests extends PersistenceUnitTestCase SESSION_EVENT_LISTENER_TEST_VALUE_2); } - // ********** setting properties ********** + // ********** get/set property ********** @Override protected void setProperty(String propertyName, Object newValue) throws Exception { if (propertyName.equals(Options.SESSION_NAME_PROPERTY)) @@ -256,19 +241,21 @@ public class OptionsAdapterTests extends PersistenceUnitTestCase } @Override - protected void verifyPutProperty(String propertyName, Object expectedValue) throws NoSuchFieldException { + protected Object getProperty(String propertyName) throws NoSuchFieldException { + Object modelValue = null; if (propertyName.equals(Options.SESSION_NAME_PROPERTY)) - this.verifyPutProperty(propertyName, this.options.getSessionName(), expectedValue); + modelValue = this.options.getSessionName(); else if (propertyName.equals(Options.SESSIONS_XML_PROPERTY)) - this.verifyPutProperty(propertyName, this.options.getSessionsXml(), expectedValue); + modelValue = this.options.getSessionsXml(); else if (propertyName.equals(Options.SESSION_INCLUDE_DESCRIPTOR_QUERIES_PROPERTY)) - this.verifyPutProperty(propertyName, this.options.getIncludeDescriptorQueries(), expectedValue); + modelValue = this.options.getIncludeDescriptorQueries(); else if (propertyName.equals(Options.TARGET_DATABASE_PROPERTY)) - this.verifyPutProperty(propertyName, this.options.getTargetDatabase(), expectedValue); + modelValue = this.options.getTargetDatabase(); else if (propertyName.equals(Options.SESSION_EVENT_LISTENER_PROPERTY)) - this.verifyPutProperty(propertyName, this.options.getEventListener(), expectedValue); + modelValue = this.options.getEventListener(); else - this.throwMissingDefinition("verifyPutProperty", propertyName); + this.throwMissingDefinition("getProperty", propertyName); + return modelValue; } protected PersistenceUnitProperties model() { diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/options/OptionsValueModelTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/options/OptionsValueModelTests.java index 3c06519c5f..d5aab317f2 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/options/OptionsValueModelTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/options/OptionsValueModelTests.java @@ -145,12 +145,15 @@ public class OptionsValueModelTests extends PersistenceUnitTestCase this.includeDescriptorQueriesHolder, Options.ECLIPSELINK_SESSION_INCLUDE_DESCRIPTOR_QUERIES); } - + + // ********** get/set property ********** + @Override protected void setProperty(String propertyName, Object newValue) throws Exception { throw new UnsupportedOperationException(); } - protected void verifyPutProperty(String propertyName, Object expectedValue) throws Exception { + @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/schema/generation/SchemaGenerationAdapterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/schema/generation/SchemaGenerationAdapterTests.java index e8d0bf6679..f435521b0c 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/schema/generation/SchemaGenerationAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/schema/generation/SchemaGenerationAdapterTests.java @@ -21,7 +21,6 @@ import org.eclipse.jpt.eclipselink.core.internal.context.schema.generation.Outpu import org.eclipse.jpt.eclipselink.core.internal.context.schema.generation.SchemaGeneration; import org.eclipse.jpt.eclipselink.core.tests.internal.PersistenceUnitTestCase; import org.eclipse.jpt.utility.internal.model.value.ListAspectAdapter; -import org.eclipse.jpt.utility.model.event.PropertyChangeEvent; import org.eclipse.jpt.utility.model.listener.PropertyChangeListener; import org.eclipse.jpt.utility.model.value.ListValueModel; @@ -71,20 +70,6 @@ public class SchemaGenerationAdapterTests extends PersistenceUnitTestCase this.clearEvent(); } - private PropertyChangeListener buildPropertyChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - SchemaGenerationAdapterTests.this.propertyChangedEvent = event; - SchemaGenerationAdapterTests.this.propertyChangedEventCount++; - } - - @Override - public String toString() { - return "SchemaGeneration listener"; - } - }; - } - /** * Initializes directly the PU properties before testing. Cannot use * Property Holder to initialize because it is not created yet @@ -239,7 +224,7 @@ public class SchemaGenerationAdapterTests extends PersistenceUnitTestCase this.verifyAddRemoveProperty(SchemaGeneration.DDL_GENERATION_TYPE_PROPERTY, DDL_GENERATION_TYPE_KEY, DDL_GENERATION_TYPE_TEST_VALUE, DDL_GENERATION_TYPE_TEST_VALUE_2); } - // ****** convenience methods ******* + // ********** get/set property ********** @Override protected void setProperty(String propertyName, Object newValue) throws NoSuchFieldException { if (propertyName.equals(SchemaGeneration.OUTPUT_MODE_PROPERTY)) @@ -259,19 +244,21 @@ public class SchemaGenerationAdapterTests extends PersistenceUnitTestCase } @Override - protected void verifyPutProperty(String propertyName, Object expectedValue) throws NoSuchFieldException { + protected Object getProperty(String propertyName) throws NoSuchFieldException { + Object modelValue = null; if (propertyName.equals(SchemaGeneration.OUTPUT_MODE_PROPERTY)) - this.verifyPutProperty(propertyName, this.schemaGeneration.getOutputMode(), expectedValue); + modelValue = this.schemaGeneration.getOutputMode(); else if (propertyName.equals(SchemaGeneration.DDL_GENERATION_TYPE_PROPERTY)) - this.verifyPutProperty(propertyName, this.schemaGeneration.getDdlGenerationType(), expectedValue); + modelValue = this.schemaGeneration.getDdlGenerationType(); else if (propertyName.equals(SchemaGeneration.APPLICATION_LOCATION_PROPERTY)) - this.verifyPutProperty(propertyName, this.schemaGeneration.getApplicationLocation(), expectedValue); + modelValue = this.schemaGeneration.getApplicationLocation(); else if (propertyName.equals(SchemaGeneration.CREATE_FILE_NAME_PROPERTY)) - this.verifyPutProperty(propertyName, this.schemaGeneration.getCreateFileName(), expectedValue); + modelValue = this.schemaGeneration.getCreateFileName(); else if (propertyName.equals(SchemaGeneration.DROP_FILE_NAME_PROPERTY)) - this.verifyPutProperty(propertyName, this.schemaGeneration.getDropFileName(), expectedValue); + modelValue = this.schemaGeneration.getDropFileName(); else - this.throwMissingDefinition("verifyPutProperty", propertyName); + this.throwMissingDefinition("getProperty", propertyName); + return modelValue; } protected PersistenceUnitProperties model() { diff --git a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/schema/generation/SchemaGenerationBasicAdapterTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/schema/generation/SchemaGenerationBasicAdapterTests.java index 22e2c7f566..2c13374374 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/schema/generation/SchemaGenerationBasicAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/schema/generation/SchemaGenerationBasicAdapterTests.java @@ -23,7 +23,6 @@ import org.eclipse.jpt.eclipselink.core.internal.context.schema.generation.Schem import org.eclipse.jpt.eclipselink.core.tests.internal.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.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; @@ -60,20 +59,6 @@ public class SchemaGenerationBasicAdapterTests extends PersistenceUnitTestCase this.clearEvent(); } - private PropertyChangeListener buildPropertyChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - SchemaGenerationBasicAdapterTests.this.propertyChangedEvent = event; - SchemaGenerationBasicAdapterTests.this.propertyChangedEventCount++; - } - - @Override - public String toString() { - return "outputMode listener"; - } - }; - } - /** * Initializes directly the PU properties before testing. Cannot use * Property Holder to initialize because it is not created yet @@ -146,7 +131,7 @@ public class SchemaGenerationBasicAdapterTests extends PersistenceUnitTestCase // Replace this.persistenceUnitPut(outputModeKey, OUTPUT_MODE_TEST_VALUE_2); - this.verifyPutProperty(SchemaGeneration.OUTPUT_MODE_PROPERTY, OUTPUT_MODE_TEST_VALUE_2, this.schemaGeneration.getOutputMode()); + this.verifyPutEvent(SchemaGeneration.OUTPUT_MODE_PROPERTY, OUTPUT_MODE_TEST_VALUE_2, this.schemaGeneration.getOutputMode()); // Remove this.clearEvent(); @@ -163,16 +148,16 @@ public class SchemaGenerationBasicAdapterTests extends PersistenceUnitTestCase ++this.propertiesTotal; ++this.modelPropertiesSize; this.persistenceUnitPut(outputModeKey, OUTPUT_MODE_TEST_VALUE); - this.verifyPutProperty(SchemaGeneration.OUTPUT_MODE_PROPERTY, OUTPUT_MODE_TEST_VALUE, this.schemaGeneration.getOutputMode()); + this.verifyPutEvent(SchemaGeneration.OUTPUT_MODE_PROPERTY, OUTPUT_MODE_TEST_VALUE, this.schemaGeneration.getOutputMode()); // Replace again this.persistenceUnitPut(outputModeKey, OUTPUT_MODE_TEST_VALUE_2); - this.verifyPutProperty(SchemaGeneration.OUTPUT_MODE_PROPERTY, OUTPUT_MODE_TEST_VALUE_2, this.schemaGeneration.getOutputMode()); + 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.verifyPutProperty(SchemaGeneration.OUTPUT_MODE_PROPERTY, OUTPUT_MODE_TEST_VALUE, this.schemaGeneration.getOutputMode()); + this.verifyPutEvent(SchemaGeneration.OUTPUT_MODE_PROPERTY, OUTPUT_MODE_TEST_VALUE, this.schemaGeneration.getOutputMode()); } // ****** convenience methods ******* @@ -193,12 +178,15 @@ public class SchemaGenerationBasicAdapterTests extends PersistenceUnitTestCase } }; } - + + // ********** get/set property ********** + @Override protected void setProperty(String propertyName, Object newValue) throws Exception { throw new UnsupportedOperationException(); } - protected void verifyPutProperty(String propertyName, Object expectedValue) throws Exception { + @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/schema/generation/SchemaGenerationValueModelTests.java b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/schema/generation/SchemaGenerationValueModelTests.java index ddd26f67bc..db8ceb2f34 100644 --- a/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/schema/generation/SchemaGenerationValueModelTests.java +++ b/jpa/tests/org.eclipse.jpt.eclipselink.core.tests/src/org/eclipse/jpt/eclipselink/core/tests/internal/schema/generation/SchemaGenerationValueModelTests.java @@ -218,12 +218,15 @@ public class SchemaGenerationValueModelTests extends PersistenceUnitTestCase this.outputModeHolder, SchemaGeneration.ECLIPSELINK_DDL_GENERATION_OUTPUT_MODE); } - + + // ********** get/set property ********** + @Override protected void setProperty(String propertyName, Object newValue) throws Exception { throw new UnsupportedOperationException(); } - protected void verifyPutProperty(String propertyName, Object expectedValue) throws Exception { + @Override + protected Object getProperty(String propertyName) throws NoSuchFieldException { throw new UnsupportedOperationException(); } } |