aboutsummaryrefslogtreecommitdiffstats
path: root/model
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2020-02-25 16:10:08 +0000
committerliamfallon <liam.fallon@est.tech>2020-02-26 08:33:06 +0000
commit35840d835f581c2d61de1c57fe9963e36eb15c9f (patch)
tree10b8a6004cad1b4d1d63ebebe2aa26ae2af7f3e4 /model
parentaacc7442f046d44359934ea3d93f425a809e7616 (diff)
Fix Java 11/Checkstyle/Sonar warnings
A number of Java 11, checkstyle, and SONAR warnings have crept into the Apex codebase over the last number of reviews. This change fixes those issues. Issue-ID: POLICY-1913 Change-Id: I2afd607e80f48323355380fb2fe5e048e18879f9 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'model')
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyUse.java4
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDaoFactory.java14
-rw-r--r--model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java108
-rw-r--r--model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/DummyEntity.java15
-rw-r--r--model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java24
-rw-r--r--model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/EngineStatsTest.java11
-rw-r--r--model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiPolicyTest.java12
7 files changed, 86 insertions, 102 deletions
diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyUse.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyUse.java
index aff688bf8..8eed845ad 100644
--- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyUse.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/concepts/AxKeyUse.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -161,7 +161,7 @@ public class AxKeyUse extends AxKey {
final AxKeyUse copy = ((AxKeyUse) copyObject);
try {
- copy.usedKey = usedKey.getClass().newInstance();
+ copy.usedKey = usedKey.getClass().getDeclaredConstructor().newInstance();
} catch (final Exception e) {
throw new ApexRuntimeException("error copying concept key: " + e.getMessage(), e);
}
diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDaoFactory.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDaoFactory.java
index b374ff40a..fad3b08b9 100644
--- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDaoFactory.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/ApexDaoFactory.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -45,24 +45,24 @@ public class ApexDaoFactory {
*/
public ApexDao createApexDao(final DaoParameters daoParameters) throws ApexException {
Assertions.argumentOfClassNotNull(daoParameters, ApexException.class,
- "Parameter \"daoParameters\" may not be null");
+ "Parameter \"daoParameters\" may not be null");
// Get the class for the DAO using reflection
Object apexDaoObject = null;
try {
- apexDaoObject = Class.forName(daoParameters.getPluginClass()).newInstance();
- } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
+ apexDaoObject = Class.forName(daoParameters.getPluginClass()).getDeclaredConstructor().newInstance();
+ } catch (final Exception e) {
LOGGER.error("Apex DAO class not found for DAO plugin \"" + daoParameters.getPluginClass() + "\"", e);
throw new ApexException(
- "Apex DAO class not found for DAO plugin \"" + daoParameters.getPluginClass() + "\"", e);
+ "Apex DAO class not found for DAO plugin \"" + daoParameters.getPluginClass() + "\"", e);
}
// Check the class is an Apex DAO
if (!(apexDaoObject instanceof ApexDao)) {
LOGGER.error("Specified Apex DAO plugin class \"" + daoParameters.getPluginClass()
- + "\" does not implement the ApexDao interface");
+ + "\" does not implement the ApexDao interface");
throw new ApexException("Specified Apex DAO plugin class \"" + daoParameters.getPluginClass()
- + "\" does not implement the ApexDao interface");
+ + "\" does not implement the ApexDao interface");
}
return (ApexDao) apexDaoObject;
diff --git a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java
index 375d7f0bf..b8a97928c 100644
--- a/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java
+++ b/model/basic-model/src/main/java/org/onap/policy/apex/model/basicmodel/dao/impl/DefaultApexDao.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -73,12 +73,11 @@ public class DefaultApexDao implements ApexDao {
LOGGER.debug("Creating Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\" . . .");
try {
emf = Persistence.createEntityManagerFactory(daoParameters.getPersistenceUnit(),
- daoParameters.getJdbcProperties());
+ daoParameters.getJdbcProperties());
} catch (final Exception e) {
LOGGER.warn("Creation of Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\" failed", e);
throw new ApexException(
- "Creation of Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\" failed",
- e);
+ "Creation of Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\" failed", e);
}
LOGGER.debug("Created Apex persistence unit \"" + daoParameters.getPersistenceUnit() + "\"");
}
@@ -120,8 +119,7 @@ public class DefaultApexDao implements ApexDao {
mg.getTransaction().begin();
mg.merge(obj);
mg.getTransaction().commit();
- }
- finally {
+ } finally {
mg.close();
}
}
@@ -139,8 +137,7 @@ public class DefaultApexDao implements ApexDao {
mg.getTransaction().begin();
mg.remove(mg.contains(obj) ? obj : mg.merge(obj));
mg.getTransaction().commit();
- }
- finally {
+ } finally {
mg.close();
}
}
@@ -157,10 +154,9 @@ public class DefaultApexDao implements ApexDao {
try {
mg.getTransaction().begin();
mg.createQuery(DELETE_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_NAME + key.getName()
- + AND_C_KEY_VERSION + key.getVersion() + "'", someClass).executeUpdate();
+ + AND_C_KEY_VERSION + key.getVersion() + "'", someClass).executeUpdate();
mg.getTransaction().commit();
- }
- finally {
+ } finally {
mg.close();
}
}
@@ -177,11 +173,10 @@ public class DefaultApexDao implements ApexDao {
try {
mg.getTransaction().begin();
mg.createQuery(DELETE_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME
- + key.getParentKeyName() + AND_C_KEY_PARENT_KEY_VERSION + key.getParentKeyVersion()
- + AND_C_KEY_LOCAL_NAME + key.getLocalName() + "'", someClass).executeUpdate();
+ + key.getParentKeyName() + AND_C_KEY_PARENT_KEY_VERSION + key.getParentKeyVersion()
+ + AND_C_KEY_LOCAL_NAME + key.getLocalName() + "'", someClass).executeUpdate();
mg.getTransaction().commit();
- }
- finally {
+ } finally {
mg.close();
}
}
@@ -201,8 +196,7 @@ public class DefaultApexDao implements ApexDao {
mg.merge(t);
}
mg.getTransaction().commit();
- }
- finally {
+ } finally {
mg.close();
}
}
@@ -222,8 +216,7 @@ public class DefaultApexDao implements ApexDao {
mg.remove(mg.contains(t) ? t : mg.merge(t));
}
mg.getTransaction().commit();
- }
- finally {
+ } finally {
mg.close();
}
}
@@ -233,7 +226,7 @@ public class DefaultApexDao implements ApexDao {
*/
@Override
public <T extends AxConcept> int deleteByArtifactKey(final Class<T> someClass,
- final Collection<AxArtifactKey> keys) {
+ final Collection<AxArtifactKey> keys) {
if (keys == null || keys.isEmpty()) {
return 0;
}
@@ -242,14 +235,11 @@ public class DefaultApexDao implements ApexDao {
try {
mg.getTransaction().begin();
for (final AxArtifactKey key : keys) {
- deletedCount += mg
- .createQuery(DELETE_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_NAME
- + key.getName() + AND_C_KEY_VERSION + key.getVersion() + "'", someClass)
- .executeUpdate();
+ deletedCount += mg.createQuery(DELETE_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_NAME
+ + key.getName() + AND_C_KEY_VERSION + key.getVersion() + "'", someClass).executeUpdate();
}
mg.getTransaction().commit();
- }
- finally {
+ } finally {
mg.close();
}
return deletedCount;
@@ -260,7 +250,7 @@ public class DefaultApexDao implements ApexDao {
*/
@Override
public <T extends AxConcept> int deleteByReferenceKey(final Class<T> someClass,
- final Collection<AxReferenceKey> keys) {
+ final Collection<AxReferenceKey> keys) {
if (keys == null || keys.isEmpty()) {
return 0;
}
@@ -269,13 +259,15 @@ public class DefaultApexDao implements ApexDao {
try {
mg.getTransaction().begin();
for (final AxReferenceKey key : keys) {
- deletedCount += mg.createQuery(DELETE_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME
- + key.getParentKeyName() + AND_C_KEY_PARENT_KEY_VERSION + key.getParentKeyVersion()
- + AND_C_KEY_LOCAL_NAME + key.getLocalName() + "'", someClass).executeUpdate();
+ deletedCount +=
+ mg.createQuery(
+ DELETE_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME
+ + key.getParentKeyName() + AND_C_KEY_PARENT_KEY_VERSION
+ + key.getParentKeyVersion() + AND_C_KEY_LOCAL_NAME + key.getLocalName() + "'",
+ someClass).executeUpdate();
}
mg.getTransaction().commit();
- }
- finally {
+ } finally {
mg.close();
}
return deletedCount;
@@ -291,8 +283,7 @@ public class DefaultApexDao implements ApexDao {
mg.getTransaction().begin();
mg.createQuery(DELETE_FROM + someClass.getSimpleName() + " c ", someClass).executeUpdate();
mg.getTransaction().commit();
- }
- finally {
+ } finally {
mg.close();
}
}
@@ -311,7 +302,7 @@ public class DefaultApexDao implements ApexDao {
if (t != null) {
// This clone is created to force the JPA DAO to recurse down through the object
try {
- final T clonedT = someClass.newInstance();
+ final T clonedT = someClass.getDeclaredConstructor().newInstance();
t.copyTo(clonedT);
return clonedT;
} catch (final Exception e) {
@@ -321,8 +312,7 @@ public class DefaultApexDao implements ApexDao {
} else {
return null;
}
- }
- finally {
+ } finally {
mg.close();
}
}
@@ -340,7 +330,7 @@ public class DefaultApexDao implements ApexDao {
final T t = mg.find(someClass, key);
if (t != null) {
try {
- final T clonedT = someClass.newInstance();
+ final T clonedT = someClass.getDeclaredConstructor().newInstance();
t.copyTo(clonedT);
return clonedT;
} catch (final Exception e) {
@@ -350,8 +340,7 @@ public class DefaultApexDao implements ApexDao {
} else {
return null;
}
- }
- finally {
+ } finally {
mg.close();
}
}
@@ -367,8 +356,7 @@ public class DefaultApexDao implements ApexDao {
final EntityManager mg = getEntityManager();
try {
return mg.createQuery(SELECT_C_FROM + someClass.getSimpleName() + " c", someClass).getResultList();
- }
- finally {
+ } finally {
mg.close();
}
}
@@ -383,11 +371,13 @@ public class DefaultApexDao implements ApexDao {
}
final EntityManager mg = getEntityManager();
try {
- return mg.createQuery(SELECT_C_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME
- + parentKey.getName() + AND_C_KEY_PARENT_KEY_VERSION + parentKey.getVersion() + "'",
- someClass).getResultList();
- }
- finally {
+ return mg
+ .createQuery(
+ SELECT_C_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME
+ + parentKey.getName() + AND_C_KEY_PARENT_KEY_VERSION + parentKey.getVersion() + "'",
+ someClass)
+ .getResultList();
+ } finally {
mg.close();
}
}
@@ -404,9 +394,8 @@ public class DefaultApexDao implements ApexDao {
List<T> ret;
try {
ret = mg.createQuery(SELECT_C_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_NAME + key.getName()
- + AND_C_KEY_VERSION + key.getVersion() + "'", someClass).getResultList();
- }
- finally {
+ + AND_C_KEY_VERSION + key.getVersion() + "'", someClass).getResultList();
+ } finally {
mg.close();
}
if (ret == null || ret.isEmpty()) {
@@ -414,7 +403,7 @@ public class DefaultApexDao implements ApexDao {
}
if (ret.size() > 1) {
throw new IllegalArgumentException("More than one result was returned for search for " + someClass
- + " with key " + key.getId() + ": " + ret);
+ + " with key " + key.getId() + ": " + ret);
}
return ret.get(0);
}
@@ -431,10 +420,9 @@ public class DefaultApexDao implements ApexDao {
List<T> ret;
try {
ret = mg.createQuery(SELECT_C_FROM + someClass.getSimpleName() + C_WHERE_C_KEY_PARENT_KEY_NAME
- + key.getParentKeyName() + AND_C_KEY_PARENT_KEY_VERSION + key.getParentKeyVersion()
- + AND_C_KEY_LOCAL_NAME + key.getLocalName() + "'", someClass).getResultList();
- }
- finally {
+ + key.getParentKeyName() + AND_C_KEY_PARENT_KEY_VERSION + key.getParentKeyVersion()
+ + AND_C_KEY_LOCAL_NAME + key.getLocalName() + "'", someClass).getResultList();
+ } finally {
mg.close();
}
if (ret == null || ret.isEmpty()) {
@@ -442,7 +430,7 @@ public class DefaultApexDao implements ApexDao {
}
if (ret.size() > 1) {
throw new IllegalArgumentException("More than one result was returned for search for " + someClass
- + " with key " + key.getId() + ": " + ret);
+ + " with key " + key.getId() + ": " + ret);
}
return ret.get(0);
}
@@ -459,8 +447,7 @@ public class DefaultApexDao implements ApexDao {
ret = mg.merge(obj);
mg.flush();
mg.getTransaction().commit();
- }
- finally {
+ } finally {
mg.close();
}
return ret;
@@ -478,9 +465,8 @@ public class DefaultApexDao implements ApexDao {
long size = 0;
try {
size = mg.createQuery("SELECT COUNT(c) FROM " + someClass.getSimpleName() + " c", Long.class)
- .getSingleResult();
- }
- finally {
+ .getSingleResult();
+ } finally {
mg.close();
}
return size;
diff --git a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/DummyEntity.java b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/DummyEntity.java
index 02174488e..ff2bf9354 100644
--- a/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/DummyEntity.java
+++ b/model/basic-model/src/test/java/org/onap/policy/apex/model/basicmodel/concepts/DummyEntity.java
@@ -1,19 +1,20 @@
/*
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -29,10 +30,6 @@ import javax.persistence.Table;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
-import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxReferenceKey;
-import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
import org.onap.policy.apex.model.basicmodel.xml.AxReferenceKeyAdapter;
@Entity
@@ -63,10 +60,12 @@ public class DummyEntity extends AxConcept {
this.doubleValue = doubleValue;
}
+ @Override
public AxReferenceKey getKey() {
return key;
}
+ @Override
public List<AxKey> getKeys() {
return Arrays.asList((AxKey) getKey());
}
@@ -172,7 +171,7 @@ public class DummyEntity extends AxConcept {
return key.compareTo(other.key);
}
if (doubleValue != other.doubleValue) {
- return new Double(doubleValue).compareTo(other.doubleValue);
+ return Double.valueOf(doubleValue).compareTo(other.doubleValue);
}
return 0;
diff --git a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java
index d01da460b..db6209af0 100644
--- a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java
+++ b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java
@@ -35,6 +35,8 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import lombok.Getter;
+
import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
import org.onap.policy.apex.model.basicmodel.concepts.AxConcept;
import org.onap.policy.apex.model.basicmodel.concepts.AxKey;
@@ -43,13 +45,11 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationMessage;
import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
import org.onap.policy.common.utils.validation.Assertions;
-import lombok.Getter;
/**
- * This class is a java bean that is used to record statistics on Apex engines as they execute.
- * Statistics on the number of events, the amount of time taken to execute the last policy, the
- * average policy execution time, the up time of the engine, and the time stamp of the last engine
- * start are recorded.
+ * This class is a java bean that is used to record statistics on Apex engines as they execute. Statistics on the number
+ * of events, the amount of time taken to execute the last policy, the average policy execution time, the up time of the
+ * engine, and the time stamp of the last engine start are recorded.
*/
@Entity
@@ -58,7 +58,7 @@ import lombok.Getter;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "apexEngineStats", namespace = "http://www.onap.org/policy/apex-pdp")
@XmlType(name = "AxEngineStats", namespace = "http://www.onap.org/policy/apex-pdp", propOrder = {"key", "timeStamp",
- "eventCount", "lastExecutionTime", "averageExecutionTime", "upTime", "lastStart"})
+ "eventCount", "lastExecutionTime", "averageExecutionTime", "upTime", "lastStart"})
public class AxEngineStats extends AxConcept {
private static final long serialVersionUID = -6981129081962785368L;
private static final int HASH_CODE_PRIME = 32;
@@ -96,8 +96,7 @@ public class AxEngineStats extends AxConcept {
private long lastStart;
/**
- * The Default Constructor creates an engine statistics instance with a null key and with all
- * values cleared.
+ * The Default Constructor creates an engine statistics instance with a null key and with all values cleared.
*/
public AxEngineStats() {
this(new AxReferenceKey());
@@ -120,8 +119,7 @@ public class AxEngineStats extends AxConcept {
}
/**
- * The Keyed Constructor creates an engine statistics instance with the given key and all values
- * cleared.
+ * The Keyed Constructor creates an engine statistics instance with the given key and all values cleared.
*
* @param key the key
*/
@@ -314,8 +312,7 @@ public class AxEngineStats extends AxConcept {
}
/**
- * Updates the statistics when called, used by the Apex engine when it starts executing a
- * policy.
+ * Updates the statistics when called, used by the Apex engine when it starts executing a policy.
*
* @param eventkey the key of the event that is being executed
*/
@@ -330,8 +327,7 @@ public class AxEngineStats extends AxConcept {
}
/**
- * Updates the statistics when called, used by the Apex engine when it completes executing a
- * policy.
+ * Updates the statistics when called, used by the Apex engine when it completes executing a policy.
*/
public synchronized void executionExit() {
final long now = System.currentTimeMillis();
diff --git a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/EngineStatsTest.java b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/EngineStatsTest.java
index c6fde1cdf..b35d40570 100644
--- a/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/EngineStatsTest.java
+++ b/model/engine-model/src/test/java/org/onap/policy/apex/model/enginemodel/concepts/EngineStatsTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,7 +35,8 @@ import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult;
import org.onap.policy.apex.model.basicmodel.concepts.AxValidationResult.ValidationResult;
/**
- * Test engine statistics.
+ * Test the engine statistics.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class EngineStatsTest {
@@ -61,7 +62,7 @@ public class EngineStatsTest {
assertEquals("EngineKey:0.0.1:NULL:EngineStats", stats.getKeys().get(0).getId());
stats.setAverageExecutionTime(123.45);
- assertEquals(new Double(123.45), new Double(stats.getAverageExecutionTime()));
+ assertEquals(Double.valueOf(123.45), Double.valueOf(stats.getAverageExecutionTime()));
stats.setEventCount(987);
assertEquals(987, stats.getEventCount());
@@ -100,7 +101,7 @@ public class EngineStatsTest {
stats.engineStart();
stats.setEventCount(4);
stats.executionEnter(new AxArtifactKey());
-
+
synchronized (WAIT_LOCK) {
try {
WAIT_LOCK.wait(10);
@@ -141,7 +142,7 @@ public class EngineStatsTest {
assertTrue(stats.equals(stats));
assertTrue(stats.equals(clonedStats));
assertFalse(stats.equals(null));
- assertFalse(stats.equals((Object)"Hello"));
+ assertFalse(stats.equals("Hello"));
assertFalse(stats.equals(new AxEngineStats(new AxReferenceKey())));
assertEquals(0, stats.compareTo(stats));
diff --git a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiPolicyTest.java b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiPolicyTest.java
index 4c54b2062..515ff8038 100644
--- a/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiPolicyTest.java
+++ b/model/model-api/src/test/java/org/onap/policy/apex/model/modelapi/ApexEditorApiPolicyTest.java
@@ -1,19 +1,20 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -26,12 +27,13 @@ import static org.junit.Assert.assertTrue;
import org.junit.Test;
/**
- * Test policies for API tests.
+ * Test policies for API.
+ *
* @author Liam Fallon (liam.fallon@ericsson.com)
*/
public class ApexEditorApiPolicyTest {
@Test
- public void myTestPolicyCrud() {
+ public void testMyTestPolicyCrud() {
final ApexModel apexModel = new ApexModelFactory().createApexModel(null, false);
ApexApiResult result = apexModel.validatePolicy(null, null);