summaryrefslogtreecommitdiffstats
path: root/models-provider
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-05-10 11:39:27 -0400
committerJim Hahn <jrh3@att.com>2021-05-10 11:47:43 -0400
commit6b6eb52ef3111142ba2dc9afb85cdd48dc0454ca (patch)
tree38eab0c0266747a705fef5d986820ce59a39176b /models-provider
parentda708d64dc27f36ed5da733fca14ebfb4cc2832b (diff)
Fix sonars in policy models
Fixed: - use "var" Issue-ID: POLICY-3094 Change-Id: Id5ea7ab049c2018744afa75a55d44e47f216d5bc 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/impl/AbstractModelsProvider.java6
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java6
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java2
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java2
4 files changed, 8 insertions, 8 deletions
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractModelsProvider.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractModelsProvider.java
index a0c5ce678..dc0a1f62e 100644
--- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractModelsProvider.java
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/AbstractModelsProvider.java
@@ -69,17 +69,17 @@ public abstract class AbstractModelsProvider implements Closeable {
parameters.getPersistenceUnit());
if (pfDao != null) {
- String errorMessage = "provider is already initialized";
+ var errorMessage = "provider is already initialized";
throw new PfModelException(Response.Status.NOT_ACCEPTABLE, errorMessage);
}
// Parameters for the DAO
- final DaoParameters daoParameters = new DaoParameters();
+ final var daoParameters = new DaoParameters();
daoParameters.setPluginClass(DefaultPfDao.class.getName());
daoParameters.setPersistenceUnit(parameters.getPersistenceUnit());
// @formatter:off
- Properties jdbcProperties = new Properties();
+ var jdbcProperties = new Properties();
jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_DRIVER, parameters.getDatabaseDriver());
jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_URL, parameters.getDatabaseUrl());
jdbcProperties.setProperty(PersistenceUnitProperties.JDBC_USER, parameters.getDatabaseUser());
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 1839604aa..a90dc895c 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
@@ -146,7 +146,7 @@ public class DatabasePolicyModelsProviderImpl extends AbstractModelsProvider imp
throws PfModelException {
assertInitialized();
- ToscaConceptIdentifier policyTypeIdentifier = new ToscaConceptIdentifier(name, version);
+ var policyTypeIdentifier = new ToscaConceptIdentifier(name, version);
assertPolicyTypeNotSupportedInPdpGroup(policyTypeIdentifier);
return new AuthorativeToscaProvider().deletePolicyType(getPfDao(), name, version);
@@ -197,7 +197,7 @@ public class DatabasePolicyModelsProviderImpl extends AbstractModelsProvider imp
throws PfModelException {
assertInitialized();
- ToscaConceptIdentifier policyIdentifier = new ToscaConceptIdentifier(name, version);
+ var policyIdentifier = new ToscaConceptIdentifier(name, version);
assertPolicyNotDeployedInPdpGroup(policyIdentifier);
return new AuthorativeToscaProvider().deletePolicy(getPfDao(), name, version);
@@ -314,7 +314,7 @@ public class DatabasePolicyModelsProviderImpl extends AbstractModelsProvider imp
*/
private void assertInitialized() {
if (getPfDao() == null) {
- String errorMessage = "policy models provider is not initilaized";
+ var errorMessage = "policy models provider is not initilaized";
throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, errorMessage);
}
}
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java
index 07617aad9..f47f4d464 100644
--- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DummyPolicyModelsProviderImpl.java
@@ -274,7 +274,7 @@ public class DummyPolicyModelsProviderImpl implements PolicyModelsProvider {
* @return the ToscaServiceTemplate with the dummy response
*/
protected ToscaServiceTemplate getDummyResponse(final String fileName) {
- StandardCoder standardCoder = new StandardCoder();
+ var standardCoder = new StandardCoder();
ToscaServiceTemplate serviceTemplate;
try {
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
index a1102cb51..9e8ba0bbc 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
@@ -412,7 +412,7 @@ public class DatabasePolicyModelsProviderTest {
List<PdpStatistics> statisticsArrayList = makePdpStatisticsList();
- assertThat(databaseProvider.getPdpStatistics(null, null)).hasSize(0);
+ assertThat(databaseProvider.getPdpStatistics(null, null)).isEmpty();
assertThat(databaseProvider.createPdpStatistics(statisticsArrayList)).hasSize(1);
assertThat(databaseProvider.updatePdpStatistics(statisticsArrayList)).hasSize(1);
}