summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmOperationTest.java24
-rw-r--r--controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Transaction.java18
2 files changed, 20 insertions, 22 deletions
diff --git a/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmOperationTest.java b/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmOperationTest.java
index cd28ab408..780039978 100644
--- a/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmOperationTest.java
+++ b/controlloop/m2/appclcm/src/test/java/appclcm/AppcLcmOperationTest.java
@@ -438,7 +438,7 @@ public class AppcLcmOperationTest {
assertEquals("Start", appcRequest.getAction());
assertNotNull(appcRequest.getActionIdentifiers());
assertEquals(event.getAai().get("generic-vnf.vnf-id"), appcRequest.getActionIdentifiers().get("vnf-id"));
- assertEquals(appcRequest.getActionIdentifiers().get("vserver-id"), null);
+ assertNull(appcRequest.getActionIdentifiers().get("vserver-id"));
assertNull(appcRequest.getPayload());
logger.info("vnf start request: {}", Serialization.gson.toJson(request, AppcLcmDmaapWrapper.class));
@@ -498,7 +498,7 @@ public class AppcLcmOperationTest {
assertEquals("Stop", appcRequest.getAction());
assertNotNull(appcRequest.getActionIdentifiers());
assertEquals(event.getAai().get("generic-vnf.vnf-id"), appcRequest.getActionIdentifiers().get("vnf-id"));
- assertEquals(appcRequest.getActionIdentifiers().get("vserver-id"), null);
+ assertNull(appcRequest.getActionIdentifiers().get("vserver-id"));
assertNull(appcRequest.getPayload());
logger.info("vnf stop request: {}", Serialization.gson.toJson(request, AppcLcmDmaapWrapper.class));
@@ -553,7 +553,7 @@ public class AppcLcmOperationTest {
AppcLcmDmaapWrapper restartResponse = Serialization.gson.fromJson(lcmRespJson, AppcLcmDmaapWrapper.class);
operation.incomingMessage(restartResponse);
- assertEquals(operation.getResult(), PolicyResult.SUCCESS);
+ assertEquals(PolicyResult.SUCCESS, operation.getResult());
}
@Test
@@ -568,13 +568,13 @@ public class AppcLcmOperationTest {
/* Send in several partial success messages */
for (int i = 0; i < 5; i++) {
operation.incomingMessage(restartResponse);
- assertEquals(operation.getResult(), null);
+ assertNull(operation.getResult());
}
/* Send in an operation success */
restartResponse.getBody().getOutput().getStatus().setCode(400);
operation.incomingMessage(restartResponse);
- assertEquals(operation.getResult(), PolicyResult.SUCCESS);
+ assertEquals(PolicyResult.SUCCESS, operation.getResult());
}
@Test
@@ -587,7 +587,7 @@ public class AppcLcmOperationTest {
AppcLcmDmaapWrapper restartResponse = Serialization.gson.fromJson(lcmRespJson, AppcLcmDmaapWrapper.class);
operation.incomingMessage(restartResponse);
- assertEquals(operation.getResult(), PolicyResult.FAILURE);
+ assertEquals(PolicyResult.FAILURE, operation.getResult());
}
@Test
@@ -602,7 +602,7 @@ public class AppcLcmOperationTest {
/* Send in ALL failure messages */
for (int i = 0; i < 5; i++) {
operation.incomingMessage(restartResponse);
- assertEquals(operation.getResult(), null);
+ assertNull(operation.getResult());
}
/* Send in an operation failure */
@@ -610,7 +610,7 @@ public class AppcLcmOperationTest {
operation.incomingMessage(restartResponse);
/* Because every VM failed in the VNF, it should be failure result */
- assertEquals(operation.getResult(), PolicyResult.FAILURE);
+ assertEquals(PolicyResult.FAILURE, operation.getResult());
}
@Test
@@ -625,7 +625,7 @@ public class AppcLcmOperationTest {
/* Send in several partial success messages */
for (int i = 0; i < 5; i++) {
operation.incomingMessage(restartResponse);
- assertEquals(operation.getResult(), null);
+ assertNull(operation.getResult());
}
/* Change status to partial failure */
@@ -634,7 +634,7 @@ public class AppcLcmOperationTest {
/* Send in several partial failures messages */
for (int i = 0; i < 5; i++) {
operation.incomingMessage(restartResponse);
- assertEquals(operation.getResult(), null);
+ assertNull(operation.getResult());
}
/* Send in an operation failure */
@@ -645,7 +645,7 @@ public class AppcLcmOperationTest {
* Only a subset of VMs failed in the VNF so the
* result will be failure_exception
*/
- assertEquals(operation.getResult(), PolicyResult.FAILURE_EXCEPTION);
+ assertEquals(PolicyResult.FAILURE_EXCEPTION, operation.getResult());
}
/* ===================================================================== */
@@ -671,7 +671,7 @@ public class AppcLcmOperationTest {
VirtualControlLoopEvent noAaiTag = new VirtualControlLoopEvent();
noAaiTag.setAai(null);
assertFalse(AppcLcmOperation.isAaiValid(transaction, noAaiTag));
- assertEquals(transaction.getNotificationMessage(), "No A&AI Subtag");
+ assertEquals("No A&AI Subtag", transaction.getNotificationMessage());
}
@Test
diff --git a/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Transaction.java b/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Transaction.java
index e92f6a234..41c251e2a 100644
--- a/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Transaction.java
+++ b/controlloop/m2/base/src/main/java/org/onap/policy/m2/base/Transaction.java
@@ -64,8 +64,7 @@ public class Transaction implements Serializable {
// use 'ServiceLoader' to locate all of the 'Actor' implementations
for (Actor actor :
ServiceLoader.load(Actor.class, Actor.class.getClassLoader())) {
- logger.debug("Actor: " + actor.getName() + ", "
- + actor.getClass());
+ logger.debug("Actor: {}, {}", actor.getName(), actor.getClass());
nameToActor.put(actor.getName(), actor);
}
}
@@ -117,7 +116,7 @@ public class Transaction implements Serializable {
private String message = null;
// this table maps a class name into the associated adjunct
- private Map<Class, Adjunct> adjuncts = new HashMap<>();
+ private Map<Class<?>, Adjunct> adjuncts = new HashMap<>();
/**
* Constructor - initialize a 'Transaction' instance
@@ -268,7 +267,7 @@ public class Transaction implements Serializable {
onsetAdapter.createNotification(event == null ? this.onset : event);
// include entire history
- notification.setHistory(new ArrayList<ControlLoopOperation>(history));
+ notification.setHistory(new ArrayList<>(history));
return notification;
}
@@ -290,8 +289,7 @@ public class Transaction implements Serializable {
currentOperation.incomingMessage(object);
notification = processResult(currentOperation.getResult());
} else {
- logger.error("'Transaction' received unexpected message: "
- + object);
+ logger.error("'Transaction' received unexpected message: {}", object);
}
return notification;
}
@@ -342,7 +340,7 @@ public class Transaction implements Serializable {
onsetAdapter.createNotification(onset);
notification.setNotification(ControlLoopNotificationType.OPERATION);
notification.setMessage(histEntry.toHistory());
- notification.setHistory(new LinkedList<ControlLoopOperation>());
+ notification.setHistory(new LinkedList<>());
for (ControlLoopOperation clo : history) {
if (histEntry.getOperation().equals(clo.getOperation())
&& histEntry.getActor().equals(clo.getActor())) {
@@ -417,7 +415,7 @@ public class Transaction implements Serializable {
ControlLoopOperation saveHistEntry = histEntry;
completeHistEntry(result);
- final ControlLoopNotification notification = processResult_HistEntry(saveHistEntry, result);
+ final ControlLoopNotification notification = processResultHistEntry(saveHistEntry, result);
// If there is a message from the operation then we set it to be
// used by the control loop notifications
@@ -474,7 +472,7 @@ public class Transaction implements Serializable {
}
// returns a notification message based on the history entry
- private ControlLoopNotification processResult_HistEntry(ControlLoopOperation hist, PolicyResult result) {
+ private ControlLoopNotification processResultHistEntry(ControlLoopOperation hist, PolicyResult result) {
if (hist == null) {
return null;
}
@@ -489,7 +487,7 @@ public class Transaction implements Serializable {
// include the subset of history that pertains to this
// actor and operation
- notification.setHistory(new LinkedList<ControlLoopOperation>());
+ notification.setHistory(new LinkedList<>());
for (ControlLoopOperation clo : history) {
if (hist.getOperation().equals(clo.getOperation())
&& hist.getActor().equals(clo.getActor())) {