diff options
9 files changed, 41 insertions, 40 deletions
diff --git a/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java b/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java index 3dc01299..ad2eb695 100644 --- a/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java +++ b/common-parameters/src/main/java/org/onap/policy/common/parameters/GroupValidationResult.java @@ -339,7 +339,7 @@ public class GroupValidationResult extends CommonGroupValidationResult { if (parameterGroup != null) { result.append(parameterGroup.getName()); result.append("\" type \""); - result.append(parameterGroup.getClass().getCanonicalName()); + result.append(parameterGroup.getClass().getName()); } else { result.append("UNDEFINED"); } diff --git a/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterValidationResult.java b/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterValidationResult.java index 2c367a30..35837376 100644 --- a/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterValidationResult.java +++ b/common-parameters/src/main/java/org/onap/policy/common/parameters/ParameterValidationResult.java @@ -163,7 +163,7 @@ public class ParameterValidationResult implements ValidationResult { validationResultBuilder.append("field \""); validationResultBuilder.append(getName()); validationResultBuilder.append("\" type \""); - validationResultBuilder.append(field.getType().getCanonicalName()); + validationResultBuilder.append(field.getType().getName()); validationResultBuilder.append("\" value \""); validationResultBuilder.append(parameterValue); validationResultBuilder.append("\" "); diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java index 2b41d0fb..51440546 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL00.java @@ -37,7 +37,7 @@ public class TestParametersL00 extends ParameterGroupImpl { private static final String A_CONSTANT = "A Constant"; private int l00IntField = 0; - private String l00StringField = "Legal " + this.getClass().getCanonicalName(); + private String l00StringField = "Legal " + this.getClass().getName(); private TestParametersL10 l00L10Nested = new TestParametersL10("l00L10Nested"); private TestParametersLGeneric l00LGenericNested = new TestParametersLGeneric("l00LGenericNested"); private Map<String, TestParametersLGeneric> l00LGenericNestedMap = new LinkedHashMap<>(); @@ -132,7 +132,7 @@ public class TestParametersL00 extends ParameterGroupImpl { switch (triggerStatus) { case CLEAN: - l00StringField = "Legal " + this.getClass().getCanonicalName(); + l00StringField = "Legal " + this.getClass().getName(); l00IntField = 0; break; case OBSERVATION: diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java index e1642beb..7276b504 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersL10.java @@ -35,7 +35,7 @@ public class TestParametersL10 extends ParameterGroupImpl { private static final String L10_STRING_FIELD = "l10StringField"; private int l10IntField = 0; - private String l10StringField = "Legal " + this.getClass().getCanonicalName(); + private String l10StringField = "Legal " + this.getClass().getName(); private TestParametersLGeneric l10LGenericNested0 = new TestParametersLGeneric("l10LGenericNested0"); private TestParametersLGeneric l10LGenericNested1 = new TestParametersLGeneric("l10LGenericNested1"); private Map<String, TestParametersLGeneric> l10LGenericNestedMap = new LinkedHashMap<>(); @@ -116,7 +116,7 @@ public class TestParametersL10 extends ParameterGroupImpl { switch (triggerStatus) { case CLEAN: - l10StringField = "Legal " + this.getClass().getCanonicalName(); + l10StringField = "Legal " + this.getClass().getName(); l10IntField = 0; break; case OBSERVATION: diff --git a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java index 44ec7139..f9d6cdc4 100644 --- a/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java +++ b/common-parameters/src/test/java/org/onap/policy/common/parameters/testclasses/TestParametersLGeneric.java @@ -34,7 +34,7 @@ public class TestParametersLGeneric extends ParameterGroupImpl { private int lgenericIntField = 0; @NotNull @NotBlank - private String lgenericStringField = "Legal " + this.getClass().getCanonicalName(); + private String lgenericStringField = "Legal " + this.getClass().getName(); /** * Default constructor. @@ -80,7 +80,7 @@ public class TestParametersLGeneric extends ParameterGroupImpl { switch (triggerStatus) { case CLEAN: - lgenericStringField = "Legal " + this.getClass().getCanonicalName(); + lgenericStringField = "Legal " + this.getClass().getName(); lgenericIntField = 0; break; case OBSERVATION: 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()); diff --git a/utils/src/main/java/org/onap/policy/common/utils/validation/Assertions.java b/utils/src/main/java/org/onap/policy/common/utils/validation/Assertions.java index 19a25295..047989e7 100644 --- a/utils/src/main/java/org/onap/policy/common/utils/validation/Assertions.java +++ b/utils/src/main/java/org/onap/policy/common/utils/validation/Assertions.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -167,8 +168,8 @@ public final class Assertions { */ public static <T> void instanceOf(final Object objectInstance, final Class<T> requiredClass) { if (!requiredClass.isAssignableFrom(objectInstance.getClass())) { - throw new IllegalArgumentException(objectInstance.getClass().getCanonicalName() + " is not an instance of " - + requiredClass.getCanonicalName()); + throw new IllegalArgumentException(objectInstance.getClass().getName() + " is not an instance of " + + requiredClass.getName()); } } @@ -183,8 +184,8 @@ public final class Assertions { */ public static <T> void assignableFrom(final Class<?> checkClass, final Class<T> requiredClass) { if (!requiredClass.isAssignableFrom(checkClass)) { - throw new IllegalArgumentException(checkClass.getCanonicalName() + " is not an instance of " - + requiredClass.getCanonicalName()); + throw new IllegalArgumentException(checkClass.getName() + " is not an instance of " + + requiredClass.getName()); } } } |