summaryrefslogtreecommitdiffstats
path: root/policy-management/src/test/java/org/onap
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-06-17 10:42:41 -0400
committerJim Hahn <jrh3@att.com>2019-06-17 10:42:41 -0400
commite7364a7f58ec5c42901e5de445a295d6f782f38b (patch)
tree8fc8272cdb46616661f5360946952c17c34f9cef /policy-management/src/test/java/org/onap
parent0d7a5339ba139cdc8a480873240aae4a67abbc37 (diff)
Change getCanonicalName() to getName() in drools-pdp
Per javadocs, getName() should generally be used instead of Class.getCanonicalName(). This change only applies to classes; it does not apply to File objects. Change-Id: I28df56b3dfd0382239960d7f0f6e1131d702b2ab Issue-ID: POLICY-1646 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'policy-management/src/test/java/org/onap')
-rw-r--r--policy-management/src/test/java/org/onap/policy/drools/controller/internal/NullDroolsControllerTest.java4
-rw-r--r--policy-management/src/test/java/org/onap/policy/drools/protocol/coders/EventProtocolCoderTest.java2
-rw-r--r--policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java26
-rw-r--r--policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineTest.java2
4 files changed, 17 insertions, 17 deletions
diff --git a/policy-management/src/test/java/org/onap/policy/drools/controller/internal/NullDroolsControllerTest.java b/policy-management/src/test/java/org/onap/policy/drools/controller/internal/NullDroolsControllerTest.java
index 77da1c1f..4b0c438f 100644
--- a/policy-management/src/test/java/org/onap/policy/drools/controller/internal/NullDroolsControllerTest.java
+++ b/policy-management/src/test/java/org/onap/policy/drools/controller/internal/NullDroolsControllerTest.java
@@ -116,7 +116,7 @@ public class NullDroolsControllerTest {
@Test(expected = IllegalArgumentException.class)
public void fetchModelClass() {
- new NullDroolsController().fetchModelClass(this.getClass().getCanonicalName());
+ new NullDroolsController().fetchModelClass(this.getClass().getName());
}
@Test
@@ -153,4 +153,4 @@ public class NullDroolsControllerTest {
public void factQuery() {
Assert.assertTrue(new NullDroolsController().factQuery(null, null, null, false).isEmpty());
}
-} \ No newline at end of file
+}
diff --git a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/EventProtocolCoderTest.java b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/EventProtocolCoderTest.java
index 682d2805..40646b11 100644
--- a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/EventProtocolCoderTest.java
+++ b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/EventProtocolCoderTest.java
@@ -86,7 +86,7 @@ public class EventProtocolCoderTest {
EventProtocolCoder.manager.addEncoder(
EventProtocolParams.builder().groupId(ENCODER_GROUP).artifactId(ENCODER_ARTIFACT)
- .topic(NOOP_TOPIC).eventClass(DroolsConfiguration.class.getCanonicalName())
+ .topic(NOOP_TOPIC).eventClass(DroolsConfiguration.class.getName())
.protocolFilter(new JsonProtocolFilter()).customGsonCoder(null)
.modelClassLoaderHash(DroolsConfiguration.class.getName().hashCode()));
diff --git a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java
index b7d72f31..c6209a52 100644
--- a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java
+++ b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java
@@ -102,7 +102,7 @@ public class ProtocolCoderToolsetTest {
EventProtocolParams.builder().topic(JUNIT_PROTOCOL_CODER_TOPIC)
.groupId(this.releaseId.getGroupId())
.artifactId(this.releaseId.getArtifactId())
- .eventClass(Triple.class.getCanonicalName())
+ .eventClass(Triple.class.getName())
.protocolFilter(protocolFilter)
.customGsonCoder(null)
.modelClassLoaderHash(12345678), CONTROLLER_ID);
@@ -113,7 +113,7 @@ public class ProtocolCoderToolsetTest {
testToolset(protocolFilter, gsonToolset);
Triple<String, String, String> triple = createTriple();
- gsonToolset.setCustomCoder(new CustomGsonCoder(this.getClass().getCanonicalName(), "customCoder"));
+ gsonToolset.setCustomCoder(new CustomGsonCoder(this.getClass().getName(), "customCoder"));
String tripleEncoded = encode(gsonToolset, triple);
decode(protocolFilter, gsonToolset, triple, tripleEncoded);
}
@@ -131,7 +131,7 @@ public class ProtocolCoderToolsetTest {
addRemoveCoder(coderToolset);
/* restore original filters */
- coderToolset.addCoder(Triple.class.getCanonicalName(), protocolFilter, 654321);
+ coderToolset.addCoder(Triple.class.getName(), protocolFilter, 654321);
Triple<String, String, String> triple = createTriple();
@@ -152,8 +152,8 @@ public class ProtocolCoderToolsetTest {
logger.trace("Junit expected exception - decode does not pass filtering", e);
}
- CoderFilters coderFilters = coderToolset.getCoder(Triple.class.getCanonicalName());
- Assert.assertTrue(coderFilters.getCodedClass() == Triple.class.getCanonicalName());
+ CoderFilters coderFilters = coderToolset.getCoder(Triple.class.getName());
+ Assert.assertTrue(coderFilters.getCodedClass() == Triple.class.getName());
Assert.assertTrue(coderFilters.getFilter() == protocolFilter);
Assert.assertTrue(coderFilters.getFilter().getRule() != null);
@@ -184,26 +184,26 @@ public class ProtocolCoderToolsetTest {
}
private void addRemoveCoder(ProtocolCoderToolset coderToolset) {
- coderToolset.addCoder(this.getClass().getCanonicalName(),
+ coderToolset.addCoder(this.getClass().getName(),
new JsonProtocolFilter("[?($.second =~ /.*/)]"), 654321);
Assert.assertTrue(coderToolset.getCoders().size() == 2);
- coderToolset.removeCoders(this.getClass().getCanonicalName());
+ coderToolset.removeCoders(this.getClass().getName());
Assert.assertTrue(coderToolset.getCoders().size() == 1);
}
private void updateCoderFilterRule(ProtocolCoderToolset coderToolset) {
- coderToolset.addCoder(Triple.class.getCanonicalName(), new JsonProtocolFilter("[?($.third =~ /.*/)]"), 654321);
+ coderToolset.addCoder(Triple.class.getName(), new JsonProtocolFilter("[?($.third =~ /.*/)]"), 654321);
Assert.assertTrue(coderToolset.getCoders().size() == 1);
- Assert.assertTrue(coderToolset.getCoder(Triple.class.getCanonicalName()).getModelClassLoaderHash() == 654321);
+ Assert.assertTrue(coderToolset.getCoder(Triple.class.getName()).getModelClassLoaderHash() == 654321);
Assert.assertTrue(
coderToolset.getCoder(
- Triple.class.getCanonicalName()).getFilter().getRule() != null);
+ Triple.class.getName()).getFilter().getRule() != null);
- Assert.assertTrue("[?($.third =~ /.*/)]".equals(coderToolset.getCoder(Triple.class.getCanonicalName())
+ Assert.assertTrue("[?($.third =~ /.*/)]".equals(coderToolset.getCoder(Triple.class.getName())
.getFilter().getRule()));
}
@@ -218,7 +218,7 @@ public class ProtocolCoderToolsetTest {
CoderFilters coderFilters = coderToolset.getCoder(CONTROLLER_ID);
Assert.assertTrue(coderFilters == null);
- coderFilters = coderToolset.getCoder(Triple.class.getCanonicalName());
+ coderFilters = coderToolset.getCoder(Triple.class.getName());
Assert.assertNotNull(coderFilters);
Assert.assertEquals(coderFilters.getFilter(), protocolFilter);
@@ -238,7 +238,7 @@ public class ProtocolCoderToolsetTest {
droolsControllerConfig.put(DroolsProperties.RULES_ARTIFACTID, releaseId.getArtifactId());
droolsControllerConfig.put(DroolsProperties.RULES_VERSION, releaseId.getVersion());
droolsControllerConfig.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS + "." + JUNIT_PROTOCOL_CODER_TOPIC
- + PolicyEndPointProperties.PROPERTY_TOPIC_EVENTS_SUFFIX, Triple.class.getCanonicalName());
+ + PolicyEndPointProperties.PROPERTY_TOPIC_EVENTS_SUFFIX, Triple.class.getName());
DroolsController.factory.build(droolsControllerConfig, null, noopTopics);
}
diff --git a/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineTest.java b/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineTest.java
index 64af6d4f..a586e774 100644
--- a/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineTest.java
+++ b/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineTest.java
@@ -213,7 +213,7 @@ public class PolicyEngineTest {
EventProtocolCoder.manager.addEncoder(
EventProtocolParams.builder().groupId(ENCODER_GROUP).artifactId(ENCODER_ARTIFACT)
- .topic(NOOP_TOPIC).eventClass(DroolsConfiguration.class.getCanonicalName())
+ .topic(NOOP_TOPIC).eventClass(DroolsConfiguration.class.getName())
.protocolFilter(new JsonProtocolFilter()).customGsonCoder(null)
.modelClassLoaderHash(DroolsConfiguration.class.getName().hashCode()));