summaryrefslogtreecommitdiffstats
path: root/models-provider
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2019-06-18 12:47:14 -0400
committerJim Hahn <jrh3@att.com>2019-06-18 12:49:11 -0400
commit1cdad9b78056103a4ca1d1b71d996489787ed702 (patch)
tree5c57c02f002da053c923333ef7712a08e5534be5 /models-provider
parent26e7f16c6e3f224d38e09441be30c1d4fa795c2a (diff)
Change getCanonicalName to getName in models
Per javadocs, getName() should generally be used instead of Class.getCanonicalName(). This change only applies to classes; it does not apply to File objects. Note: this impacts the output from PfValidationMessage, as it will now list the names of embedded classes with a "$" separator instead of a ".". Change-Id: I2cd64bc0281dd324bf80eac57335a7299a516447 Issue-ID: POLICY-1646 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'models-provider')
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderFactory.java3
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderParameters.java3
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java3
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java4
4 files changed, 8 insertions, 5 deletions
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderFactory.java b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderFactory.java
index 86551b341..4ba70fbe1 100644
--- a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderFactory.java
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderFactory.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* 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.
@@ -59,7 +60,7 @@ public class PolicyModelsProviderFactory {
// It is, now check if it is a PolicyModelsProvider
if (!PolicyModelsProvider.class.isAssignableFrom(implementationClass)) {
- String errorMessage = "the class \"" + implementationClass.getCanonicalName()
+ String errorMessage = "the class \"" + implementationClass.getName()
+ "\" is not an implementation of the \"PolicyModelsProvider\" interface";
LOGGER.warn(errorMessage);
throw new PfModelException(Response.Status.BAD_REQUEST, errorMessage);
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderParameters.java b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderParameters.java
index 65aa72eb2..fa4d66348 100644
--- a/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderParameters.java
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/PolicyModelsProviderParameters.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* 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.
@@ -51,7 +52,7 @@ import org.onap.policy.models.provider.impl.DatabasePolicyModelsProviderImpl;
@Data
public class PolicyModelsProviderParameters implements ParameterGroup {
- private static final String DEFAULT_IMPLEMENTATION = DatabasePolicyModelsProviderImpl.class.getCanonicalName();
+ private static final String DEFAULT_IMPLEMENTATION = DatabasePolicyModelsProviderImpl.class.getName();
private String name;
private String implementation = DEFAULT_IMPLEMENTATION;
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
index af1a6ca3b..565eb9afc 100644
--- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* 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.
@@ -94,7 +95,7 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
// Parameters for the DAO
final DaoParameters daoParameters = new DaoParameters();
- daoParameters.setPluginClass(DefaultPfDao.class.getCanonicalName());
+ daoParameters.setPluginClass(DefaultPfDao.class.getName());
daoParameters.setPersistenceUnit(parameters.getPersistenceUnit());
// Decode the password using Base64
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java
index e05c1067e..e30cea940 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderTest.java
@@ -55,7 +55,7 @@ public class DummyPolicyModelsProviderTest {
@Test
public void testProvider() throws Exception {
PolicyModelsProviderParameters parameters = new PolicyModelsProviderParameters();
- parameters.setImplementation(DummyPolicyModelsProviderImpl.class.getCanonicalName());
+ parameters.setImplementation(DummyPolicyModelsProviderImpl.class.getName());
parameters.setDatabaseUrl("jdbc:dummy");
parameters.setPersistenceUnit("dummy");
@@ -74,7 +74,7 @@ public class DummyPolicyModelsProviderTest {
@Test
public void testProviderMethods() throws Exception {
PolicyModelsProviderParameters parameters = new PolicyModelsProviderParameters();
- parameters.setImplementation(DummyPolicyModelsProviderImpl.class.getCanonicalName());
+ parameters.setImplementation(DummyPolicyModelsProviderImpl.class.getName());
parameters.setDatabaseUrl("jdbc:dummy");
parameters.setPersistenceUnit("dummy");