diff options
author | vdmeer <sven.van.der.meer@ericsson.com> | 2018-01-18 12:50:32 +0000 |
---|---|---|
committer | vdmeer <sven.van.der.meer@ericsson.com> | 2018-01-18 13:44:16 +0000 |
commit | cef733a2902a600c1b4a95ef11b2f4ffc0fcbf99 (patch) | |
tree | 5eaaa6e26b3649d74fb8966cd303b8e8d9898271 /controlloop/common/model-impl/so/src/test | |
parent | bdf5640a2c68a0899363503dafa0f7cb1557e4a6 (diff) |
Fix Technical Debt, add Unit tests for SO
Converted to POJOs, fixed sona lint errors, added JUnit tests
POJOs now have only private members and getters/setters
This implicated actors, simulators, and existing tests
Issue-ID: POLICY-455
Change-Id: I4b80f729565e8675822a890892b15676908f73b4
Signed-off-by: vdmeer.sven <sven.van.der.meer@ericsson.com>
Diffstat (limited to 'controlloop/common/model-impl/so/src/test')
19 files changed, 1168 insertions, 126 deletions
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestDemo.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestDemo.java index 79f8d9392..1b2cb697a 100644 --- a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestDemo.java +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestDemo.java @@ -37,131 +37,150 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class TestDemo { - private static final Logger logger = LoggerFactory.getLogger(TestDemo.class); - @Test - public void test() { - - SORequest request = new SORequest(); - request.requestDetails = new SORequestDetails(); - request.requestDetails.modelInfo = new SOModelInfo(); - request.requestDetails.cloudConfiguration = new SOCloudConfiguration(); - request.requestDetails.requestInfo = new SORequestInfo(); - request.requestDetails.requestParameters = new SORequestParameters(); - - request.requestDetails.modelInfo.modelType = "vfModule"; - request.requestDetails.modelInfo.modelInvariantId = "ff5256d2-5a33-55df-13ab-12abad84e7ff"; - request.requestDetails.modelInfo.modelVersionId = "fe6478e5-ea33-3346-ac12-ab121484a3fe"; - request.requestDetails.modelInfo.modelName = "vSAMP12..base..module-0"; - request.requestDetails.modelInfo.modelVersion = "1"; - - request.requestDetails.cloudConfiguration.lcpCloudRegionId = "mdt1"; - request.requestDetails.cloudConfiguration.tenantId = "88a6ca3ee0394ade9403f075db23167e"; - - request.requestDetails.requestInfo.instanceName = "SOTEST103a-vSAMP12_base_module-0"; - request.requestDetails.requestInfo.source = "VID"; - request.requestDetails.requestInfo.suppressRollback = true; - - SORelatedInstanceListElement relatedInstanceListElement1 = new SORelatedInstanceListElement(); - SORelatedInstanceListElement relatedInstanceListElement2 = new SORelatedInstanceListElement(); - SORelatedInstanceListElement relatedInstanceListElement3 = new SORelatedInstanceListElement(); - relatedInstanceListElement1.relatedInstance = new SORelatedInstance(); - relatedInstanceListElement2.relatedInstance = new SORelatedInstance(); - relatedInstanceListElement3.relatedInstance = new SORelatedInstance(); - - relatedInstanceListElement1.relatedInstance.instanceId = "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c"; - relatedInstanceListElement1.relatedInstance.instanceName = "SOTESTVOL103a-vSAMP12_base_module-0_vol"; - relatedInstanceListElement1.relatedInstance.modelInfo = new SOModelInfo(); - relatedInstanceListElement1.relatedInstance.modelInfo.modelType = "volumeGroup"; - - relatedInstanceListElement2.relatedInstance.instanceId = "serviceInstanceId"; - relatedInstanceListElement2.relatedInstance.modelInfo = new SOModelInfo(); - relatedInstanceListElement2.relatedInstance.modelInfo.modelType = "service"; - relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = "ff3514e3-5a33-55df-13ab-12abad84e7ff"; - relatedInstanceListElement2.relatedInstance.modelInfo.modelVersionId = "fe6985cd-ea33-3346-ac12-ab121484a3fe"; - relatedInstanceListElement2.relatedInstance.modelInfo.modelName = "parent service model name"; - relatedInstanceListElement2.relatedInstance.modelInfo.modelVersion = "1.0"; - - relatedInstanceListElement3.relatedInstance.instanceId = "vnfInstanceId"; - relatedInstanceListElement3.relatedInstance.modelInfo = new SOModelInfo(); - relatedInstanceListElement3.relatedInstance.modelInfo.modelType = "vnf"; - relatedInstanceListElement3.relatedInstance.modelInfo.modelInvariantId = "ff5256d1-5a33-55df-13ab-12abad84e7ff"; - relatedInstanceListElement3.relatedInstance.modelInfo.modelVersionId = "fe6478e4-ea33-3346-ac12-ab121484a3fe"; - relatedInstanceListElement3.relatedInstance.modelInfo.modelName = "vSAMP12"; - relatedInstanceListElement3.relatedInstance.modelInfo.modelVersion = "1.0"; - relatedInstanceListElement3.relatedInstance.modelInfo.modelCustomizationName = "vSAMP12 1"; - - request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1); - request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2); - request.requestDetails.relatedInstanceList.add(relatedInstanceListElement3); - - Map<String, String> userParam1 = new HashMap<>(); - userParam1.put("name1", "value1"); - - Map<String, String> userParam2 = new HashMap<>(); - userParam2.put("name2", "value2"); - - request.requestDetails.requestParameters.userParams.add(userParam1); - request.requestDetails.requestParameters.userParams.add(userParam2); - - logger.debug(Serialization.gsonPretty.toJson(request)); - - } - - @Test - public void testHack() { - - logger.debug("** HACK **"); - - SORequest request = new SORequest(); - // - request.requestDetails = new SORequestDetails(); - request.requestDetails.modelInfo = new SOModelInfo(); - request.requestDetails.cloudConfiguration = new SOCloudConfiguration(); - request.requestDetails.requestInfo = new SORequestInfo(); - request.requestDetails.requestParameters = new SORequestParameters(); - request.requestDetails.requestParameters.userParams = null; - - request.requestDetails.modelInfo.modelType = "vfModule"; - request.requestDetails.modelInfo.modelInvariantId = "a9c4a35a-de48-451a-9e4e-343f2ac52928"; - request.requestDetails.modelInfo.modelVersionId = "e0d98ad1-238d-4555-b439-023d3f9079f6"; - request.requestDetails.modelInfo.modelName = "0d9e0d9d352749f4B3cb..dnsscaling..module-0"; - request.requestDetails.modelInfo.modelVersion = "2.0"; - - request.requestDetails.cloudConfiguration.lcpCloudRegionId = "DFW"; - request.requestDetails.cloudConfiguration.tenantId = "1015548"; - - request.requestDetails.requestInfo.instanceName = "Vfmodule_Ete_Name1eScaling63928f-ccdc-4b34-bdef-9bf64109026e"; - request.requestDetails.requestInfo.source = "POLICY"; - request.requestDetails.requestInfo.suppressRollback = false; - - SORelatedInstanceListElement relatedInstanceListElement1 = new SORelatedInstanceListElement(); - SORelatedInstanceListElement relatedInstanceListElement2 = new SORelatedInstanceListElement(); - relatedInstanceListElement1.relatedInstance = new SORelatedInstance(); - relatedInstanceListElement2.relatedInstance = new SORelatedInstance(); - - String serviceInstanceId = "98af39ce-6408-466b-921f-c2c7a8f59ed6"; - relatedInstanceListElement1.relatedInstance.instanceId = serviceInstanceId; - relatedInstanceListElement1.relatedInstance.modelInfo = new SOModelInfo(); - relatedInstanceListElement1.relatedInstance.modelInfo.modelType = "service"; - relatedInstanceListElement1.relatedInstance.modelInfo.modelInvariantId = "24329a0c-1d57-4210-b1af-a65df64e9d59"; - relatedInstanceListElement1.relatedInstance.modelInfo.modelVersionId = "ac642881-8e7e-4217-bd64-16ad41c42e30"; - relatedInstanceListElement1.relatedInstance.modelInfo.modelName = "5116d67e-0b4f-46bf-a46f"; - relatedInstanceListElement1.relatedInstance.modelInfo.modelVersion = "2.0"; - - String vnfInstanceId = "8eb411b8-a936-412f-b01f-9a9a435c0e93"; - relatedInstanceListElement2.relatedInstance.instanceId = vnfInstanceId; - relatedInstanceListElement2.relatedInstance.modelInfo = new SOModelInfo(); - relatedInstanceListElement2.relatedInstance.modelInfo.modelType = "vnf"; - relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = "09fd971e-db5f-475d-997c-cf6704b6b8fe"; - relatedInstanceListElement2.relatedInstance.modelInfo.modelVersionId = "152ed917-6dcc-46ee-bf8a-a775c5aa5a74"; - relatedInstanceListElement2.relatedInstance.modelInfo.modelName = "9e4c31d2-4b25-4d9e-9fb4"; - relatedInstanceListElement2.relatedInstance.modelInfo.modelVersion = "2.0"; - relatedInstanceListElement2.relatedInstance.modelInfo.modelCustomizationName = "0d9e0d9d-3527-49f4-b3cb 2"; - - request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1); - request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2); - - logger.debug(Serialization.gsonPretty.toJson(request)); - } + private static final Logger logger = LoggerFactory.getLogger(TestDemo.class); + + @Test + public void test() { + + SORequest request = new SORequest(); + request.setRequestDetails(new SORequestDetails()); + request.getRequestDetails().setModelInfo(new SOModelInfo()); + request.getRequestDetails().setCloudConfiguration(new SOCloudConfiguration()); + request.getRequestDetails().setRequestInfo(new SORequestInfo()); + request.getRequestDetails().setRequestParameters(new SORequestParameters()); + + request.getRequestDetails().getModelInfo().setModelType("vfModule"); + request.getRequestDetails().getModelInfo().setModelInvariantId("ff5256d2-5a33-55df-13ab-12abad84e7ff"); + request.getRequestDetails().getModelInfo().setModelVersionId("fe6478e5-ea33-3346-ac12-ab121484a3fe"); + request.getRequestDetails().getModelInfo().setModelName("vSAMP12..base..module-0"); + request.getRequestDetails().getModelInfo().setModelVersion("1"); + + request.getRequestDetails().getCloudConfiguration().setLcpCloudRegionId("mdt1"); + request.getRequestDetails().getCloudConfiguration().setTenantId("88a6ca3ee0394ade9403f075db23167e"); + + request.getRequestDetails().getRequestInfo().setInstanceName("SOTEST103a-vSAMP12_base_module-0"); + request.getRequestDetails().getRequestInfo().setSource("VID"); + request.getRequestDetails().getRequestInfo().setSuppressRollback(true); + + SORelatedInstanceListElement relatedInstanceListElement1 = + new SORelatedInstanceListElement(); + SORelatedInstanceListElement relatedInstanceListElement2 = + new SORelatedInstanceListElement(); + SORelatedInstanceListElement relatedInstanceListElement3 = + new SORelatedInstanceListElement(); + relatedInstanceListElement1.setRelatedInstance(new SORelatedInstance()); + relatedInstanceListElement2.setRelatedInstance(new SORelatedInstance()); + relatedInstanceListElement3.setRelatedInstance(new SORelatedInstance()); + + relatedInstanceListElement1.getRelatedInstance().setInstanceId( + "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c"); + relatedInstanceListElement1.getRelatedInstance().setInstanceName( + "SOTESTVOL103a-vSAMP12_base_module-0_vol"); + relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SOModelInfo()); + relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelType("volumeGroup"); + + relatedInstanceListElement2.getRelatedInstance().setInstanceId("serviceInstanceId"); + relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SOModelInfo()); + relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelType("service"); + relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelInvariantId( + "ff3514e3-5a33-55df-13ab-12abad84e7ff"); + relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelVersionId( + "fe6985cd-ea33-3346-ac12-ab121484a3fe"); + relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelName( + "parent service model name"); + relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelVersion("1.0"); + + relatedInstanceListElement3.getRelatedInstance().setInstanceId("vnfInstanceId"); + relatedInstanceListElement3.getRelatedInstance().setModelInfo(new SOModelInfo()); + relatedInstanceListElement3.getRelatedInstance().getModelInfo().setModelType("vnf"); + relatedInstanceListElement3.getRelatedInstance().getModelInfo().setModelInvariantId( + "ff5256d1-5a33-55df-13ab-12abad84e7ff"); + relatedInstanceListElement3.getRelatedInstance().getModelInfo().setModelVersionId( + "fe6478e4-ea33-3346-ac12-ab121484a3fe"); + relatedInstanceListElement3.getRelatedInstance().getModelInfo().setModelName("vSAMP12"); + relatedInstanceListElement3.getRelatedInstance().getModelInfo().setModelVersion("1.0"); + relatedInstanceListElement3.getRelatedInstance().getModelInfo().setModelCustomizationName("vSAMP12 1"); + + request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement1); + request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement2); + request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement3); + + Map<String, String> userParam1 = new HashMap<>(); + userParam1.put("name1", "value1"); + + Map<String, String> userParam2 = new HashMap<>(); + userParam2.put("name2", "value2"); + + request.getRequestDetails().getRequestParameters().getUserParams().add(userParam1); + request.getRequestDetails().getRequestParameters().getUserParams().add(userParam2); + + logger.debug(Serialization.gsonPretty.toJson(request)); + + } + + @Test + public void testHack() { + + logger.debug("** HACK **"); + + SORequest request = new SORequest(); + + request.setRequestDetails(new SORequestDetails()); + request.getRequestDetails().setModelInfo(new SOModelInfo()); + request.getRequestDetails().setCloudConfiguration(new SOCloudConfiguration()); + request.getRequestDetails().setRequestInfo(new SORequestInfo()); + request.getRequestDetails().setRequestParameters(new SORequestParameters()); + request.getRequestDetails().getRequestParameters().setUserParams(null); + + request.getRequestDetails().getModelInfo().setModelType("vfModule"); + request.getRequestDetails().getModelInfo().setModelInvariantId("a9c4a35a-de48-451a-9e4e-343f2ac52928"); + request.getRequestDetails().getModelInfo().setModelVersionId("e0d98ad1-238d-4555-b439-023d3f9079f6"); + request.getRequestDetails().getModelInfo().setModelName("0d9e0d9d352749f4B3cb..dnsscaling..module-0"); + request.getRequestDetails().getModelInfo().setModelVersion("2.0"); + + request.getRequestDetails().getCloudConfiguration().setLcpCloudRegionId("DFW"); + request.getRequestDetails().getCloudConfiguration().setTenantId("1015548"); + + request.getRequestDetails().getRequestInfo().setInstanceName( + "Vfmodule_Ete_Name1eScaling63928f-ccdc-4b34-bdef-9bf64109026e"); + request.getRequestDetails().getRequestInfo().setSource("POLICY"); + request.getRequestDetails().getRequestInfo().setSuppressRollback(false); + + SORelatedInstanceListElement relatedInstanceListElement1 = + new SORelatedInstanceListElement(); + SORelatedInstanceListElement relatedInstanceListElement2 = + new SORelatedInstanceListElement(); + relatedInstanceListElement1.setRelatedInstance(new SORelatedInstance()); + relatedInstanceListElement2.setRelatedInstance(new SORelatedInstance()); + + String serviceInstanceId = "98af39ce-6408-466b-921f-c2c7a8f59ed6"; + relatedInstanceListElement1.getRelatedInstance().setInstanceId(serviceInstanceId); + relatedInstanceListElement1.getRelatedInstance().setModelInfo(new SOModelInfo()); + relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelType("service"); + relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelInvariantId( + "24329a0c-1d57-4210-b1af-a65df64e9d59"); + relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelVersionId( + "ac642881-8e7e-4217-bd64-16ad41c42e30"); + relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelName("5116d67e-0b4f-46bf-a46f"); + relatedInstanceListElement1.getRelatedInstance().getModelInfo().setModelVersion("2.0"); + + String vnfInstanceId = "8eb411b8-a936-412f-b01f-9a9a435c0e93"; + relatedInstanceListElement2.getRelatedInstance().setInstanceId(vnfInstanceId); + relatedInstanceListElement2.getRelatedInstance().setModelInfo(new SOModelInfo()); + relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelType("vnf"); + relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelInvariantId( + "09fd971e-db5f-475d-997c-cf6704b6b8fe"); + relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelVersionId( + "152ed917-6dcc-46ee-bf8a-a775c5aa5a74"); + relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelName("9e4c31d2-4b25-4d9e-9fb4"); + relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelVersion("2.0"); + relatedInstanceListElement2.getRelatedInstance().getModelInfo().setModelCustomizationName( + "0d9e0d9d-3527-49f4-b3cb 2"); + + request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement1); + request.getRequestDetails().getRelatedInstanceList().add(relatedInstanceListElement2); + + logger.debug(Serialization.gsonPretty.toJson(request)); + } } diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoAsyncRequestStatus.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoAsyncRequestStatus.java new file mode 100755 index 000000000..119c29121 --- /dev/null +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoAsyncRequestStatus.java @@ -0,0 +1,78 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ *
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.time.LocalDateTime;
+
+import org.junit.Test;
+
+public class TestSoAsyncRequestStatus {
+
+ @Test
+ public void testConstructor() {
+ SOAsyncRequestStatus obj = new SOAsyncRequestStatus();
+
+ assertTrue(obj.getCorrelator() == null);
+ assertTrue(obj.getFinishTime() == null);
+ assertTrue(obj.getInstanceReferences() == null);
+ assertTrue(obj.getRequestId() == null);
+ assertTrue(obj.getRequestScope() == null);
+ assertTrue(obj.getRequestStatus() == null);
+ assertTrue(obj.getStartTime() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SOAsyncRequestStatus obj = new SOAsyncRequestStatus();
+
+ obj.setCorrelator("correlator");
+ assertEquals("correlator", obj.getCorrelator());
+
+ LocalDateTime finishTime = LocalDateTime.now();
+ obj.setFinishTime(finishTime);
+ assertEquals(finishTime, obj.getFinishTime());
+
+ SOInstanceReferences instanceReferences = new SOInstanceReferences();
+ obj.setInstanceReferences(instanceReferences);
+ assertEquals(instanceReferences, obj.getInstanceReferences());
+
+ obj.setRequestId("requestId");
+ assertEquals("requestId", obj.getRequestId());
+
+ obj.setRequestScope("requestScope");
+ assertEquals("requestScope", obj.getRequestScope());
+
+ SORequestStatus requestStatus = new SORequestStatus();
+ obj.setRequestStatus(requestStatus);
+ assertEquals(requestStatus, obj.getRequestStatus());
+
+ obj.setRequestType("requestType");
+ assertEquals("requestType", obj.getRequestType());
+
+ LocalDateTime startTime = LocalDateTime.now();
+ obj.setStartTime(startTime);
+ assertEquals(startTime, obj.getStartTime());
+
+ }
+}
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoCloudConfiguration.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoCloudConfiguration.java new file mode 100755 index 000000000..f05912985 --- /dev/null +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoCloudConfiguration.java @@ -0,0 +1,48 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ *
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class TestSoCloudConfiguration {
+
+ @Test
+ public void testConstructor() {
+ SOCloudConfiguration obj = new SOCloudConfiguration();
+
+ assertTrue(obj.getLcpCloudRegionId() == null);
+ assertTrue(obj.getTenantId() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SOCloudConfiguration obj = new SOCloudConfiguration();
+
+ obj.setLcpCloudRegionId("lcpCloudRegionId");
+ assertEquals("lcpCloudRegionId", obj.getLcpCloudRegionId());
+
+ obj.setTenantId("tenantId");
+ assertEquals("tenantId", obj.getTenantId());
+ }
+}
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoInstanceReferences.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoInstanceReferences.java new file mode 100755 index 000000000..8c63e9c65 --- /dev/null +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoInstanceReferences.java @@ -0,0 +1,48 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ *
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class TestSoInstanceReferences {
+
+ @Test
+ public void testConstructor() {
+ SOInstanceReferences obj = new SOInstanceReferences();
+
+ assertTrue(obj.getInstanceId() == null);
+ assertTrue(obj.getRequestId() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SOInstanceReferences obj = new SOInstanceReferences();
+
+ obj.setInstanceId("instanceId");
+ assertEquals("instanceId", obj.getInstanceId());
+
+ obj.setRequestId("requestId");
+ assertEquals("requestId", obj.getRequestId());
+ }
+}
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoModelInfo.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoModelInfo.java new file mode 100755 index 000000000..99f829fc7 --- /dev/null +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoModelInfo.java @@ -0,0 +1,69 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ *
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class TestSoModelInfo {
+
+ @Test
+ public void testConstructor() {
+ SOModelInfo obj = new SOModelInfo();
+
+ assertTrue(obj.getModelCustomizationId() == null);
+ assertTrue(obj.getModelCustomizationName() == null);
+ assertTrue(obj.getModelInvariantId() == null);
+ assertTrue(obj.getModelName() == null);
+ assertTrue(obj.getModelType() == null);
+ assertTrue(obj.getModelVersion() == null);
+ assertTrue(obj.getModelVersionId() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SOModelInfo obj = new SOModelInfo();
+
+ obj.setModelCustomizationId("modelCustomizationId");
+ assertEquals("modelCustomizationId", obj.getModelCustomizationId());
+
+ obj.setModelCustomizationName("modelCustomizationName");
+ assertEquals("modelCustomizationName", obj.getModelCustomizationName());
+
+ obj.setModelInvariantId("modelInvariantId");
+ assertEquals("modelInvariantId", obj.getModelInvariantId());
+
+ obj.setModelName("modelName");
+ assertEquals("modelName", obj.getModelName());
+
+ obj.setModelType("modelType");
+ assertEquals("modelType", obj.getModelType());
+
+ obj.setModelVersion("modelVersion");
+ assertEquals("modelVersion", obj.getModelVersion());
+
+ obj.setModelVersionId("modelVersionId");
+ assertEquals("modelVersionId", obj.getModelVersionId());
+
+ }
+}
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoPolicyException.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoPolicyException.java new file mode 100755 index 000000000..b2ba7f4d0 --- /dev/null +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoPolicyException.java @@ -0,0 +1,48 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class TestSoPolicyException {
+
+ @Test
+ public void testConstructor() {
+ SOPolicyException obj = new SOPolicyException();
+
+ assertTrue(obj.getMessageId() == null);
+ assertTrue(obj.getText() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SOPolicyException obj = new SOPolicyException();
+
+ obj.setMessageId("messageId");
+ assertEquals("messageId", obj.getMessageId());
+
+ obj.setText("text");
+ assertEquals("text", obj.getText());
+ }
+}
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRelatedInstance.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRelatedInstance.java new file mode 100755 index 000000000..a8e94b8e2 --- /dev/null +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRelatedInstance.java @@ -0,0 +1,53 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ * Copyright (C) 2017 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.
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class TestSoRelatedInstance {
+
+ @Test
+ public void testConstructor() {
+ SORelatedInstance obj = new SORelatedInstance();
+
+ assertTrue(obj.getInstanceId() == null);
+ assertTrue(obj.getInstanceName() == null);
+ assertTrue(obj.getModelInfo() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SORelatedInstance obj = new SORelatedInstance();
+
+ obj.setInstanceId("instanceId");
+ assertEquals("instanceId", obj.getInstanceId());
+
+ obj.setInstanceName("instanceName");
+ assertEquals("instanceName", obj.getInstanceName());
+
+ SOModelInfo modelInfo = new SOModelInfo();
+ obj.setModelInfo(modelInfo);
+ assertEquals(modelInfo, obj.getModelInfo());
+ }
+}
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRelatedInstanceListElement.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRelatedInstanceListElement.java new file mode 100755 index 000000000..17abd06e3 --- /dev/null +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRelatedInstanceListElement.java @@ -0,0 +1,45 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ *
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class TestSoRelatedInstanceListElement {
+
+ @Test
+ public void testConstructor() {
+ SORelatedInstanceListElement obj = new SORelatedInstanceListElement();
+
+ assertTrue(obj.getRelatedInstance() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SORelatedInstanceListElement obj = new SORelatedInstanceListElement();
+
+ SORelatedInstance relatedInstance = new SORelatedInstance();
+ obj.setRelatedInstance(relatedInstance);
+ assertEquals(relatedInstance, obj.getRelatedInstance());
+ }
+}
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequest.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequest.java new file mode 100755 index 000000000..229765a72 --- /dev/null +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequest.java @@ -0,0 +1,72 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ *
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.time.LocalDateTime;
+import java.util.UUID;
+
+import org.junit.Test;
+
+public class TestSoRequest {
+
+ @Test
+ public void testConstructor() {
+ SORequest obj = new SORequest();
+
+ assertTrue(obj.getFinishTime() == null);
+ assertTrue(obj.getRequestDetails() == null);
+ assertTrue(obj.getRequestId() == null);
+ assertTrue(obj.getRequestScope() == null);
+ assertTrue(obj.getRequestStatus() == null);
+ assertTrue(obj.getRequestType() == null);
+ assertTrue(obj.getStartTime() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SORequest obj = new SORequest();
+
+ LocalDateTime finishTime = LocalDateTime.now();
+ obj.setFinishTime(finishTime);
+ assertEquals(finishTime, obj.getFinishTime());
+
+ UUID uuid = UUID.randomUUID();
+ obj.setRequestId(uuid);
+ assertEquals(uuid, obj.getRequestId());
+
+ obj.setRequestScope("requestScope");
+ assertEquals("requestScope", obj.getRequestScope());
+
+ SORequestStatus requestStatus = new SORequestStatus();
+ obj.setRequestStatus(requestStatus);
+ assertEquals(requestStatus, obj.getRequestStatus());
+
+ obj.setRequestType("requestType");
+ assertEquals("requestType", obj.getRequestType());
+
+ LocalDateTime startTime = LocalDateTime.now();
+ obj.setStartTime(startTime.toString());
+ assertEquals(startTime.toString(), obj.getStartTime());
+ }
+}
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 new file mode 100755 index 000000000..5c3c1a411 --- /dev/null +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestDetails.java @@ -0,0 +1,68 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ *
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class TestSoRequestDetails {
+
+ @Test
+ public void testConstructor() {
+ SORequestDetails obj = new SORequestDetails();
+
+ assertTrue(obj.getCloudConfiguration() == null);
+ assertTrue(obj.getModelInfo() == null);
+ assertTrue(obj.getRequestInfo() == null);
+ assertTrue(obj.getRequestParameters() == null);
+ assertTrue(obj.getSubscriberInfo() == null);
+
+ assertTrue(obj.getRelatedInstanceList() != null);
+ assertEquals(0, obj.getRelatedInstanceList().size());
+ }
+
+ @Test
+ public void testSetGet() {
+ SORequestDetails obj = new SORequestDetails();
+
+ SOCloudConfiguration cloudConfiguration = new SOCloudConfiguration();
+ obj.setCloudConfiguration(cloudConfiguration);
+ assertEquals(cloudConfiguration, obj.getCloudConfiguration());
+
+ SOModelInfo modelInfo = new SOModelInfo();
+ obj.setModelInfo(modelInfo);
+ assertEquals(modelInfo, obj.getModelInfo());
+
+ SORequestInfo requestInfo = new SORequestInfo();
+ obj.setRequestInfo(requestInfo);
+ assertEquals(requestInfo, obj.getRequestInfo());
+
+ SORequestParameters requestParameters = new SORequestParameters();
+ obj.setRequestParameters(requestParameters);
+ assertEquals(requestParameters, obj.getRequestParameters());
+
+ SOSubscriberInfo subscriberInfo = new SOSubscriberInfo();
+ obj.setSubscriberInfo(subscriberInfo);
+ assertEquals(subscriberInfo, obj.getSubscriberInfo());
+ }
+}
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestError.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestError.java new file mode 100755 index 000000000..31f3b6c54 --- /dev/null +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestError.java @@ -0,0 +1,50 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ *
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class TestSoRequestError {
+
+ @Test
+ public void testConstructor() {
+ SORequestError obj = new SORequestError();
+
+ assertTrue(obj.getPolicyException() == null);
+ assertTrue(obj.getServiceException() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SORequestError obj = new SORequestError();
+
+ SOPolicyException policyException = new SOPolicyException();
+ obj.setPolicyException(policyException);
+ assertEquals(policyException, obj.getPolicyException());
+
+ SOServiceException serviceException = new SOServiceException();
+ obj.setServiceException(serviceException);
+ assertEquals(serviceException, obj.getServiceException());
+ }
+}
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestInfo.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestInfo.java new file mode 100755 index 000000000..d1b7f247c --- /dev/null +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestInfo.java @@ -0,0 +1,81 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ *
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class TestSoRequestInfo {
+
+ @Test
+ public void testConstructor() {
+ SORequestInfo obj = new SORequestInfo();
+
+ assertTrue(obj.getBillingAccountNumber() == null);
+ assertTrue(obj.getCallbackUrl() == null);
+ assertTrue(obj.getCorrelator() == null);
+ assertTrue(obj.getInstanceName() == null);
+ assertTrue(obj.getOrderNumber() == null);
+ assertTrue(obj.getOrderVersion() == null);
+ assertTrue(obj.getProductFamilyId() == null);
+ assertTrue(obj.getRequestorId() == null);
+ assertTrue(obj.getSource() == null);
+ assertTrue(obj.isSuppressRollback() == false);
+ }
+
+ @Test
+ public void testSetGet() {
+ SORequestInfo obj = new SORequestInfo();
+
+ obj.setBillingAccountNumber("billingAccountNumber");
+ assertEquals("billingAccountNumber", obj.getBillingAccountNumber());
+
+ obj.setCallbackUrl("callbackUrl");
+ assertEquals("callbackUrl", obj.getCallbackUrl());
+
+ obj.setCorrelator("correlator");
+ assertEquals("correlator", obj.getCorrelator());
+
+ obj.setInstanceName("instanceName");
+ assertEquals("instanceName", obj.getInstanceName());
+
+ obj.setOrderNumber("orderNumber");
+ assertEquals("orderNumber", obj.getOrderNumber());
+
+ int orderVersion = 2008;
+ obj.setOrderVersion(orderVersion);
+ assertEquals((Integer) orderVersion, obj.getOrderVersion());
+
+ obj.setProductFamilyId("productFamilyId");
+ assertEquals("productFamilyId", obj.getProductFamilyId());
+
+ obj.setRequestorId("requestorId");
+ assertEquals("requestorId", obj.getRequestorId());
+
+ obj.setSource("source");
+ assertEquals("source", obj.getSource());
+
+ obj.setSuppressRollback(true);
+ assertEquals(true, obj.isSuppressRollback());
+ }
+}
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestParameters.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestParameters.java new file mode 100755 index 000000000..cb32be531 --- /dev/null +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestParameters.java @@ -0,0 +1,46 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ *
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class TestSoRequestParameters {
+
+ @Test
+ public void testConstructor() {
+ SORequestParameters obj = new SORequestParameters();
+
+ assertTrue(obj.getSubscriptionServiceType() == null);
+ assertTrue(obj.getUserParams() != null);
+ assertEquals(0, obj.getUserParams().size());
+ }
+
+ @Test
+ public void testSetGet() {
+ SORequestParameters obj = new SORequestParameters();
+
+ obj.setSubscriptionServiceType("subscriptionServiceType");
+ assertEquals("subscriptionServiceType", obj.getSubscriptionServiceType());
+ }
+}
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestReferences.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestReferences.java new file mode 100755 index 000000000..e212ba1c3 --- /dev/null +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestReferences.java @@ -0,0 +1,48 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ *
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class TestSoRequestReferences {
+
+ @Test
+ public void testConstructor() {
+ SORequestReferences obj = new SORequestReferences();
+
+ assertTrue(obj.getInstanceId() == null);
+ assertTrue(obj.getRequestId() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SORequestReferences obj = new SORequestReferences();
+
+ obj.setInstanceId("instanceId");
+ assertEquals("instanceId", obj.getInstanceId());
+
+ obj.setRequestId("requestId");
+ assertEquals("requestId", obj.getRequestId());
+ }
+}
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestStatus.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestStatus.java new file mode 100755 index 000000000..9fa0b9741 --- /dev/null +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoRequestStatus.java @@ -0,0 +1,57 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ *
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class TestSoRequestStatus {
+
+ @Test
+ public void testConstructor() {
+ SORequestStatus obj = new SORequestStatus();
+
+ assertEquals(0, obj.getPercentProgress());
+ assertTrue(obj.getRequestState() == null);
+ assertTrue(obj.getTimestamp() == null);
+ assertFalse(obj.isWasRolledBack());
+ }
+
+ @Test
+ public void testSetGet() {
+ SORequestStatus obj = new SORequestStatus();
+
+ obj.setPercentProgress(2008);
+ assertEquals(2008, obj.getPercentProgress());
+
+ obj.setRequestState("requestState");
+ assertEquals("requestState", obj.getRequestState());
+
+ obj.setTimestamp("timestamp");
+ assertEquals("timestamp", obj.getTimestamp());
+
+ obj.setWasRolledBack(true);
+ assertTrue(obj.isWasRolledBack());
+ }
+}
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoResponse.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoResponse.java new file mode 100755 index 000000000..edac2fa0d --- /dev/null +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoResponse.java @@ -0,0 +1,59 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ *
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class TestSoResponse {
+
+ @Test
+ public void testConstructor() {
+ SOResponse obj = new SOResponse();
+
+ assertEquals(0, obj.getHttpResponseCode());
+ assertTrue(obj.getRequest() == null);
+ assertTrue(obj.getRequestError() == null);
+ assertTrue(obj.getRequestReferences() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SOResponse obj = new SOResponse();
+
+ obj.setHttpResponseCode(2008);
+ assertEquals(2008, obj.getHttpResponseCode());
+
+ SORequest request = new SORequest();
+ obj.setRequest(request);
+ assertEquals(request, obj.getRequest());
+
+ SORequestError requestError = new SORequestError();
+ obj.setRequestError(requestError);
+ assertEquals(requestError, obj.getRequestError());
+
+ SORequestReferences requestReferences = new SORequestReferences();
+ obj.setRequestReferences(requestReferences);
+ assertEquals(requestReferences, obj.getRequestReferences());
+ }
+}
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 new file mode 100755 index 000000000..93549a21d --- /dev/null +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoResponseWrapper.java @@ -0,0 +1,51 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ *
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class TestSoResponseWrapper {
+
+ @Test
+ public void testConstructor() {
+ SOResponse response = new SOResponse();
+ SOResponseWrapper obj = new SOResponseWrapper(response, "reqID");
+
+ assertEquals(response, obj.getSoResponse());
+ assertEquals("reqID", obj.getRequestID());
+ }
+
+ @Test
+ public void testSetGet() {
+ SOResponse response = new SOResponse();
+ SOResponseWrapper obj = new SOResponseWrapper(response, "reqID");
+
+ SOResponse response2 = new SOResponse();
+ response2.setHttpResponseCode(2008);
+ obj.setSoResponse(response2);
+ assertEquals(response2, obj.getSoResponse());
+
+ obj.setRequestID("id2");
+ assertEquals("id2", obj.getRequestID());
+ }
+}
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoServiceException.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoServiceException.java new file mode 100755 index 000000000..cae8d1955 --- /dev/null +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoServiceException.java @@ -0,0 +1,50 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ *
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class TestSoServiceException {
+
+ @Test
+ public void testConstructor() {
+ SOServiceException obj = new SOServiceException();
+
+ assertTrue(obj.getMessageId() == null);
+ assertTrue(obj.getText() == null);
+ assertTrue(obj.getVariables() != null);
+ assertEquals(0, obj.getVariables().size());
+ }
+
+ @Test
+ public void testSetGet() {
+ SOServiceException obj = new SOServiceException();
+
+ obj.setMessageId("messageId");
+ assertEquals("messageId", obj.getMessageId());
+
+ obj.setText("text");
+ assertEquals("text", obj.getText());
+ }
+}
diff --git a/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoSubscriberInfo.java b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoSubscriberInfo.java new file mode 100755 index 000000000..0bff38c5c --- /dev/null +++ b/controlloop/common/model-impl/so/src/test/java/org/onap/policy/so/TestSoSubscriberInfo.java @@ -0,0 +1,52 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * so
+ * ================================================================================
+ *
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.so;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class TestSoSubscriberInfo {
+
+ @Test
+ public void testConstructor() {
+ SOSubscriberInfo obj = new SOSubscriberInfo();
+
+ assertTrue(obj.getGlobalSubscriberId() == null);
+ assertTrue(obj.getSubscriberCommonSiteId() == null);
+ assertTrue(obj.getSubscriberName() == null);
+ }
+
+ @Test
+ public void testSetGet() {
+ SOSubscriberInfo obj = new SOSubscriberInfo();
+
+ obj.setGlobalSubscriberId("globalSubscriberId");
+ assertEquals("globalSubscriberId", obj.getGlobalSubscriberId());
+
+ obj.setSubscriberCommonSiteId("subscriberCommonSiteId");
+ assertEquals("subscriberCommonSiteId", obj.getSubscriberCommonSiteId());
+
+ obj.setSubscriberName("subscriberName");
+ assertEquals("subscriberName", obj.getSubscriberName());
+ }
+}
|