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 /services/services-engine/src | |
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 'services/services-engine/src')
12 files changed, 36 insertions, 37 deletions
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/apexprotocolplugin/ApexEventProtocolParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/apexprotocolplugin/ApexEventProtocolParameters.java index b9e1648f1..8df3a6553 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/apexprotocolplugin/ApexEventProtocolParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/apexprotocolplugin/ApexEventProtocolParameters.java @@ -51,6 +51,6 @@ public class ApexEventProtocolParameters extends EventProtocolParameters { this.setLabel(eventProtocolLabel); // Set the event protocol plugin class - this.setEventProtocolPluginClass(Apex2ApexEventConverter.class.getCanonicalName()); + this.setEventProtocolPluginClass(Apex2ApexEventConverter.class.getName()); } } diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorCarrierTechnologyParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorCarrierTechnologyParameters.java index 839b4bffe..0d2be38f8 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorCarrierTechnologyParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/eventrequestor/EventRequestorCarrierTechnologyParameters.java @@ -36,11 +36,11 @@ public class EventRequestorCarrierTechnologyParameters extends CarrierTechnology /** The producer plugin class for the EVENT_REQUESTOR carrier technology. */ public static final String EVENT_REQUESTOR_EVENT_PRODUCER_PLUGIN_CLASS = - EventRequestorProducer.class.getCanonicalName(); + EventRequestorProducer.class.getName(); /** The consumer plugin class for the EVENT_REQUESTOR carrier technology. */ public static final String EVENT_REQUESTOR_EVENT_CONSUMER_PLUGIN_CLASS = - EventRequestorConsumer.class.getCanonicalName(); + EventRequestorConsumer.class.getName(); // @formatter:on /** diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/FileCarrierTechnologyParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/FileCarrierTechnologyParameters.java index 73438cc7e..31cd28d8d 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/FileCarrierTechnologyParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/filecarrierplugin/FileCarrierTechnologyParameters.java @@ -49,10 +49,10 @@ public class FileCarrierTechnologyParameters extends CarrierTechnologyParameters public static final String FILE_CARRIER_TECHNOLOGY_LABEL = "FILE"; /** The producer plugin class for the FILE carrier technology. */ - public static final String FILE_EVENT_PRODUCER_PLUGIN_CLASS = ApexFileEventProducer.class.getCanonicalName(); + public static final String FILE_EVENT_PRODUCER_PLUGIN_CLASS = ApexFileEventProducer.class.getName(); /** The consumer plugin class for the FILE carrier technology. */ - public static final String FILE_EVENT_CONSUMER_PLUGIN_CLASS = ApexFileEventConsumer.class.getCanonicalName(); + public static final String FILE_EVENT_CONSUMER_PLUGIN_CLASS = ApexFileEventConsumer.class.getName(); // Recurring strings private static final String FILE_NAME_TOKEN = "fileName"; diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/JsonEventProtocolParameters.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/JsonEventProtocolParameters.java index 5ff795d76..d8cd12829 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/JsonEventProtocolParameters.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/event/impl/jsonprotocolplugin/JsonEventProtocolParameters.java @@ -89,12 +89,12 @@ public class JsonEventProtocolParameters extends EventProtocolTextCharDelimitedP this.setEndChar(JSON_TEXT_BLOCK_END_DELIMITER); // Set the event protocol plugin class - this.setEventProtocolPluginClass(Apex2JsonEventConverter.class.getCanonicalName()); + this.setEventProtocolPluginClass(Apex2JsonEventConverter.class.getName()); } /* * (non-Javadoc) - * + * * @see org.onap.policy.common.parameters.ParameterGroup#getName() */ @Override diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexCommandLineArguments.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexCommandLineArguments.java index 733327580..e05e02c14 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexCommandLineArguments.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexCommandLineArguments.java @@ -151,7 +151,7 @@ public class ApexCommandLineArguments { } if (commandLine.hasOption('h')) { - return help(ApexMain.class.getCanonicalName()); + return help(ApexMain.class.getName()); } if (commandLine.hasOption('v')) { diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParametersJsonAdapter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParametersJsonAdapter.java index 5e320b1bb..6398008c6 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParametersJsonAdapter.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/carriertechnology/CarrierTechnologyParametersJsonAdapter.java @@ -60,12 +60,12 @@ public class CarrierTechnologyParametersJsonAdapter // Built in technology parameters private static final Map<String, String> BUILT_IN_CARRIER_TECHNOLOGY_PARMETER_CLASS_MAP = new HashMap<>(); - + static { BUILT_IN_CARRIER_TECHNOLOGY_PARMETER_CLASS_MAP.put("FILE", - FileCarrierTechnologyParameters.class.getCanonicalName()); + FileCarrierTechnologyParameters.class.getName()); BUILT_IN_CARRIER_TECHNOLOGY_PARMETER_CLASS_MAP.put("EVENT_REQUESTOR", - EventRequestorCarrierTechnologyParameters.class.getCanonicalName()); + EventRequestorCarrierTechnologyParameters.class.getName()); } /* diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParametersJsonAdapter.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParametersJsonAdapter.java index ba37fe80c..b03c365f1 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParametersJsonAdapter.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/parameters/eventprotocol/EventProtocolParametersJsonAdapter.java @@ -59,10 +59,10 @@ public class EventProtocolParametersJsonAdapter // Built in event protocol parameters private static final Map<String, String> BUILT_IN_EVENT_PROTOCOL_PARMETER_CLASS_MAP = new HashMap<>(); - + static { - BUILT_IN_EVENT_PROTOCOL_PARMETER_CLASS_MAP.put("JSON", JsonEventProtocolParameters.class.getCanonicalName()); - BUILT_IN_EVENT_PROTOCOL_PARMETER_CLASS_MAP.put("APEX", ApexEventProtocolParameters.class.getCanonicalName()); + BUILT_IN_EVENT_PROTOCOL_PARMETER_CLASS_MAP.put("JSON", JsonEventProtocolParameters.class.getName()); + BUILT_IN_EVENT_PROTOCOL_PARMETER_CLASS_MAP.put("APEX", ApexEventProtocolParameters.class.getName()); } /* 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()); |