diff options
Diffstat (limited to 'context/context-test-utils')
14 files changed, 110 insertions, 74 deletions
diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java index 0c94bcb1d..efad26052 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateLocaleItem.java @@ -107,7 +107,7 @@ public class TestContextDateLocaleItem implements Serializable { * * @return the TZ value */ - public String getTZValue() { + public String getTzValue() { return timeZoneString; } @@ -116,7 +116,7 @@ public class TestContextDateLocaleItem implements Serializable { * * @param tzValue the TZ value */ - public void setTZValue(final String tzValue) { + public void setTzValue(final String tzValue) { this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName(); } @@ -125,7 +125,7 @@ public class TestContextDateLocaleItem implements Serializable { * * @return the dst */ - public boolean getDST() { + public boolean getDst() { return dst; } @@ -134,7 +134,7 @@ public class TestContextDateLocaleItem implements Serializable { * * @param newDst the dst */ - public void setDST(final boolean newDst) { + public void setDst(final boolean newDst) { this.dst = newDst; } @@ -143,7 +143,7 @@ public class TestContextDateLocaleItem implements Serializable { * * @return the UTC offset */ - public int getUTCOffset() { + public int getUtcOffset() { return utcOffset; } @@ -152,7 +152,7 @@ public class TestContextDateLocaleItem implements Serializable { * * @param newUtcOffset the UTC offset */ - public void setUTCOffset(final int newUtcOffset) { + public void setUtcOffset(final int newUtcOffset) { this.utcOffset = newUtcOffset; } diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java index 7d3ed80d5..7e1e32924 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/concepts/TestContextDateTzItem.java @@ -91,7 +91,7 @@ public class TestContextDateTzItem implements Serializable { * * @return the TZ value */ - public String getTZValue() { + public String getTzValue() { return timeZoneString; } @@ -100,7 +100,7 @@ public class TestContextDateTzItem implements Serializable { * * @param tzValue the TZ value */ - public void setTZValue(final String tzValue) { + public void setTzValue(final String tzValue) { this.timeZoneString = TimeZone.getTimeZone(tzValue).getDisplayName(); } @@ -109,7 +109,7 @@ public class TestContextDateTzItem implements Serializable { * * @return the dst */ - public boolean getDST() { + public boolean getDst() { return dst; } @@ -118,7 +118,7 @@ public class TestContextDateTzItem implements Serializable { * * @param newDst the dst */ - public void setDST(final boolean newDst) { + public void setDst(final boolean newDst) { this.dst = newDst; } diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java index 0fd013da7..084220c2f 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextInstantiation.java @@ -190,8 +190,8 @@ public class ContextInstantiation { final AxContextModel externalContextModel = TestContextAlbumFactory.createExternalContextModel(); final TestContextDateTzItem tci9A = new TestContextDateTzItem(tci9); - final TestContextDateLocaleItem tciAA = new TestContextDateLocaleItem(tciA); - final TestExternalContextItem externalContext = getTestExternalContextItem(testDate, tci9A, tciAA); + final TestContextDateLocaleItem tciA_A = new TestContextDateLocaleItem(tciA); + final TestExternalContextItem externalContext = getTestExternalContextItem(testDate, tci9A, tciA_A); final Map<String, Object> valueMap2 = new HashMap<>(); valueMap2.put(EXTERNAL_CONTEXT, externalContext); @@ -226,7 +226,7 @@ public class ContextInstantiation { assertEquals(tci9A.getDateValue().getTime(), externalContextItem.getTestExternalContextItem009().getDateValue().getTime()); - assertEquals(tciAA.getDateValue().getTime(), + assertEquals(tciA_A.getDateValue().getTime(), externalContextItem.getTestExternalContextItem00A().getDateValue().getTime()); assertEquals(TEST_TREE_SET, externalContextItem.getTestExternalContextItem00B().getSetValue()); assertEquals(TEST_HASH_MAP, externalContextItem.getTestExternalContextItem00C().getMapValue()); @@ -275,7 +275,7 @@ public class ContextInstantiation { assertEquals("album \"ExternalContextAlbum:0.0.1\" null values are illegal on key " + "\"TestExternalContextItem00A\" for put()", e.getMessage()); } - assertEquals(tciAA, externalContextItem.getTestExternalContextItem00A()); + assertEquals(tciA_A, externalContextItem.getTestExternalContextItem00A()); // Should return the hash set assertEquals(TEST_TREE_SET, externalContextItem.getTestExternalContextItem00B().getSetValue()); @@ -471,9 +471,9 @@ public class ContextInstantiation { private TestContextDateLocaleItem getTestContextDateLocaleItem(final Date testDate) { final TestContextDateLocaleItem tciA = new TestContextDateLocaleItem(); tciA.setDateValue(new TestContextDateItem(testDate)); - tciA.setTZValue(TIME_ZONE.getDisplayName()); - tciA.setDST(true); - tciA.setUTCOffset(-600); + tciA.setTzValue(TIME_ZONE.getDisplayName()); + tciA.setDst(true); + tciA.setUtcOffset(-600); tciA.setLocale(Locale.ENGLISH); return tciA; } @@ -481,13 +481,13 @@ public class ContextInstantiation { private TestContextDateTzItem getTestContextDateTzItem(final Date testDate) { final TestContextDateTzItem tci9 = new TestContextDateTzItem(); tci9.setDateValue(new TestContextDateItem(testDate)); - tci9.setTZValue(TIME_ZONE.getDisplayName()); - tci9.setDST(true); + tci9.setTzValue(TIME_ZONE.getDisplayName()); + tci9.setDst(true); return tci9; } private TestExternalContextItem getTestExternalContextItem(final Date testDate, final TestContextDateTzItem tci9A, - final TestContextDateLocaleItem tciAA) { + final TestContextDateLocaleItem tciAa) { final TestExternalContextItem externalContext = new TestExternalContextItem(); final TestContextBooleanItem testExternalContextItem000 = new TestContextBooleanItem(false); @@ -513,7 +513,7 @@ public class ContextInstantiation { externalContext.setTestExternalContextItem007(testExternalContextItem007); externalContext.setTestExternalContextItem008(testExternalContextItem008); externalContext.setTestExternalContextItem009(tci9A); - externalContext.setTestExternalContextItem00A(tciAA); + externalContext.setTestExternalContextItem00A(tciAa); externalContext.setTestExternalContextItem00B(testExternalContextItem00B); externalContext.setTestExternalContextItem00C(testExternalContextItem00C); return externalContext; diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java index 8f066c8e3..95d14324c 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/ContextUpdate.java @@ -149,9 +149,9 @@ public class ContextUpdate { private TestContextDateLocaleItem getTestContextDateLocaleItem() { final TestContextDateLocaleItem tciA = new TestContextDateLocaleItem(); tciA.setDateValue(new TestContextDateItem(new Date())); - tciA.setTZValue(TIME_ZONE.getDisplayName()); - tciA.setDST(true); - tciA.setUTCOffset(-600); + tciA.setTzValue(TIME_ZONE.getDisplayName()); + tciA.setDst(true); + tciA.setUtcOffset(-600); tciA.setLocale(Locale.ENGLISH); return tciA; } diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java index 4041c079d..244bd7d24 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/distribution/SequentialContextInstantiation.java @@ -253,9 +253,9 @@ public class SequentialContextInstantiation { // Should return null assertNull(dateAlbum.get("ItemNull")); // Put should return the previous contextItem - tciA00.setDST(false); + tciA00.setDst(false); final TestContextDateLocaleItem tciA03_clone = new TestContextDateLocaleItem(tciA03); - tciA03_clone.setDST(true); + tciA03_clone.setDst(true); TestContextDateLocaleItem retItem = (TestContextDateLocaleItem) dateAlbum.put("Item03", tciA03_clone); assertEquals(tciA03, retItem); retItem = (TestContextDateLocaleItem) dateAlbum.put("Item03", tciA03); @@ -332,17 +332,17 @@ public class SequentialContextInstantiation { private TestContextDateTzItem getTestContextDateTzItem(final Date testDate) { final TestContextDateTzItem tci9 = new TestContextDateTzItem(); tci9.setDateValue(new TestContextDateItem(testDate)); - tci9.setTZValue(TimeZone.getTimeZone("Europe/Dublin").getDisplayName()); - tci9.setDST(true); + tci9.setTzValue(TimeZone.getTimeZone("Europe/Dublin").getDisplayName()); + tci9.setDst(true); return tci9; } private TestContextDateLocaleItem getTestContextDateLocaleItem() { final TestContextDateLocaleItem tciA00 = new TestContextDateLocaleItem(); tciA00.setDateValue(new TestContextDateItem(new Date())); - tciA00.setTZValue(TIME_ZONE.getDisplayName()); - tciA00.setDST(true); - tciA00.setUTCOffset(-600); + tciA00.setTzValue(TIME_ZONE.getDisplayName()); + tciA00.setDst(true); + tciA00.setUtcOffset(-600); tciA00.setLocale(Locale.ENGLISH); return tciA00; } diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java index 4f6dd9b1f..88cdccc88 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContext.java @@ -96,7 +96,7 @@ public class ConcurrentContext { } else { // Spawn JVMs to run the tests for (int j = 0; j < configrationProvider.getJvmCount(); j++) { - final ConcurrentContextJVMThread task = new ConcurrentContextJVMThread(j, configrationProvider); + final ConcurrentContextJvmThread task = new ConcurrentContextJvmThread(j, configrationProvider); tasks.add(task); executorService.execute(task); } diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJVM.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java index 0f6900dbb..7d7548569 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJVM.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvm.java @@ -54,9 +54,9 @@ import org.slf4j.ext.XLoggerFactory; * * @author Liam Fallon (liam.fallon@ericsson.com) */ -public final class ConcurrentContextJVM { +public final class ConcurrentContextJvm { // Logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContextJVM.class); + private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContextJvm.class); private static final int IPV4_ADDRESS_LENGTH = 4; @@ -66,7 +66,7 @@ public final class ConcurrentContextJVM { private final ConfigrationProvider configrationProvider; - private ConcurrentContextJVM(final int jvmNo, final ConfigrationProvider configrationProvider) { + private ConcurrentContextJvm(final int jvmNo, final ConfigrationProvider configrationProvider) { this.jvmNo = jvmNo; this.configrationProvider = configrationProvider; final String name = configrationProvider.getTestName() + ":ConcurrentContextThread_" + jvmNo; @@ -157,8 +157,8 @@ public final class ConcurrentContextJVM { try { final ConfigrationProvider configrationProvider = new ConfigrationProviderImpl(testName, 1, threadCount, threadLoops, albumSize, lockType); - final ConcurrentContextJVM concurrentContextJVM = new ConcurrentContextJVM(jvmNo, configrationProvider); - concurrentContextJVM.execute(); + final ConcurrentContextJvm concurrentContextJvm = new ConcurrentContextJvm(jvmNo, configrationProvider); + concurrentContextJvm.execute(); } catch (final Exception e) { LOGGER.error("error running test in JVM", e); diff --git a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJVMThread.java b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java index 0c2aa7a90..339c95d26 100644 --- a/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJVMThread.java +++ b/context/context-test-utils/src/main/java/org/onap/policy/apex/context/test/locking/ConcurrentContextJvmThread.java @@ -43,15 +43,15 @@ import org.slf4j.ext.XLoggerFactory; * * @author Liam Fallon (liam.fallon@ericsson.com) */ -public class ConcurrentContextJVMThread implements Runnable, Closeable { +public class ConcurrentContextJvmThread implements Runnable, Closeable { // Logger for this class - private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContextJVMThread.class); + private static final XLogger LOGGER = XLoggerFactory.getXLogger(ConcurrentContextJvmThread.class); private final int jvm; private final ConfigrationProvider configrationProvider; private Process process = null; - public ConcurrentContextJVMThread(final int jvm, final ConfigrationProvider configrationProvider) { + public ConcurrentContextJvmThread(final int jvm, final ConfigrationProvider configrationProvider) { this.jvm = jvm; this.configrationProvider = configrationProvider; } @@ -70,7 +70,7 @@ public class ConcurrentContextJVMThread implements Runnable, Closeable { commandList.add("-Xmx512m"); commandList.add("-cp"); commandList.add(System.getProperty("java.class.path")); - commandList.add(ConcurrentContextJVM.class.getCanonicalName()); + commandList.add(ConcurrentContextJvm.class.getCanonicalName()); commandList.add(configrationProvider.getTestName()); commandList.add(new Integer(jvm).toString()); commandList.add(new Integer(configrationProvider.getThreadCount()).toString()); diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextAlbumUpdate.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextAlbumUpdate.java index 6b9ba15ad..54440370c 100644 --- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextAlbumUpdate.java +++ b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextAlbumUpdate.java @@ -24,7 +24,7 @@ import java.io.IOException; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor; +import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor; import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters; import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.ContextParameters; @@ -42,6 +42,9 @@ public class TestContextAlbumUpdate { private SchemaParameters schemaParameters; private ContextParameters contextParameters; + /** + * Set up context data. + */ @Before public void beforeTest() { contextParameters = new ContextParameters(); @@ -55,7 +58,7 @@ public class TestContextAlbumUpdate { ParameterService.register(contextParameters.getDistributorParameters()); ParameterService.register(contextParameters.getLockManagerParameters()); ParameterService.register(contextParameters.getPersistorParameters()); - + schemaParameters = new SchemaParameters(); schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME); schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters()); @@ -63,6 +66,9 @@ public class TestContextAlbumUpdate { ParameterService.register(schemaParameters); } + /** + * Clear down context data. + */ @After public void afterTest() { ParameterService.deregister(schemaParameters); @@ -74,17 +80,17 @@ public class TestContextAlbumUpdate { } @Test - public void testContextAlbumUpdateJVMLocalVarSet() throws ApexModelException, IOException, ApexException { + public void testContextAlbumUpdateJvmLocalVarSet() throws ApexModelException, IOException, ApexException { logger.debug("Running testContextAlbumUpdateJVMLocalVarSet test . . ."); - contextParameters.getDistributorParameters().setPluginClass(JVMLocalDistributor.class.getCanonicalName()); + contextParameters.getDistributorParameters().setPluginClass(JvmLocalDistributor.class.getCanonicalName()); new ContextAlbumUpdate().testContextAlbumUpdate(); logger.debug("Ran testContextAlbumUpdateJVMLocalVarSet test"); } @Test - public void testContextAlbumUpdateJVMLocalVarNotSet() throws ApexModelException, IOException, ApexException { + public void testContextAlbumUpdateJvmLocalVarNotSet() throws ApexModelException, IOException, ApexException { logger.debug("Running testContextAlbumUpdateJVMLocalVarNotSet test . . ."); new ContextAlbumUpdate().testContextAlbumUpdate(); diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextInstantiation.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextInstantiation.java index b10bc685c..ba402da24 100644 --- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextInstantiation.java +++ b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextInstantiation.java @@ -24,7 +24,7 @@ import java.io.IOException; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor; +import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor; import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters; import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.ContextParameters; @@ -47,6 +47,9 @@ public class TestContextInstantiation { private SchemaParameters schemaParameters; private ContextParameters contextParameters; + /** + * Set up context for tests. + */ @Before public void beforeTest() { contextParameters = new ContextParameters(); @@ -68,6 +71,9 @@ public class TestContextInstantiation { ParameterService.register(schemaParameters); } + /** + * Clear down context for tests. + */ @After public void afterTest() { ParameterService.deregister(schemaParameters); @@ -79,17 +85,17 @@ public class TestContextInstantiation { } @Test - public void testContextInstantiationJVMLocalVarSet() throws ApexModelException, IOException, ApexException { + public void testContextInstantiationJvmLocalVarSet() throws ApexModelException, IOException, ApexException { logger.debug("Running testContextInstantiationJVMLocalVarSet test . . ."); - contextParameters.getDistributorParameters().setPluginClass(JVMLocalDistributor.class.getCanonicalName()); + contextParameters.getDistributorParameters().setPluginClass(JvmLocalDistributor.class.getCanonicalName()); new ContextInstantiation().testContextInstantiation(); logger.debug("Ran testContextInstantiationJVMLocalVarSet test"); } @Test - public void testContextInstantiationJVMLocalVarNotSet() throws ApexModelException, IOException, ApexException { + public void testContextInstantiationJvmLocalVarNotSet() throws ApexModelException, IOException, ApexException { logger.debug("Running testContextInstantiationJVMLocalVarNotSet test . . ."); new ContextInstantiation().testContextInstantiation(); diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextUpdate.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextUpdate.java index 07a0cbe47..8ef8bf005 100644 --- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextUpdate.java +++ b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestContextUpdate.java @@ -25,7 +25,7 @@ import java.io.IOException; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor; +import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor; import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters; import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.ContextParameters; @@ -48,6 +48,9 @@ public class TestContextUpdate { private SchemaParameters schemaParameters; private ContextParameters contextParameters; + /** + * Set up context for tests. + */ @Before public void beforeTest() { contextParameters = new ContextParameters(); @@ -69,6 +72,9 @@ public class TestContextUpdate { ParameterService.register(schemaParameters); } + /** + * Clear down context for tests. + */ @After public void afterTest() { ParameterService.deregister(schemaParameters); @@ -80,17 +86,17 @@ public class TestContextUpdate { } @Test - public void testContextUpdateJVMLocalVarSet() throws ApexModelException, IOException, ApexException { + public void testContextUpdateJvmLocalVarSet() throws ApexModelException, IOException, ApexException { logger.debug("Running testContextUpdateJVMLocalVarSet test . . ."); - contextParameters.getDistributorParameters().setPluginClass(JVMLocalDistributor.class.getCanonicalName()); + contextParameters.getDistributorParameters().setPluginClass(JvmLocalDistributor.class.getCanonicalName()); new ContextUpdate().testContextUpdate(); logger.debug("Ran testContextUpdateJVMLocalVarSet test"); } @Test - public void testContextUpdateJVMLocalVarNotSet() throws ApexModelException, IOException, ApexException { + public void testContextUpdateJvmLocalVarNotSet() throws ApexModelException, IOException, ApexException { logger.debug("Running testContextUpdateJVMLocalVarNotSet test . . ."); new ContextUpdate().testContextUpdate(); diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestSequentialContextInstantiation.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestSequentialContextInstantiation.java index b37c8eafa..d1cdc6d97 100644 --- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestSequentialContextInstantiation.java +++ b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/distribution/TestSequentialContextInstantiation.java @@ -24,7 +24,7 @@ import java.io.IOException; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor; +import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor; import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters; import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.ContextParameters; @@ -43,10 +43,13 @@ import org.slf4j.ext.XLoggerFactory; public class TestSequentialContextInstantiation { // Logger for this class private static final XLogger logger = XLoggerFactory.getXLogger(TestSequentialContextInstantiation.class); - + private SchemaParameters schemaParameters; private ContextParameters contextParameters; + /** + * Set up context for tests. + */ @Before public void beforeTest() { contextParameters = new ContextParameters(); @@ -60,7 +63,7 @@ public class TestSequentialContextInstantiation { ParameterService.register(contextParameters.getDistributorParameters()); ParameterService.register(contextParameters.getLockManagerParameters()); ParameterService.register(contextParameters.getPersistorParameters()); - + schemaParameters = new SchemaParameters(); schemaParameters.setName(ContextParameterConstants.SCHEMA_GROUP_NAME); schemaParameters.getSchemaHelperParameterMap().put("JAVA", new JavaSchemaHelperParameters()); @@ -68,6 +71,9 @@ public class TestSequentialContextInstantiation { ParameterService.register(schemaParameters); } + /** + * Clear down context for tests. + */ @After public void afterTest() { ParameterService.deregister(schemaParameters); @@ -79,20 +85,20 @@ public class TestSequentialContextInstantiation { } @Test - public void testSequentialContextInstantiationJVMLocalVarSet() - throws ApexModelException, IOException, ApexException { + public void testSequentialContextInstantiationJvmLocalVarSet() + throws ApexModelException, IOException, ApexException { logger.debug("Running testSequentialContextInstantiationJVMLocalVarSet test . . ."); - contextParameters.getDistributorParameters().setPluginClass(JVMLocalDistributor.class.getCanonicalName()); - + contextParameters.getDistributorParameters().setPluginClass(JvmLocalDistributor.class.getCanonicalName()); + new SequentialContextInstantiation().testSequentialContextInstantiation(); logger.debug("Ran testSequentialContextInstantiationJVMLocalVarSet test"); } @Test - public void testSequentialContextInstantiationJVMLocalVarNotSet() - throws ApexModelException, IOException, ApexException { + public void testSequentialContextInstantiationJvmLocalVarNotSet() + throws ApexModelException, IOException, ApexException { logger.debug("Running testSequentialContextInstantiationJVMLocalVarNotSet test . . ."); new ContextParameters(); diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/locking/TestConcurrentContext.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/locking/TestConcurrentContext.java index 8fca90b07..ed9aff0c1 100644 --- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/locking/TestConcurrentContext.java +++ b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/locking/TestConcurrentContext.java @@ -31,8 +31,8 @@ import java.util.Map; import org.junit.After; import org.junit.Before; import org.junit.Test; -import org.onap.policy.apex.context.impl.distribution.jvmlocal.JVMLocalDistributor; -import org.onap.policy.apex.context.impl.locking.jvmlocal.JVMLocalLockManager; +import org.onap.policy.apex.context.impl.distribution.jvmlocal.JvmLocalDistributor; +import org.onap.policy.apex.context.impl.locking.jvmlocal.JvmLocalLockManager; import org.onap.policy.apex.context.impl.schema.java.JavaSchemaHelperParameters; import org.onap.policy.apex.context.parameters.ContextParameterConstants; import org.onap.policy.apex.context.parameters.ContextParameters; @@ -66,6 +66,9 @@ public class TestConcurrentContext { private SchemaParameters schemaParameters; private ContextParameters contextParameters; + /** + * Set up context for tests. + */ @Before public void beforeTest() { contextParameters = new ContextParameters(); @@ -87,6 +90,9 @@ public class TestConcurrentContext { ParameterService.register(schemaParameters); } + /** + * Clear down context for tests. + */ @After public void afterTest() { ParameterService.deregister(schemaParameters); @@ -98,10 +104,10 @@ public class TestConcurrentContext { } @Test - public void testConcurrentContextJVMLocalVarSet() throws Exception { + public void testConcurrentContextJvmLocalVarSet() throws Exception { logger.debug("Running testConcurrentContextJVMLocalVarSet test . . ."); - contextParameters.getLockManagerParameters().setPluginClass(JVMLocalLockManager.class.getCanonicalName()); + contextParameters.getLockManagerParameters().setPluginClass(JvmLocalLockManager.class.getCanonicalName()); final ConfigrationProvider configrationProvider = getConfigrationProvider("JVMLocalVarSet", TEST_JVM_COUNT_SINGLE_JVM, TEST_THREAD_COUNT_SINGLE_JVM, TEST_THREAD_LOOPS); @@ -120,7 +126,7 @@ public class TestConcurrentContext { } @Test - public void testConcurrentContextJVMLocalNoVarSet() throws Exception { + public void testConcurrentContextJvmLocalNoVarSet() throws Exception { logger.debug("Running testConcurrentContextJVMLocalNoVarSet test . . ."); final ConfigrationProvider configrationProvider = getConfigrationProvider("JVMLocalNoVarSet", @@ -139,11 +145,11 @@ public class TestConcurrentContext { } @Test - public void testConcurrentContextMultiJVMNoLock() throws Exception { + public void testConcurrentContextMultiJvmNoLock() throws Exception { logger.debug("Running testConcurrentContextMultiJVMNoLock test . . ."); - contextParameters.getDistributorParameters().setPluginClass(JVMLocalDistributor.class.getCanonicalName()); - contextParameters.getLockManagerParameters().setPluginClass(JVMLocalLockManager.class.getCanonicalName()); + contextParameters.getDistributorParameters().setPluginClass(JvmLocalDistributor.class.getCanonicalName()); + contextParameters.getLockManagerParameters().setPluginClass(JvmLocalLockManager.class.getCanonicalName()); final ConfigrationProvider configrationProvider = getConfigrationProvider("testConcurrentContextMultiJVMNoLock", TEST_JVM_COUNT_MULTI_JVM, TEST_THREAD_COUNT_MULTI_JVM, TEST_THREAD_LOOPS); diff --git a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java index c8628935c..9aad0ad78 100644 --- a/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java +++ b/context/context-test-utils/src/test/java/org/onap/policy/apex/context/test/persistence/TestPersistentContextInstantiation.java @@ -83,6 +83,9 @@ public class TestPersistentContextInstantiation { new File("derby.log").delete(); } + /** + * Set up context for tests. + */ @Before public void beforeTest() { contextParameters = new ContextParameters(); @@ -104,6 +107,9 @@ public class TestPersistentContextInstantiation { ParameterService.register(schemaParameters); } + /** + * Clear down context for tests. + */ @After public void afterTest() { ParameterService.deregister(schemaParameters); @@ -166,8 +172,8 @@ public class TestPersistentContextInstantiation { final TestContextDateItem testDate = new TestContextDateItem(new Date()); final TestContextDateLocaleItem tci00A = new TestContextDateLocaleItem(); tci00A.setDateValue(testDate); - tci00A.setTZValue(TimeZone.getTimeZone("Europe/Dublin").toString()); - tci00A.setDST(true); + tci00A.setTzValue(TimeZone.getTimeZone("Europe/Dublin").toString()); + tci00A.setDst(true); final Map<String, Object> valueMap1 = new HashMap<String, Object>(); valueMap1.put("TestPolicyContextItem00A", tci00A); @@ -176,7 +182,7 @@ public class TestPersistentContextInstantiation { assertEquals(((TestContextDateLocaleItem) contextAlbumForDate.get("TestPolicyContextItem00A")).getDateValue(), testDate); - assertEquals(((TestContextDateLocaleItem) contextAlbumForDate.get("TestPolicyContextItem00A")).getDST(), true); + assertEquals(((TestContextDateLocaleItem) contextAlbumForDate.get("TestPolicyContextItem00A")).getDst(), true); contextAlbumForDate.flush(); |