summaryrefslogtreecommitdiffstats
path: root/policy-endpoints/src
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-06-14 10:58:51 -0400
committerJim Hahn <jrh3@att.com>2019-06-14 10:58:51 -0400
commitaecbc1cba6e862c3d842012ce54d121764f78cb0 (patch)
tree3e96270fcc43b0c2198e8468f8c644204bd42dc8 /policy-endpoints/src
parentfe5d78724f723a451ddc0d7cc41d6fc60092b314 (diff)
Change getCanonicalName() to getName() in common
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: Iea0995d1167f4837607f194d35f0193eeedeacd7 Issue-ID: POLICY-1646 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'policy-endpoints/src')
-rw-r--r--policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java4
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpClientTest.java16
-rw-r--r--policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java36
3 files changed, 28 insertions, 28 deletions
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java
index 58c2ada7..45ccb06a 100644
--- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java
+++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java
@@ -238,13 +238,13 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable
@Override
public void setAafAuthentication(String filterPath) {
- this.addFilterClass(filterPath, CadiFilter.class.getCanonicalName());
+ this.addFilterClass(filterPath, CadiFilter.class.getName());
}
@Override
public boolean isAaf() {
for (FilterHolder filter : context.getServletHandler().getFilters()) {
- if (CadiFilter.class.getCanonicalName().equals(filter.getClassName())) {
+ if (CadiFilter.class.getName().equals(filter.getClassName())) {
return true;
}
}
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpClientTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpClientTest.java
index 4f7a5a9f..d214d23b 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpClientTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpClientTest.java
@@ -118,10 +118,10 @@ public class HttpClientTest {
HttpServletServer.factory.build("echo", true, LOCALHOST, 6667, "/", false, true);
echoServerAuth.setBasicAuthentication("x", "y", null);
echoServerAuth.addServletPackage("/*", HttpClientTest.class.getPackage().getName());
- echoServerAuth.addFilterClass("/*", TestFilter.class.getCanonicalName());
- echoServerAuth.addFilterClass("/*", TestAuthorizationFilter.class.getCanonicalName());
- echoServerAuth.addFilterClass("/*", TestAafAuthFilter.class.getCanonicalName());
- echoServerAuth.addFilterClass("/*", TestAafGranularAuthFilter.class.getCanonicalName());
+ echoServerAuth.addFilterClass("/*", TestFilter.class.getName());
+ echoServerAuth.addFilterClass("/*", TestAuthorizationFilter.class.getName());
+ echoServerAuth.addFilterClass("/*", TestAafAuthFilter.class.getName());
+ echoServerAuth.addFilterClass("/*", TestAafGranularAuthFilter.class.getName());
echoServerAuth.waitedStart(5000);
if (!NetworkUtil.isTcpPortOpen(LOCALHOST, echoServerAuth.getPort(), 5, 10000L)) {
@@ -259,7 +259,7 @@ public class HttpClientTest {
final HttpClient client = HttpClient.factory.build(BusTopicParams.builder().clientName(TEST_HTTP_AUTH_CLIENT)
.useHttps(true).allowSelfSignedCerts(true).hostname(LOCALHOST).port(6667)
.basePath(JUNIT_ECHO).userName("x").password("y").managed(true)
- .serializationProvider(MyJacksonProvider.class.getCanonicalName()).build());
+ .serializationProvider(MyJacksonProvider.class.getName()).build());
Entity<MyEntity> entity = Entity.entity(new MyEntity(MY_VALUE), MediaType.APPLICATION_JSON);
final Response response = client.put(HELLO, entity, Collections.emptyMap());
@@ -278,7 +278,7 @@ public class HttpClientTest {
final HttpClient client = HttpClient.factory.build(BusTopicParams.builder().clientName(TEST_HTTP_AUTH_CLIENT)
.useHttps(true).allowSelfSignedCerts(true).hostname(LOCALHOST).port(6667)
.basePath(JUNIT_ECHO).userName("x").password("y").managed(true)
- .serializationProvider(MyGsonProvider.class.getCanonicalName()).build());
+ .serializationProvider(MyGsonProvider.class.getName()).build());
Entity<MyEntity> entity = Entity.entity(new MyEntity(MY_VALUE), MediaType.APPLICATION_JSON);
final Response response = client.put(HELLO, entity, Collections.emptyMap());
@@ -410,7 +410,7 @@ public class HttpClientTest {
httpProperties.setProperty(
PolicyEndPointProperties.PROPERTY_HTTP_CLIENT_SERVICES + DOT_GSON
+ PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER,
- MyGsonProvider.class.getCanonicalName());
+ MyGsonProvider.class.getName());
httpProperties.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_CLIENT_SERVICES + DOT_JACKSON
+ PolicyEndPointProperties.PROPERTY_HTTP_HOST_SUFFIX, LOCALHOST);
@@ -425,7 +425,7 @@ public class HttpClientTest {
httpProperties.setProperty(
PolicyEndPointProperties.PROPERTY_HTTP_CLIENT_SERVICES + DOT_JACKSON
+ PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER,
- MyJacksonProvider.class.getCanonicalName());
+ MyJacksonProvider.class.getName());
final List<HttpClient> clients = HttpClient.factory.build(httpProperties);
assertEquals(2, clients.size());
diff --git a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java
index 34e35a2e..41ad2122 100644
--- a/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java
+++ b/policy-endpoints/src/test/java/org/onap/policy/common/endpoints/http/server/test/HttpServerTest.java
@@ -95,7 +95,7 @@ public class HttpServerTest {
HttpServletServer server = HttpServletServer.factory.build("echo", LOCALHOST, port, "/", false, true);
server.addServletPackage("/*", this.getClass().getPackage().getName());
- server.addFilterClass("/*", TestFilter.class.getCanonicalName());
+ server.addFilterClass("/*", TestFilter.class.getName());
server.waitedStart(5000);
assertTrue(HttpServletServer.factory.get(port).isAlive());
@@ -115,9 +115,9 @@ public class HttpServerTest {
HttpServletServer server = HttpServletServer.factory.build("echo", LOCALHOST, port, "/", false, true);
- server.setSerializationProvider(MyJacksonProvider.class.getCanonicalName());
+ server.setSerializationProvider(MyJacksonProvider.class.getName());
server.addServletPackage("/*", this.getClass().getPackage().getName());
- server.addFilterClass("/*", TestFilter.class.getCanonicalName());
+ server.addFilterClass("/*", TestFilter.class.getName());
server.waitedStart(5000);
assertTrue(HttpServletServer.factory.get(port).isAlive());
@@ -143,9 +143,9 @@ public class HttpServerTest {
HttpServletServer server = HttpServletServer.factory.build("echo", LOCALHOST, port, "/", false, true);
- server.setSerializationProvider(MyGsonProvider.class.getCanonicalName());
+ server.setSerializationProvider(MyGsonProvider.class.getName());
server.addServletPackage("/*", this.getClass().getPackage().getName());
- server.addFilterClass("/*", TestFilter.class.getCanonicalName());
+ server.addFilterClass("/*", TestFilter.class.getName());
server.waitedStart(5000);
assertTrue(HttpServletServer.factory.get(port).isAlive());
@@ -170,8 +170,8 @@ public class HttpServerTest {
logger.info("-- testDefaultClassServer() --");
HttpServletServer server = HttpServletServer.factory.build("echo", LOCALHOST, port, "/", false, true);
- server.addServletClass("/*", RestEchoService.class.getCanonicalName());
- server.addFilterClass("/*", TestFilter.class.getCanonicalName());
+ server.addServletClass("/*", RestEchoService.class.getName());
+ server.addFilterClass("/*", TestFilter.class.getName());
server.waitedStart(5000);
assertTrue(HttpServletServer.factory.get(port).isAlive());
@@ -190,9 +190,9 @@ public class HttpServerTest {
logger.info("-- testJacksonClassServer() --");
HttpServletServer server = HttpServletServer.factory.build("echo", LOCALHOST, port, "/", false, true);
- server.setSerializationProvider(MyJacksonProvider.class.getCanonicalName());
- server.addServletClass("/*", RestEchoService.class.getCanonicalName());
- server.addFilterClass("/*", TestFilter.class.getCanonicalName());
+ server.setSerializationProvider(MyJacksonProvider.class.getName());
+ server.addServletClass("/*", RestEchoService.class.getName());
+ server.addFilterClass("/*", TestFilter.class.getName());
server.waitedStart(5000);
assertTrue(HttpServletServer.factory.get(port).isAlive());
@@ -217,9 +217,9 @@ public class HttpServerTest {
logger.info("-- testGsonClassServer() --");
HttpServletServer server = HttpServletServer.factory.build("echo", LOCALHOST, port, "/", false, true);
- server.setSerializationProvider(MyGsonProvider.class.getCanonicalName());
- server.addServletClass("/*", RestEchoService.class.getCanonicalName());
- server.addFilterClass("/*", TestFilter.class.getCanonicalName());
+ server.setSerializationProvider(MyGsonProvider.class.getName());
+ server.addServletClass("/*", RestEchoService.class.getName());
+ server.addFilterClass("/*", TestFilter.class.getName());
server.waitedStart(5000);
assertTrue(HttpServletServer.factory.get(port).isAlive());
@@ -243,7 +243,7 @@ public class HttpServerTest {
public void testSerialize() {
HttpServletServer server = HttpServletServer.factory.build("echo", LOCALHOST, port, "/", false, true);
server.addServletPackage("/*", this.getClass().getPackage().getName());
- server.addFilterClass("/*", TestFilter.class.getCanonicalName());
+ server.addFilterClass("/*", TestFilter.class.getName());
// ensure we can serialize the server
new GsonTestUtils().compareGson(server, HttpServerTest.class);
@@ -255,7 +255,7 @@ public class HttpServerTest {
HttpServletServer server = HttpServletServer.factory.build("echo", LOCALHOST, port, "/", false, true);
server.addServletPackage("/*", this.getClass().getPackage().getName());
- server.addFilterClass("/*", TestFilter.class.getCanonicalName());
+ server.addFilterClass("/*", TestFilter.class.getName());
server.waitedStart(5000);
assertTrue(HttpServletServer.factory.get(port).isAlive());
@@ -351,7 +351,7 @@ public class HttpServerTest {
String randomName = UUID.randomUUID().toString();
HttpServletServer server = HttpServletServer.factory.build(randomName, LOCALHOST, port, "/", false, true);
- server.addServletClass("/*", RestEchoService.class.getCanonicalName());
+ server.addServletClass("/*", RestEchoService.class.getName());
server.waitedStart(5000);
assertTrue(HttpServletServer.factory.get(port).isAlive());
@@ -370,8 +370,8 @@ public class HttpServerTest {
String randomName = UUID.randomUUID().toString();
HttpServletServer server = HttpServletServer.factory.build(randomName, LOCALHOST, port, "/", false, true);
- server.addServletClass("/*", RestEchoService.class.getCanonicalName());
- server.addServletClass("/*", RestEndpoints.class.getCanonicalName());
+ server.addServletClass("/*", RestEchoService.class.getName());
+ server.addServletClass("/*", RestEndpoints.class.getName());
server.waitedStart(5000);
assertTrue(HttpServletServer.factory.get(port).isAlive());