summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-impl/sdnr/src
diff options
context:
space:
mode:
Diffstat (limited to 'models-interactions/model-impl/sdnr/src')
-rw-r--r--models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java3
-rw-r--r--models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java5
-rw-r--r--models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java20
-rw-r--r--models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java11
-rw-r--r--models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java7
-rw-r--r--models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java11
-rw-r--r--models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java47
-rw-r--r--models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java9
8 files changed, 69 insertions, 44 deletions
diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java
index f575a73c3..8552bb23c 100644
--- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java
+++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciCommonHeader.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. 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.
@@ -148,6 +149,7 @@ public class PciCommonHeader implements Serializable {
public void setSubRequestId(String subRequestId) {
this.subRequestId = subRequestId;
}
+
/**
* Set the request track.
*
@@ -157,6 +159,7 @@ public class PciCommonHeader implements Serializable {
public void setRequestTrack(Map<String, String> requestTrack) {
this.requestTrack = requestTrack;
}
+
/**
* Get the request track.
*
diff --git a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java
index 73ee4c65d..d76dd88b5 100644
--- a/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java
+++ b/models-interactions/model-impl/sdnr/src/main/java/org/onap/policy/sdnr/PciRequest.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. 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.
@@ -82,8 +83,8 @@ public class PciRequest implements Serializable {
/**
* Set the payload.
*
- * @param action
- * the action to set
+ * @param payload
+ * the payload to set
*/
public void setPayload(String payload) {
diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java
index f0cc246b9..84178e062 100644
--- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java
+++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciCommonHeaderTest.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. 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.
@@ -36,6 +37,9 @@ import org.junit.Test;
public class PciCommonHeaderTest {
+ private static final String KANSAS = "Kansas";
+ private static final String CAN_I_GO_HOME = "Can I go home?";
+
@Test
public void testPciCommonHeader() {
PciCommonHeader commonHeader = new PciCommonHeader();
@@ -43,8 +47,8 @@ public class PciCommonHeaderTest {
assertNotNull(new PciCommonHeader(commonHeader));
assertNotEquals(0, commonHeader.hashCode());
- commonHeader.setApiVer("Kansas");
- assertEquals("Kansas", commonHeader.getApiVer());
+ commonHeader.setApiVer(KANSAS);
+ assertEquals(KANSAS, commonHeader.getApiVer());
Map<String, String> flagMap = new HashMap<>();
commonHeader.setFlags(flagMap);
@@ -58,8 +62,8 @@ public class PciCommonHeaderTest {
commonHeader.setRequestId(requestId);
assertEquals(requestId, commonHeader.getRequestId());
- commonHeader.setSubRequestId("Can I go home?");
- assertEquals("Can I go home?", commonHeader.getSubRequestId());
+ commonHeader.setSubRequestId(CAN_I_GO_HOME);
+ assertEquals(CAN_I_GO_HOME, commonHeader.getSubRequestId());
Instant timestamp = Instant.now();
commonHeader.setTimeStamp(timestamp);
@@ -91,9 +95,9 @@ public class PciCommonHeaderTest {
assertFalse(commonHeader.equals(copiedPciCommonHeader));
copiedPciCommonHeader.setApiVer(null);
assertTrue(commonHeader.equals(copiedPciCommonHeader));
- commonHeader.setApiVer("Kansas");
+ commonHeader.setApiVer(KANSAS);
assertFalse(commonHeader.equals(copiedPciCommonHeader));
- copiedPciCommonHeader.setApiVer("Kansas");
+ copiedPciCommonHeader.setApiVer(KANSAS);
assertTrue(commonHeader.equals(copiedPciCommonHeader));
commonHeader.setFlags(null);
@@ -128,9 +132,9 @@ public class PciCommonHeaderTest {
assertFalse(commonHeader.equals(copiedPciCommonHeader));
copiedPciCommonHeader.setSubRequestId(null);
assertTrue(commonHeader.equals(copiedPciCommonHeader));
- commonHeader.setSubRequestId("Can I go home?");
+ commonHeader.setSubRequestId(CAN_I_GO_HOME);
assertFalse(commonHeader.equals(copiedPciCommonHeader));
- copiedPciCommonHeader.setSubRequestId("Can I go home?");
+ copiedPciCommonHeader.setSubRequestId(CAN_I_GO_HOME);
assertTrue(commonHeader.equals(copiedPciCommonHeader));
commonHeader.setTimeStamp(null);
diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java
index 023dd18ca..0009c2a5c 100644
--- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java
+++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciRequestTest.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. 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.
@@ -31,6 +32,8 @@ import org.junit.Test;
public class PciRequestTest {
+ private static final String MODIFY = "Modify";
+
@Test
public void testPciRequest() {
PciRequest request = new PciRequest();
@@ -46,8 +49,8 @@ public class PciRequestTest {
request.setPayload(requestPayload);
assertEquals(requestPayload, request.getPayload());
- request.setAction("Modify");
- assertEquals("Modify", request.getAction());
+ request.setAction(MODIFY);
+ assertEquals(MODIFY, request.getAction());
assertNotEquals(0, request.hashCode());
@@ -76,9 +79,9 @@ public class PciRequestTest {
assertFalse(request.equals(copiedPciRequest));
copiedPciRequest.setAction(null);
assertTrue(request.equals(copiedPciRequest));
- request.setAction("Modify");
+ request.setAction(MODIFY);
assertFalse(request.equals(copiedPciRequest));
- copiedPciRequest.setAction("Modify");
+ copiedPciRequest.setAction(MODIFY);
assertTrue(request.equals(copiedPciRequest));
request.setPayload(null);
diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java
index 27f4c23cf..6e990ea12 100644
--- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java
+++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciResponseTest.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. 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.
@@ -97,9 +98,9 @@ public class PciResponseTest {
response2.setStatus(response.getStatus());
assertTrue(response.equals(response2));
- Status status = new Status();
- status.setCode(5);
- response.setStatus(status);
+ Status stat = new Status();
+ stat.setCode(5);
+ response.setStatus(stat);
response2.setStatus(new Status());
assertFalse(response.equals(response2));
}
diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java
index f8f5820dc..08ac56b85 100644
--- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java
+++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciStatusTest.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. 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.
@@ -31,6 +32,8 @@ import org.junit.Test;
public class PciStatusTest {
+ private static final String THE_WONDERFUL_LAND_OF_OZ = "The wonderful land of Oz";
+
@Test
public void testResponseStatus() {
Status status = new Status();
@@ -40,8 +43,8 @@ public class PciStatusTest {
status.setCode(1234);
assertEquals(1234, status.getCode());
- status.setValue("The wonderful land of Oz");
- assertEquals("The wonderful land of Oz", status.getValue());
+ status.setValue(THE_WONDERFUL_LAND_OF_OZ);
+ assertEquals(THE_WONDERFUL_LAND_OF_OZ, status.getValue());
assertEquals("Status [code = 1234, value = The wonderfu", status.toString().substring(0, 41));
@@ -67,9 +70,9 @@ public class PciStatusTest {
assertFalse(status.equals(copiedStatus));
copiedStatus.setValue(null);
assertTrue(status.equals(copiedStatus));
- status.setValue("The wonderful land of Oz");
+ status.setValue(THE_WONDERFUL_LAND_OF_OZ);
assertFalse(status.equals(copiedStatus));
- copiedStatus.setValue("The wonderful land of Oz");
+ copiedStatus.setValue(THE_WONDERFUL_LAND_OF_OZ);
assertTrue(status.equals(copiedStatus));
}
}
diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java
index 151d3343a..f05f50e67 100644
--- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java
+++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/PciWrapperTest.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. 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.
@@ -31,26 +32,32 @@ import org.junit.Test;
public class PciWrapperTest {
+ private static final String YELLOW_BRICK_ROAD = "YellowBrickRoad";
+ private static final String TORNADO = "Tornado";
+ private static final String THE_EMERALD_CITY = "The Emerald City";
+ private static final String MUNCHKIN = "Munchkin";
+ private static final String VERSION_19 = "19.3.9";
+
@Test
public void testPciWrapper() {
PciWrapper wrapper = new PciWrapper();
assertNotNull(wrapper);
assertNotEquals(0, wrapper.hashCode());
- wrapper.setVersion("19.3.9");
- assertEquals("19.3.9", wrapper.getVersion());
+ wrapper.setVersion(VERSION_19);
+ assertEquals(VERSION_19, wrapper.getVersion());
- wrapper.setCambriaPartition("The Emerald City");
- assertEquals("The Emerald City", wrapper.getCambriaPartition());
+ wrapper.setCambriaPartition(THE_EMERALD_CITY);
+ assertEquals(THE_EMERALD_CITY, wrapper.getCambriaPartition());
- wrapper.setRpcName("Tornado");
- assertEquals("Tornado", wrapper.getRpcName());
+ wrapper.setRpcName(TORNADO);
+ assertEquals(TORNADO, wrapper.getRpcName());
- wrapper.setCorrelationId("YellowBrickRoad");
- assertEquals("YellowBrickRoad", wrapper.getCorrelationId());
+ wrapper.setCorrelationId(YELLOW_BRICK_ROAD);
+ assertEquals(YELLOW_BRICK_ROAD, wrapper.getCorrelationId());
- wrapper.setType("Munchkin");
- assertEquals("Munchkin", wrapper.getType());
+ wrapper.setType(MUNCHKIN);
+ assertEquals(MUNCHKIN, wrapper.getType());
assertNotEquals(0, wrapper.hashCode());
@@ -72,45 +79,45 @@ public class PciWrapperTest {
assertFalse(wrapper.equals(copiedPciWrapper));
copiedPciWrapper.setVersion(null);
assertTrue(wrapper.equals(copiedPciWrapper));
- wrapper.setVersion("19.3.9");
+ wrapper.setVersion(VERSION_19);
assertFalse(wrapper.equals(copiedPciWrapper));
- copiedPciWrapper.setVersion("19.3.9");
+ copiedPciWrapper.setVersion(VERSION_19);
assertTrue(wrapper.equals(copiedPciWrapper));
wrapper.setCambriaPartition(null);
assertFalse(wrapper.equals(copiedPciWrapper));
copiedPciWrapper.setCambriaPartition(null);
assertTrue(wrapper.equals(copiedPciWrapper));
- wrapper.setCambriaPartition("The Emerald City");
+ wrapper.setCambriaPartition(THE_EMERALD_CITY);
assertFalse(wrapper.equals(copiedPciWrapper));
- copiedPciWrapper.setCambriaPartition("The Emerald City");
+ copiedPciWrapper.setCambriaPartition(THE_EMERALD_CITY);
assertTrue(wrapper.equals(copiedPciWrapper));
wrapper.setRpcName(null);
assertFalse(wrapper.equals(copiedPciWrapper));
copiedPciWrapper.setRpcName(null);
assertTrue(wrapper.equals(copiedPciWrapper));
- wrapper.setRpcName("Tornado");
+ wrapper.setRpcName(TORNADO);
assertFalse(wrapper.equals(copiedPciWrapper));
- copiedPciWrapper.setRpcName("Tornado");
+ copiedPciWrapper.setRpcName(TORNADO);
assertTrue(wrapper.equals(copiedPciWrapper));
wrapper.setCorrelationId(null);
assertFalse(wrapper.equals(copiedPciWrapper));
copiedPciWrapper.setCorrelationId(null);
assertTrue(wrapper.equals(copiedPciWrapper));
- wrapper.setCorrelationId("YellowBrickRoad");
+ wrapper.setCorrelationId(YELLOW_BRICK_ROAD);
assertFalse(wrapper.equals(copiedPciWrapper));
- copiedPciWrapper.setCorrelationId("YellowBrickRoad");
+ copiedPciWrapper.setCorrelationId(YELLOW_BRICK_ROAD);
assertTrue(wrapper.equals(copiedPciWrapper));
wrapper.setType(null);
assertFalse(wrapper.equals(copiedPciWrapper));
copiedPciWrapper.setType(null);
assertTrue(wrapper.equals(copiedPciWrapper));
- wrapper.setType("Munchkin");
+ wrapper.setType(MUNCHKIN);
assertFalse(wrapper.equals(copiedPciWrapper));
- copiedPciWrapper.setType("Munchkin");
+ copiedPciWrapper.setType(MUNCHKIN);
assertTrue(wrapper.equals(copiedPciWrapper));
}
}
diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java
index 8317482cc..4cbda52ec 100644
--- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java
+++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. 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.
@@ -35,6 +36,8 @@ import org.slf4j.LoggerFactory;
public class SdnrTest {
+ private static final String CORRELATION_ID = "664be3d2-6c12-4f4b-a3e7-c349acced200";
+
private static final Logger logger = LoggerFactory.getLogger(SdnrTest.class);
private static PciRequestWrapper dmaapRequest;
@@ -45,12 +48,12 @@ public class SdnrTest {
* Construct an SDNR Request to be Serialized
*/
dmaapRequest = new PciRequestWrapper();
- dmaapRequest.setCorrelationId("664be3d2-6c12-4f4b-a3e7-c349acced200" + "-" + "1");
+ dmaapRequest.setCorrelationId(CORRELATION_ID + "-" + "1");
dmaapRequest.setRpcName("restart");
dmaapRequest.setType("request");
dmaapResponse = new PciResponseWrapper();
- dmaapResponse.setCorrelationId("664be3d2-6c12-4f4b-a3e7-c349acced200" + "-" + "1");
+ dmaapResponse.setCorrelationId(CORRELATION_ID + "-" + "1");
dmaapResponse.setRpcName("restart");
dmaapResponse.setType("response");
@@ -59,7 +62,7 @@ public class SdnrTest {
sdnrRequest.setAction("ModifyConfig");
PciCommonHeader commonHeader = new PciCommonHeader();
- commonHeader.setRequestId(UUID.fromString("664be3d2-6c12-4f4b-a3e7-c349acced200"));
+ commonHeader.setRequestId(UUID.fromString(CORRELATION_ID));
commonHeader.setSubRequestId("1");
sdnrRequest.setCommonHeader(commonHeader);