diff options
author | a.sreekumar <ajith.sreekumar@est.tech> | 2019-06-21 11:21:14 +0000 |
---|---|---|
committer | a.sreekumar <ajith.sreekumar@est.tech> | 2019-06-21 11:21:14 +0000 |
commit | 5be846bcdbe6e9dfa3b81e4b95de37acea18d1a2 (patch) | |
tree | 596c0caffb095e693ac63267d8f804eb0b630196 /testsuites | |
parent | 3b7b20029b7b663506b7c918f333f09dd18d6452 (diff) |
Replace uses of getCanonicalName() with getName() in APEX
Change-Id: Ifcd8866e65a7bc1238d5a4137f7bad288a5bfb3b
Issue-ID: POLICY-1861
Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
Diffstat (limited to 'testsuites')
11 files changed, 35 insertions, 36 deletions
diff --git a/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelSaverTest.java b/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelSaverTest.java index 744f47db8..ab34f5442 100644 --- a/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelSaverTest.java +++ b/testsuites/integration/integration-common/src/test/java/org/onap/policy/apex/testsuites/integration/common/model/SampleDomainModelSaverTest.java @@ -43,7 +43,7 @@ public class SampleDomainModelSaverTest { SampleDomainModelSaver.main(null); fail("test should throw an exception"); } catch (Exception exc) { - assertEquals("java.lang.NullPointerException", exc.getClass().getCanonicalName()); + assertEquals("java.lang.NullPointerException", exc.getClass().getName()); } String[] args0 = diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java index 0759b7eeb..ae818f223 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/TestConcurrentContext.java @@ -171,7 +171,7 @@ public class TestConcurrentContext { logger.debug("Running testConcurrentContextJVMLocalVarSet test . . ."); final ContextParameters contextParameters = new ContextParameters(); - contextParameters.getLockManagerParameters().setPluginClass(JvmLocalLockManager.class.getCanonicalName()); + contextParameters.getLockManagerParameters().setPluginClass(JvmLocalLockManager.class.getName()); setContextParmetersInParameterService(contextParameters); final ConfigrationProvider configrationProvider = getConfigrationProvider("JVMLocalVarSet", @@ -229,8 +229,8 @@ public class TestConcurrentContext { logger.debug("Running testConcurrentContextMultiJVMNoLock test . . ."); final ContextParameters contextParameters = new ContextParameters(); - contextParameters.getDistributorParameters().setPluginClass(JvmLocalDistributor.class.getCanonicalName()); - contextParameters.getLockManagerParameters().setPluginClass(JvmLocalLockManager.class.getCanonicalName()); + contextParameters.getDistributorParameters().setPluginClass(JvmLocalDistributor.class.getName()); + contextParameters.getLockManagerParameters().setPluginClass(JvmLocalLockManager.class.getName()); setContextParmetersInParameterService(contextParameters); final ConfigrationProvider configrationProvider = getConfigrationProvider("testConcurrentContextMultiJVMNoLock", @@ -259,7 +259,7 @@ public class TestConcurrentContext { final ContextParameters contextParameters = new ContextParameters(); contextParameters.getDistributorParameters().setPluginClass(DEFAULT_DISTRIBUTOR_PLUGIN_CLASS); - contextParameters.getLockManagerParameters().setPluginClass(HazelcastLockManager.class.getCanonicalName()); + contextParameters.getLockManagerParameters().setPluginClass(HazelcastLockManager.class.getName()); setContextParmetersInParameterService(contextParameters); final ConfigrationProvider configrationProvider = getConfigrationProvider("HazelcastLock", @@ -292,7 +292,7 @@ public class TestConcurrentContext { distributorParameters.setPluginClass(DEFAULT_DISTRIBUTOR_PLUGIN_CLASS); final CuratorLockManagerParameters curatorParameters = new CuratorLockManagerParameters(); - curatorParameters.setPluginClass(CuratorLockManager.class.getCanonicalName()); + curatorParameters.setPluginClass(CuratorLockManager.class.getName()); curatorParameters.setZookeeperAddress(ZOOKEEPER_ADDRESS + ":" + zookeeperPort); contextParameters.setLockManagerParameters(curatorParameters); setContextParmetersInParameterService(contextParameters); @@ -325,8 +325,8 @@ public class TestConcurrentContext { final ContextParameters contextParameters = new ContextParameters(); final DistributorParameters distributorParameters = contextParameters.getDistributorParameters(); - distributorParameters.setPluginClass(HazelcastContextDistributor.class.getCanonicalName()); - contextParameters.getLockManagerParameters().setPluginClass(HazelcastLockManager.class.getCanonicalName()); + distributorParameters.setPluginClass(HazelcastContextDistributor.class.getName()); + contextParameters.getLockManagerParameters().setPluginClass(HazelcastLockManager.class.getName()); setContextParmetersInParameterService(contextParameters); final ConfigrationProvider configrationProvider = getConfigrationProvider("HazelcastMultiHazelcastlock", @@ -358,10 +358,10 @@ public class TestConcurrentContext { final ContextParameters contextParameters = new ContextParameters(); final InfinispanDistributorParameters infinispanParameters = new InfinispanDistributorParameters(); - infinispanParameters.setPluginClass(InfinispanContextDistributor.class.getCanonicalName()); + infinispanParameters.setPluginClass(InfinispanContextDistributor.class.getName()); infinispanParameters.setConfigFile("infinispan/infinispan-context-test.xml"); contextParameters.setDistributorParameters(infinispanParameters); - contextParameters.getLockManagerParameters().setPluginClass(HazelcastLockManager.class.getCanonicalName()); + contextParameters.getLockManagerParameters().setPluginClass(HazelcastLockManager.class.getName()); setContextParmetersInParameterService(contextParameters); final ConfigrationProvider configrationProvider = getConfigrationProvider("InfinispanMultiHazelcastlock", @@ -393,12 +393,12 @@ public class TestConcurrentContext { startZookeeperServer(); final InfinispanDistributorParameters infinispanParameters = new InfinispanDistributorParameters(); - infinispanParameters.setPluginClass(InfinispanContextDistributor.class.getCanonicalName()); + infinispanParameters.setPluginClass(InfinispanContextDistributor.class.getName()); infinispanParameters.setConfigFile("infinispan/infinispan-context-test.xml"); contextParameters.setDistributorParameters(infinispanParameters); final CuratorLockManagerParameters curatorParameters = new CuratorLockManagerParameters(); - curatorParameters.setPluginClass(CuratorLockManager.class.getCanonicalName()); + curatorParameters.setPluginClass(CuratorLockManager.class.getName()); curatorParameters.setZookeeperAddress(ZOOKEEPER_ADDRESS + ":" + zookeeperPort); contextParameters.setLockManagerParameters(curatorParameters); setContextParmetersInParameterService(contextParameters); @@ -435,10 +435,10 @@ public class TestConcurrentContext { startZookeeperServer(); contextParameters.getDistributorParameters() - .setPluginClass(HazelcastContextDistributor.class.getCanonicalName()); + .setPluginClass(HazelcastContextDistributor.class.getName()); final CuratorLockManagerParameters curatorParameters = new CuratorLockManagerParameters(); - curatorParameters.setPluginClass(CuratorLockManager.class.getCanonicalName()); + curatorParameters.setPluginClass(CuratorLockManager.class.getName()); curatorParameters.setZookeeperAddress(ZOOKEEPER_ADDRESS + ":" + zookeeperPort); contextParameters.setLockManagerParameters(curatorParameters); setContextParmetersInParameterService(contextParameters); diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java index 502ccc17c..a29dcbcf8 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/ContextInstantiation.java @@ -451,7 +451,7 @@ public class ContextInstantiation { fail(EXCEPTION_MESSAGE); } catch (final ContextRuntimeException e) { assertEquals(getMessage(TEST_POLICY_CONTEXT_ITEM000, "TestContextItem006", - TestContextStringItem.class.getCanonicalName(), "stringValue=" + STRING_VAL), + TestContextStringItem.class.getName(), "stringValue=" + STRING_VAL), e.getMessage()); LOGGER.trace(NORMAL_TEST_EXCEPTION, e); } @@ -461,7 +461,7 @@ public class ContextInstantiation { fail(EXCEPTION_MESSAGE); } catch (final ContextRuntimeException e) { assertEquals(getMessage(TEST_POLICY_CONTEXT_ITEM001, "TestContextItem003", - TestContextLongItem.class.getCanonicalName(), "longValue=" + INT_VAL_3), e.getMessage()); + TestContextLongItem.class.getName(), "longValue=" + INT_VAL_3), e.getMessage()); LOGGER.trace(NORMAL_TEST_EXCEPTION, e); } } @@ -527,7 +527,7 @@ public class ContextInstantiation { } private String getMessage(final String key, final String objName, final String clazzName, final String valString) { - return getMessage(key, objName, clazzName, valString, TestPolicyContextItem.class.getCanonicalName()); + return getMessage(key, objName, clazzName, valString, TestPolicyContextItem.class.getName()); } private String getMessage(final String key, final String objName, final String clazzName, final String valString, diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/HazelcastContextDistributorTest.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/HazelcastContextDistributorTest.java index 9e6002565..90d2f19a9 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/HazelcastContextDistributorTest.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/HazelcastContextDistributorTest.java @@ -40,7 +40,7 @@ import org.slf4j.ext.XLoggerFactory; * The Class HazelcastContextDistributorTest. */ public class HazelcastContextDistributorTest { - private static final String HAZEL_CAST_PLUGIN_CLASS = HazelcastContextDistributor.class.getCanonicalName(); + private static final String HAZEL_CAST_PLUGIN_CLASS = HazelcastContextDistributor.class.getName(); // Logger for this class private static final XLogger logger = XLoggerFactory.getXLogger(HazelcastContextDistributorTest.class); diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/InfinispanContextDistributorTest.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/InfinispanContextDistributorTest.java index b8cc597ef..db131bf0d 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/InfinispanContextDistributorTest.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/InfinispanContextDistributorTest.java @@ -43,7 +43,7 @@ import org.slf4j.ext.XLoggerFactory; public class InfinispanContextDistributorTest { private static final XLogger logger = XLoggerFactory.getXLogger(InfinispanContextDistributorTest.class); - private static final String PLUGIN_CLASS = InfinispanContextDistributor.class.getCanonicalName(); + private static final String PLUGIN_CLASS = InfinispanContextDistributor.class.getName(); private SchemaParameters schemaParameters; private ContextParameters contextParameters; diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/SequentialContextInstantiation.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/SequentialContextInstantiation.java index 12f7f373f..93c0179f8 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/SequentialContextInstantiation.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/distribution/SequentialContextInstantiation.java @@ -119,8 +119,8 @@ public class SequentialContextInstantiation { try { dateAlbum.put("tci9", tci9); } catch (final Exception e) { - final String message = "class \"" + TestContextDateTzItem.class.getCanonicalName() - + "\" not compatible with class \"" + TestContextDateLocaleItem.class.getCanonicalName() + final String message = "class \"" + TestContextDateTzItem.class.getName() + + "\" not compatible with class \"" + TestContextDateLocaleItem.class.getName() + "\""; assertTrue(e.getMessage().contains(message)); LOGGER.trace(NORMAL_TEST_EXCEPTION, e); @@ -151,7 +151,7 @@ public class SequentialContextInstantiation { fail(EXCEPTION_MESSAGE); } catch (final Exception e) { assertTrue(e.getMessage().endsWith("not compatible with class \"" - + TestContextDateLocaleItem.class.getCanonicalName() + "\"")); + + TestContextDateLocaleItem.class.getName() + "\"")); LOGGER.trace(NORMAL_TEST_EXCEPTION, e); } assertEquals(5, dateAlbum1.size()); diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/factory/TestContextAlbumFactory.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/factory/TestContextAlbumFactory.java index f8c1f597c..45ea0fdc4 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/factory/TestContextAlbumFactory.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/factory/TestContextAlbumFactory.java @@ -54,7 +54,7 @@ public final class TestContextAlbumFactory { private static final String SCHEMAS2 = "Schemas"; private static final String KEY_INFO_MAP_KEY = "KeyInfoMapKey"; private static final String APPLICATION = "APPLICATION"; - private static final String JAVA_LONG = Long.class.getCanonicalName(); + private static final String JAVA_LONG = Long.class.getName(); private static final String JAVA_FLAVOUR = "Java"; /** @@ -69,7 +69,7 @@ public final class TestContextAlbumFactory { */ public static AxContextModel createPolicyContextModel() { final AxContextSchema policySchema = new AxContextSchema(new AxArtifactKey("PolicySchema", VERSION), - JAVA_FLAVOUR, TestPolicyContextItem.class.getCanonicalName()); + JAVA_FLAVOUR, TestPolicyContextItem.class.getName()); final AxContextAlbum albumDefinition = new AxContextAlbum(new AxArtifactKey(POLICY_CONTEXT_ALBUM, VERSION), APPLICATION, true, policySchema.getKey()); @@ -94,7 +94,7 @@ public final class TestContextAlbumFactory { */ public static AxContextModel createGlobalContextModel() { final AxContextSchema globalSchema = new AxContextSchema(new AxArtifactKey("GlobalSchema", VERSION), - JAVA_FLAVOUR, TestGlobalContextItem.class.getCanonicalName()); + JAVA_FLAVOUR, TestGlobalContextItem.class.getName()); final AxContextAlbum albumDefinition = new AxContextAlbum(new AxArtifactKey(GLOBAL_CONTEXT_ALBUM, VERSION), "GLOBAL", true, globalSchema.getKey()); @@ -119,7 +119,7 @@ public final class TestContextAlbumFactory { */ public static AxContextModel createExternalContextModel() { final AxContextSchema externalSchema = new AxContextSchema(new AxArtifactKey("ExternalSchema", VERSION), - JAVA_FLAVOUR, TestExternalContextItem.class.getCanonicalName()); + JAVA_FLAVOUR, TestExternalContextItem.class.getName()); final AxContextAlbum albumDefinition = new AxContextAlbum(new AxArtifactKey(EXTERNAL_CONTEXT_ALBUM, VERSION), "EXTERNAL", true, externalSchema.getKey()); @@ -178,11 +178,11 @@ public final class TestContextAlbumFactory { final AxContextSchema longSchema = new AxContextSchema(new AxArtifactKey("LongSchema", VERSION), JAVA_FLAVOUR, JAVA_LONG); final AxContextSchema lTypeSchema = new AxContextSchema(new AxArtifactKey("LTypeSchema", VERSION), JAVA_FLAVOUR, - TestContextLongItem.class.getCanonicalName()); + TestContextLongItem.class.getName()); final AxContextSchema dateSchema = new AxContextSchema(new AxArtifactKey("DateSchema", VERSION), JAVA_FLAVOUR, - TestContextDateLocaleItem.class.getCanonicalName()); + TestContextDateLocaleItem.class.getName()); final AxContextSchema mapSchema = new AxContextSchema(new AxArtifactKey("MapSchema", VERSION), JAVA_FLAVOUR, - TestContextTreeMapItem.class.getCanonicalName()); + TestContextTreeMapItem.class.getName()); final AxContextSchemas schemas = new AxContextSchemas(new AxArtifactKey(SCHEMAS2, VERSION)); schemas.getSchemasMap().put(longSchema.getKey(), longSchema); diff --git a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/locking/ConcurrentContextJvmThread.java b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/locking/ConcurrentContextJvmThread.java index 3e8105c86..4915e7b89 100644 --- a/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/locking/ConcurrentContextJvmThread.java +++ b/testsuites/integration/integration-context-test/src/test/java/org/onap/policy/apex/testsuites/integration/context/locking/ConcurrentContextJvmThread.java @@ -71,7 +71,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.getName()); commandList.add(configrationProvider.getTestName()); commandList.add(Integer.toString(jvm)); commandList.add(Integer.toString(configrationProvider.getThreadCount())); @@ -81,7 +81,7 @@ public class ConcurrentContextJvmThread implements Runnable, Closeable { commandList.add(System.getProperty("hazelcast.config", "")); for (final Entry<String, ParameterGroup> parameterServiceEntry : ParameterService.getAll()) { - commandList.add(parameterServiceEntry.getValue().getClass().getCanonicalName()); + commandList.add(parameterServiceEntry.getValue().getClass().getName()); commandList.add(new Gson().toJson(parameterServiceEntry.getValue())); } diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyDbWrite.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyDbWrite.java index 426db8328..00dce6e66 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyDbWrite.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyDbWrite.java @@ -55,7 +55,7 @@ public class TestApexSamplePolicyDbWrite { @Test public void testModelWriteReadJpa() throws Exception { final DaoParameters DaoParameters = new DaoParameters(); - DaoParameters.setPluginClass(DefaultApexDao.class.getCanonicalName()); + DaoParameters.setPluginClass(DefaultApexDao.class.getName()); DaoParameters.setPersistenceUnit("SampleModelTest"); Connection connection = DriverManager.getConnection("jdbc:h2:mem:testdb"); diff --git a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java index a5800956d..a2fa423bf 100644 --- a/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java +++ b/testsuites/integration/integration-executor-test/src/test/java/org/onap/policy/apex/testsuites/integration/executor/handling/TestApexSamplePolicyModel.java @@ -90,7 +90,7 @@ public class TestApexSamplePolicyModel { @Test public void testModelWriteReadJpa() throws Exception { final DaoParameters DaoParameters = new DaoParameters(); - DaoParameters.setPluginClass(DefaultApexDao.class.getCanonicalName()); + DaoParameters.setPluginClass(DefaultApexDao.class.getName()); DaoParameters.setPersistenceUnit("SampleModelTest"); Connection connection = DriverManager.getConnection("jdbc:h2:mem:testdb"); diff --git a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorParametersHandlerTest.java b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorParametersHandlerTest.java index dd8766dc3..2e70b7b3f 100644 --- a/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorParametersHandlerTest.java +++ b/testsuites/performance/performance-benchmark-test/src/test/java/org/onap/policy/apex/testsuites/performance/benchmark/eventgenerator/EventGeneratorParametersHandlerTest.java @@ -23,6 +23,7 @@ package org.onap.policy.apex.testsuites.performance.benchmark.eventgenerator; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import org.apache.commons.cli.ParseException; @@ -257,9 +258,7 @@ public class EventGeneratorParametersHandlerTest { handler.parse(args); fail("test should throw an exception"); } catch (ParseException pe) { - assertEquals("Could not read parameters from configuration file " - + "\"src/test/resources/parameters/unit/NonExistant.json\": " - + "src/test/resources/parameters/unit/NonExistant.json", pe.getMessage()); + assertTrue(pe.getMessage().startsWith("Could not read parameters from configuration file ")); } try { |