From 5be846bcdbe6e9dfa3b81e4b95de37acea18d1a2 Mon Sep 17 00:00:00 2001 From: "a.sreekumar" Date: Fri, 21 Jun 2019 11:21:14 +0000 Subject: Replace uses of getCanonicalName() with getName() in APEX Change-Id: Ifcd8866e65a7bc1238d5a4137f7bad288a5bfb3b Issue-ID: POLICY-1861 Signed-off-by: a.sreekumar --- .../engine/parameters/ContextParameterTests.java | 24 +++++++++++----------- .../engine/parameters/ExecutorParameterTests.java | 2 +- .../service/engine/parameters/ParameterTests.java | 12 +++++------ ...SuperTokenDelimitedEventProtocolParameters.java | 2 +- .../engine/runtime/impl/EngineServiceImplTest.java | 5 ++--- 5 files changed, 22 insertions(+), 23 deletions(-) (limited to 'services/services-engine/src/test') diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java index 56e716dd6..ab05dc7f0 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ContextParameterTests.java @@ -136,7 +136,7 @@ public class ContextParameterTests { final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); assertEquals("org.onap.policy.apex.context.parameters.ContextParameters", parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getClass().getCanonicalName()); + .getClass().getName()); assertEquals(123456, parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() .getPersistorParameters().getFlushPeriod()); } catch (final ParameterException e) { @@ -154,7 +154,7 @@ public class ContextParameterTests { final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); assertEquals("org.onap.policy.apex.context.parameters.ContextParameters", parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getClass().getCanonicalName()); + .getClass().getName()); assertEquals(300000, parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() .getPersistorParameters().getFlushPeriod()); } catch (final ParameterException e) { @@ -172,10 +172,10 @@ public class ContextParameterTests { final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); assertEquals("org.onap.policy.apex.context.parameters.ContextParameters", parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getClass().getCanonicalName()); + .getClass().getName()); assertEquals("org.onap.policy.apex.context.parameters.DistributorParameters", parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getDistributorParameters().getClass().getCanonicalName()); + .getDistributorParameters().getClass().getName()); } catch (final ParameterException e) { fail("This test should not throw any exception: " + e.getMessage()); } @@ -191,16 +191,16 @@ public class ContextParameterTests { final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); assertEquals("org.onap.policy.apex.context.parameters.ContextParameters", parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getClass().getCanonicalName()); + .getClass().getName()); assertEquals("org.onap.policy.apex.context.parameters.DistributorParameters", parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getDistributorParameters().getClass().getCanonicalName()); + .getDistributorParameters().getClass().getName()); assertEquals("org.onap.policy.apex.context.parameters.LockManagerParameters", parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getLockManagerParameters().getClass().getCanonicalName()); + .getLockManagerParameters().getClass().getName()); assertEquals("org.onap.policy.apex.context.parameters.PersistorParameters", parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getPersistorParameters().getClass().getCanonicalName()); + .getPersistorParameters().getClass().getName()); assertEquals(300000, parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() .getPersistorParameters().getFlushPeriod()); } catch (final ParameterException e) { @@ -218,13 +218,13 @@ public class ContextParameterTests { final ApexParameters parameters = new ApexParameterHandler().getParameters(arguments); assertEquals("org.onap.policy.apex.context.parameters.ContextParameters", parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getClass().getCanonicalName()); + .getClass().getName()); assertEquals("org.onap.policy.apex.context.parameters.LockManagerParameters", parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getLockManagerParameters().getClass().getCanonicalName()); + .getLockManagerParameters().getClass().getName()); assertEquals("org.onap.policy.apex.context.parameters.PersistorParameters", parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() - .getPersistorParameters().getClass().getCanonicalName()); + .getPersistorParameters().getClass().getName()); assertEquals(123456, parameters.getEngineServiceParameters().getEngineParameters().getContextParameters() .getPersistorParameters().getFlushPeriod()); @@ -232,7 +232,7 @@ public class ContextParameterTests { .getEngineServiceParameters().getEngineParameters().getContextParameters() .getDistributorParameters(); assertEquals("org.onap.policy.apex.service.engine.parameters.dummyclasses.SuperDooperDistributorParameters", - infinispanParameters.getClass().getCanonicalName()); + infinispanParameters.getClass().getName()); assertEquals("my/lovely/configFile.xml", infinispanParameters.getConfigFile()); assertEquals("holy/stone.xml", infinispanParameters.getJgroupsFile()); assertEquals(false, infinispanParameters.isPreferIPv4Stack()); diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ExecutorParameterTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ExecutorParameterTests.java index e77767d44..4ba63a3cd 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ExecutorParameterTests.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ExecutorParameterTests.java @@ -211,7 +211,7 @@ public class ExecutorParameterTests { assertEquals(19, parameters.getEngineServiceParameters().getInstanceCount()); assertEquals(65522, parameters.getEngineServiceParameters().getDeploymentPort()); assertTrue(parameters.getEngineServiceParameters().getPolicyModelFileName() - .endsWith("/src/test/resources/policymodels/SmallModel.json")); + .endsWith("policymodels/SmallModel.json")); } catch (final ParameterException e) { fail("This test should not throw any exception: " + e.getMessage()); } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java index 10b9ab31d..5dd00117c 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/ParameterTests.java @@ -206,9 +206,9 @@ public class ParameterTests { .getCarrierTechnologyParameters().getLabel()); assertEquals("FILE", parameters.getEventOutputParameters().get("MyOtherProducer") .getCarrierTechnologyParameters().getLabel()); - assertEquals(ApexFileEventProducer.class.getCanonicalName(), parameters.getEventOutputParameters() + assertEquals(ApexFileEventProducer.class.getName(), parameters.getEventOutputParameters() .get("MyOtherProducer").getCarrierTechnologyParameters().getEventProducerPluginClass()); - assertEquals(ApexFileEventConsumer.class.getCanonicalName(), parameters.getEventOutputParameters() + assertEquals(ApexFileEventConsumer.class.getName(), parameters.getEventOutputParameters() .get("MyOtherProducer").getCarrierTechnologyParameters().getEventConsumerPluginClass()); assertEquals("JSON", parameters.getEventOutputParameters().get("FirstProducer").getEventProtocolParameters().getLabel()); @@ -225,13 +225,13 @@ public class ParameterTests { .getEventProtocolParameters().getLabel()); assertEquals("SUPER_TOK_DEL", parameters.getEventInputParameters().get("MySuperDooperConsumer1") .getEventProtocolParameters().getLabel()); - assertEquals(ApexFileEventProducer.class.getCanonicalName(), parameters.getEventInputParameters() + assertEquals(ApexFileEventProducer.class.getName(), parameters.getEventInputParameters() .get("TheFileConsumer1").getCarrierTechnologyParameters().getEventProducerPluginClass()); - assertEquals(ApexFileEventConsumer.class.getCanonicalName(), parameters.getEventInputParameters() + assertEquals(ApexFileEventConsumer.class.getName(), parameters.getEventInputParameters() .get("TheFileConsumer1").getCarrierTechnologyParameters().getEventConsumerPluginClass()); - assertEquals(SuperDooperEventProducer.class.getCanonicalName(), parameters.getEventInputParameters() + assertEquals(SuperDooperEventProducer.class.getName(), parameters.getEventInputParameters() .get("MySuperDooperConsumer1").getCarrierTechnologyParameters().getEventProducerPluginClass()); - assertEquals(SuperDooperEventSubscriber.class.getCanonicalName(), parameters.getEventInputParameters() + assertEquals(SuperDooperEventSubscriber.class.getName(), parameters.getEventInputParameters() .get("MySuperDooperConsumer1").getCarrierTechnologyParameters().getEventConsumerPluginClass()); } catch (final ParameterException e) { fail("This test should not throw an exception"); diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperTokenDelimitedEventProtocolParameters.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperTokenDelimitedEventProtocolParameters.java index 8af9d57d9..9197dfebf 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperTokenDelimitedEventProtocolParameters.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/parameters/dummyclasses/SuperTokenDelimitedEventProtocolParameters.java @@ -46,6 +46,6 @@ public class SuperTokenDelimitedEventProtocolParameters extends EventProtocolTex this.setStartDelimiterToken(SUPER_TOKEN_DELIMITER); // Set the event protocol plugin class - this.setEventProtocolPluginClass(SuperTokenDelimitedEventConverter.class.getCanonicalName()); + this.setEventProtocolPluginClass(SuperTokenDelimitedEventConverter.class.getName()); } } diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImplTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImplTest.java index fcb207c62..27c4a7205 100644 --- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImplTest.java +++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/runtime/impl/EngineServiceImplTest.java @@ -220,7 +220,7 @@ public class EngineServiceImplTest { } String status = esImpl.getStatus(esImpl.getEngineKeys().iterator().next()); - assertEquals("{\n \"apexEngineModel\" :", status.substring(0, 24)); + assertTrue(status.contains("\n \"apexEngineModel\" :")); assertFalse(esImpl.isStarted()); assertFalse(esImpl.isStarted(null)); @@ -453,8 +453,7 @@ public class EngineServiceImplTest { assertEquals(AxEngineState.EXECUTING, esImpl.getState()); String status = esImpl.getStatus(esImpl.getEngineKeys().iterator().next()); - assertEquals("{\n \"apexEngineModel\" :", status.substring(0, 24)); - + assertTrue(status.contains("\n \"apexEngineModel\" :")); assertTrue(esImpl.isStarted()); assertTrue(esImpl.isStarted(esImpl.getEngineKeys().iterator().next())); assertFalse(esImpl.isStopped()); -- cgit 1.2.3-korg