aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/model-impl/so/src/test
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2018-08-29 07:58:53 -0400
committerPamela Dragosh <pdragosh@research.att.com>2018-08-29 12:34:55 -0400
commit8279af376b435e1d7dd118a1955c5681edf3b847 (patch)
treef0e9f24028b8e96908184192f9e2813a2981938a /controlloop/common/model-impl/so/src/test
parent17435998307f9f86ec5ebe55d6d36eceee1f1943 (diff)
Fix remaining checkstyle
Lots of formatting, missing javadoc, distance from use, imports must be explicit, ordering of methods. Fixed some abbreviation problems in classes and renamed JUnit tests to fix this. Issue-ID: POLICY-883 Change-Id: I8494f63d88d63c0232aca97f7bcc848816228fb1 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'controlloop/common/model-impl/so/src/test')
-rw-r--r--controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DummyWorkingMemory.java25
-rw-r--r--controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoDummyServer.java33
-rw-r--r--controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoManager.java (renamed from controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSOManager.java)5
-rwxr-xr-xcontrolloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestDetails.java92
-rwxr-xr-xcontrolloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoResponseWrapper.java46
5 files changed, 118 insertions, 83 deletions
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DummyWorkingMemory.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DummyWorkingMemory.java
index af7ddc426..b8fd036c5 100644
--- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DummyWorkingMemory.java
+++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/DummyWorkingMemory.java
@@ -17,6 +17,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.so;
import java.util.Collection;
@@ -50,16 +51,15 @@ public class DummyWorkingMemory implements WorkingMemory {
}
@Override
- public void removeEventListener(RuleRuntimeEventListener listener) {
+ public void addEventListener(AgendaEventListener listener) {
}
@Override
- public Collection<RuleRuntimeEventListener> getRuleRuntimeEventListeners() {
- return null;
+ public void addEventListener(KieBaseEventListener listener) {
}
@Override
- public void addEventListener(AgendaEventListener listener) {
+ public void removeEventListener(RuleRuntimeEventListener listener) {
}
@Override
@@ -67,16 +67,17 @@ public class DummyWorkingMemory implements WorkingMemory {
}
@Override
- public Collection<AgendaEventListener> getAgendaEventListeners() {
- return null;
+ public void removeEventListener(KieBaseEventListener listener) {
}
@Override
- public void addEventListener(KieBaseEventListener listener) {
+ public Collection<RuleRuntimeEventListener> getRuleRuntimeEventListeners() {
+ return null;
}
@Override
- public void removeEventListener(KieBaseEventListener listener) {
+ public Collection<AgendaEventListener> getAgendaEventListeners() {
+ return null;
}
@Override
@@ -90,16 +91,16 @@ public class DummyWorkingMemory implements WorkingMemory {
}
@Override
- public void dispose() {
+ public FactHandle insert(Object object) {
+ return null;
}
@Override
- public String getEntryPointId() {
- return null;
+ public void dispose() {
}
@Override
- public FactHandle insert(Object object) {
+ public String getEntryPointId() {
return null;
}
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoDummyServer.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoDummyServer.java
index 348523140..5eb0a01ee 100644
--- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoDummyServer.java
+++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoDummyServer.java
@@ -22,6 +22,7 @@
package org.onap.policy.so;
+import com.google.gson.Gson;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.ws.rs.GET;
@@ -29,7 +30,6 @@ import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.core.Response;
-import com.google.gson.Gson;
@Path("/SO")
public class TestSoDummyServer {
@@ -41,6 +41,11 @@ public class TestSoDummyServer {
private static Map<String, SOResponse> ongoingRequestMap = new ConcurrentHashMap<>();
+ /**
+ * Stats method.
+ *
+ * @return response
+ */
@GET
@Path("/Stats")
public Response serviceGetStats() {
@@ -49,6 +54,12 @@ public class TestSoDummyServer {
+ ",\"POST\": " + postMessagesReceived + ",\"PUT\": " + putMessagesReceived + "}").build();
}
+ /**
+ * Get stat type.
+ *
+ * @param statType the stat type
+ * @return http response
+ */
@GET
@Path("/OneStat/{statType}")
public Response serviceGetStat(@PathParam("statType") final String statType) {
@@ -56,6 +67,12 @@ public class TestSoDummyServer {
return Response.status(200).entity("{\"TYPE\": " + statType + "}").build();
}
+ /**
+ * Post to service instantiation.
+ *
+ * @param jsonString string to send
+ * @return http response
+ */
@POST
@Path("/serviceInstantiation/v7")
public Response servicePostRequest(final String jsonString) {
@@ -138,6 +155,14 @@ public class TestSoDummyServer {
return null;
}
+ /**
+ * Post.
+ *
+ * @param serviceInstanceId service instance id
+ * @param vnfInstanceId vnf instance id
+ * @param jsonString json body
+ * @return http response
+ */
@POST
@Path("/serviceInstantiation/v7/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/scaleOut")
public Response servicePostRequestVfModules(@PathParam("serviceInstanceId") final String serviceInstanceId,
@@ -221,6 +246,12 @@ public class TestSoDummyServer {
return null;
}
+ /**
+ * Get instance ID.
+ *
+ * @param nsInstanceId node instance id
+ * @return http response
+ */
@GET
@Path("/orchestrationRequests/v5/{nsInstanceId}")
public Response soRequestStatus(@PathParam("nsInstanceId") final String nsInstanceId) {
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSOManager.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoManager.java
index 4a7fdda8d..38bfcd398 100644
--- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSOManager.java
+++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoManager.java
@@ -3,6 +3,7 @@
* TestSOManager
* ================================================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 2018 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.
@@ -17,6 +18,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
+
package org.onap.policy.so;
import static org.junit.Assert.assertEquals;
@@ -24,6 +26,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+
import java.io.IOException;
import java.net.URI;
import java.util.UUID;
@@ -43,7 +46,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.policy.drools.system.PolicyEngine;
-public class TestSOManager {
+public class TestSoManager {
private static final String BASE_URI = "http://localhost:46553/TestSOManager";
private static final String BASE_SO_URI = BASE_URI + "/SO";
private static HttpServer server;
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestDetails.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestDetails.java
index 6e9a2bade..c4b024593 100755
--- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestDetails.java
+++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestDetails.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* so
* ================================================================================
- *
+ * Copyright (C) 2018 Ericsson. 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.
@@ -72,45 +72,45 @@ public class TestSoRequestDetails {
assertEquals(subscriberInfo, obj.getSubscriberInfo());
}
- @Test
- public void testSOMRequestDetailsMethods() {
- SORequestDetails details = new SORequestDetails();
- assertNotNull(details);
- assertNotEquals(0, details.hashCode());
-
- SOCloudConfiguration cloudConfiguration = new SOCloudConfiguration();
- details.setCloudConfiguration(cloudConfiguration);
- assertEquals(cloudConfiguration, details.getCloudConfiguration());
- assertNotEquals(0, details.hashCode());
-
- SOModelInfo modelInfo = new SOModelInfo();
- details.setModelInfo(modelInfo);
- assertEquals(modelInfo, details.getModelInfo());
- assertNotEquals(0, details.hashCode());
-
- List<SORelatedInstanceListElement> relatedInstanceList = new ArrayList<>();
- details.setRelatedInstanceList(relatedInstanceList);
- assertEquals(relatedInstanceList, details.getRelatedInstanceList());
- assertNotEquals(0, details.hashCode());
-
- SORequestInfo requestInfo = new SORequestInfo();
- details.setRequestInfo(requestInfo);
- assertEquals(requestInfo, details.getRequestInfo());
- assertNotEquals(0, details.hashCode());
-
- SORequestParameters requestParameters = new SORequestParameters();
- details.setRequestParameters(requestParameters);
- assertEquals(requestParameters, details.getRequestParameters());
- assertNotEquals(0, details.hashCode());
-
- SOSubscriberInfo subscriberInfo = new SOSubscriberInfo();
- details.setSubscriberInfo(subscriberInfo);
- assertEquals(subscriberInfo, details.getSubscriberInfo());
- assertNotEquals(0, details.hashCode());
-
- assertEquals("SORequestDetails [modelInfo=org.onap.policy.so", details.toString().substring(0, 46));
-
- SORequestDetails copiedDetails = new SORequestDetails(details);
+ @Test
+ public void testSoMRequestDetailsMethods() {
+ SORequestDetails details = new SORequestDetails();
+ assertNotNull(details);
+ assertNotEquals(0, details.hashCode());
+
+ SOCloudConfiguration cloudConfiguration = new SOCloudConfiguration();
+ details.setCloudConfiguration(cloudConfiguration);
+ assertEquals(cloudConfiguration, details.getCloudConfiguration());
+ assertNotEquals(0, details.hashCode());
+
+ SOModelInfo modelInfo = new SOModelInfo();
+ details.setModelInfo(modelInfo);
+ assertEquals(modelInfo, details.getModelInfo());
+ assertNotEquals(0, details.hashCode());
+
+ List<SORelatedInstanceListElement> relatedInstanceList = new ArrayList<>();
+ details.setRelatedInstanceList(relatedInstanceList);
+ assertEquals(relatedInstanceList, details.getRelatedInstanceList());
+ assertNotEquals(0, details.hashCode());
+
+ SORequestInfo requestInfo = new SORequestInfo();
+ details.setRequestInfo(requestInfo);
+ assertEquals(requestInfo, details.getRequestInfo());
+ assertNotEquals(0, details.hashCode());
+
+ SORequestParameters requestParameters = new SORequestParameters();
+ details.setRequestParameters(requestParameters);
+ assertEquals(requestParameters, details.getRequestParameters());
+ assertNotEquals(0, details.hashCode());
+
+ SOSubscriberInfo subscriberInfo = new SOSubscriberInfo();
+ details.setSubscriberInfo(subscriberInfo);
+ assertEquals(subscriberInfo, details.getSubscriberInfo());
+ assertNotEquals(0, details.hashCode());
+
+ assertEquals("SORequestDetails [modelInfo=org.onap.policy.so", details.toString().substring(0, 46));
+
+ SORequestDetails copiedDetails = new SORequestDetails(details);
assertTrue(details.equals(details));
assertTrue(details.equals(copiedDetails));
@@ -143,7 +143,7 @@ public class TestSoRequestDetails {
assertFalse(details.equals(copiedDetails));
copiedDetails.setRequestInfo(requestInfo);
assertTrue(details.equals(copiedDetails));
-
+
details.setRequestParameters(null);
assertFalse(details.equals(copiedDetails));
copiedDetails.setRequestParameters(null);
@@ -152,7 +152,7 @@ public class TestSoRequestDetails {
assertFalse(details.equals(copiedDetails));
copiedDetails.setRequestParameters(requestParameters);
assertTrue(details.equals(copiedDetails));
-
+
details.setSubscriberInfo(null);
assertFalse(details.equals(copiedDetails));
copiedDetails.setSubscriberInfo(null);
@@ -161,14 +161,14 @@ public class TestSoRequestDetails {
assertFalse(details.equals(copiedDetails));
copiedDetails.setSubscriberInfo(subscriberInfo);
assertTrue(details.equals(copiedDetails));
-
+
details.setRelatedInstanceList(null);
assertFalse(details.equals(copiedDetails));
- copiedDetails.setRelatedInstanceList(null);
+ copiedDetails.setRelatedInstanceList(null);
assertTrue(details.equals(copiedDetails));
details.setRelatedInstanceList(relatedInstanceList);
assertFalse(details.equals(copiedDetails));
- copiedDetails.setRelatedInstanceList(relatedInstanceList);
+ copiedDetails.setRelatedInstanceList(relatedInstanceList);
assertTrue(details.equals(copiedDetails));
- }
+ }
}
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoResponseWrapper.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoResponseWrapper.java
index 4f21630a2..d7ef9708d 100755
--- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoResponseWrapper.java
+++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoResponseWrapper.java
@@ -53,23 +53,23 @@ public class TestSoResponseWrapper {
obj.setRequestID("id2");
assertEquals("id2", obj.getRequestID());
}
-
- @Test
- public void testSOResponseWrapperMethods() {
- String requestID = UUID.randomUUID().toString();
- SOResponse response = new SOResponse();
-
- SOResponseWrapper responseWrapper = new SOResponseWrapper(response, requestID);
- assertNotNull(responseWrapper);
- assertNotEquals(0, responseWrapper.hashCode());
-
- assertEquals(response, responseWrapper.getSoResponse());
-
- assertNotEquals(0, responseWrapper.hashCode());
-
- assertEquals("SOResponseWrapper [SOResponse=org.onap.policy.", responseWrapper.toString().substring(0, 46));
-
- SOResponseWrapper identicalResponseWrapper = new SOResponseWrapper(response, requestID);
+
+ @Test
+ public void testSoResponseWrapperMethods() {
+ String requestId = UUID.randomUUID().toString();
+ SOResponse response = new SOResponse();
+
+ SOResponseWrapper responseWrapper = new SOResponseWrapper(response, requestId);
+ assertNotNull(responseWrapper);
+ assertNotEquals(0, responseWrapper.hashCode());
+
+ assertEquals(response, responseWrapper.getSoResponse());
+
+ assertNotEquals(0, responseWrapper.hashCode());
+
+ assertEquals("SOResponseWrapper [SOResponse=org.onap.policy.", responseWrapper.toString().substring(0, 46));
+
+ SOResponseWrapper identicalResponseWrapper = new SOResponseWrapper(response, requestId);
assertEquals(responseWrapper, responseWrapper);
assertEquals(responseWrapper, identicalResponseWrapper);
@@ -81,25 +81,25 @@ public class TestSoResponseWrapper {
assertEquals(new SOResponseWrapper(null, null), new SOResponseWrapper(null, null));
assertNotEquals(new SOResponseWrapper(null, null), identicalResponseWrapper);
- assertNotEquals(0, new SOResponseWrapper(null, null).hashCode());
+ assertNotEquals(0, new SOResponseWrapper(null, null).hashCode());
- identicalResponseWrapper.setSoResponse(new SOResponse());
+ identicalResponseWrapper.setSoResponse(new SOResponse());
assertNotEquals(responseWrapper, identicalResponseWrapper);
identicalResponseWrapper.setSoResponse(response);
assertEquals(responseWrapper, identicalResponseWrapper);
identicalResponseWrapper.setRequestID(UUID.randomUUID().toString());
assertNotEquals(responseWrapper, identicalResponseWrapper);
- identicalResponseWrapper.setRequestID(requestID);
+ identicalResponseWrapper.setRequestID(requestId);
assertEquals(responseWrapper, identicalResponseWrapper);
responseWrapper.setRequestID(null);
assertNotEquals(responseWrapper, identicalResponseWrapper);
identicalResponseWrapper.setRequestID(null);
assertEquals(responseWrapper, identicalResponseWrapper);
- responseWrapper.setRequestID(requestID);
+ responseWrapper.setRequestID(requestId);
assertNotEquals(responseWrapper, identicalResponseWrapper);
- identicalResponseWrapper.setRequestID(requestID);
+ identicalResponseWrapper.setRequestID(requestId);
assertEquals(responseWrapper, identicalResponseWrapper);
- }
+ }
}