aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAS00465059 <AS00465059@techmahindra.com>2018-03-12 15:36:35 +0530
committerAS00465059 <AS00465059@techmahindra.com>2018-03-12 15:36:35 +0530
commitab1c6bacd10f5f0f04f191639df94b79b5c98100 (patch)
tree94fdbc87fbb094cb351fe0a9d728bdbe8ca928fe
parent4370cf4eefb3de99b5eff870f90637931e9759e1 (diff)
Adding Junit
Junit for: 1.SDNCServiceError.java 2.SDNCServiceRequest.java 3.SDNCServiceResponse.java 4.ServiceInformation.java Sonar Link: https://sonar.onap.org/code?id=org.onap.so%3Aso&selected=org.onap.so.adapters%3Amso-adapters-rest-interface%3Asrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fmso%2Fadapters%2Fsdncrest Change-Id: I2a4216c509cf0164ad669d391c9af0bbe6a80f25 Issue-ID: SO-470 Signed-off-by: AS00465059 <AS00465059@techmahindra.com>
-rw-r--r--adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceErrorTest.java51
-rw-r--r--adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequestTest.java79
-rw-r--r--adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponseTest.java58
-rw-r--r--adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/ServiceInformationTest.java42
4 files changed, 230 insertions, 0 deletions
diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceErrorTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceErrorTest.java
new file mode 100644
index 0000000000..df69b377ca
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceErrorTest.java
@@ -0,0 +1,51 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.openecomp.mso.adapters.sdncrest;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.openecomp.mso.adapters.sdncrest.SDNCErrorCommon;
+import org.openecomp.mso.adapters.sdncrest.SDNCServiceError;
+
+public class SDNCServiceErrorTest {
+
+ @Mock
+ SDNCErrorCommon sec;
+
+ @InjectMocks
+ SDNCServiceError ssc;
+
+ @Before
+ public void init(){
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void testSDNCServiceError() {
+
+ ssc= new SDNCServiceError("id", "200",
+ "msg", "indicator");
+ assert(ssc!=null);
+ }
+}
diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequestTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequestTest.java
new file mode 100644
index 0000000000..c63f1b8f82
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceRequestTest.java
@@ -0,0 +1,79 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.openecomp.mso.adapters.sdncrest;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.openecomp.mso.adapters.sdncrest.SDNCRequestCommon;
+import org.openecomp.mso.adapters.sdncrest.ServiceInformation;
+import org.openecomp.mso.adapters.sdncrest.RequestInformation;
+
+public class SDNCServiceRequestTest {
+
+ @Mock
+ SDNCRequestCommon src;
+
+ @Mock
+ ServiceInformation si;
+
+ @Mock
+ RequestInformation ri;
+
+ @InjectMocks
+ SDNCServiceRequest ssr;
+
+ @Before
+ public void init(){
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void test() {
+ ssr= new SDNCServiceRequest("url", "timeout",
+ "sdncRequestId", "sdncService", "sdncOperation",
+ ri,
+ si, "sdncServiceDataType",
+ "sndcServiceData");
+
+ ssr.setSDNCService("sdncService");
+ ssr.setSDNCServiceData("sndcServiceData");
+ ssr.setSDNCServiceDataType("sdncServiceDataType");
+ ssr.setBPTimeout("timeout");
+ ssr.setBPNotificationUrl("url");
+ ssr.setRequestInformation(ri);
+ ssr.setServiceInformation(si);
+ ssr.setSDNCOperation("sdncOperation");
+ ssr.setSDNCRequestId("sdncRequestId");
+ assert(ssr.getSDNCService().equals("sdncService"));
+ assert(ssr.getSDNCServiceData().equals("sndcServiceData"));
+ assert(ssr.getSDNCServiceDataType().equals("sdncServiceDataType"));
+ assert(ssr.getBPTimeout().equals("timeout"));
+ assert(ssr.getBPNotificationUrl().equals("url"));
+ assert(ssr.getRequestInformation().equals(ri));
+ assert(ssr.getServiceInformation().equals(si));
+ assert(ssr.getSDNCOperation().equals("sdncOperation"));
+ assert(ssr.getSDNCRequestId().equals("sdncRequestId"));
+ }
+
+}
diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponseTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponseTest.java
new file mode 100644
index 0000000000..9c4e98a02b
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/SDNCServiceResponseTest.java
@@ -0,0 +1,58 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.openecomp.mso.adapters.sdncrest;
+
+import static org.junit.Assert.*;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon;
+
+public class SDNCServiceResponseTest {
+
+ @Mock
+ SDNCResponseCommon src;
+
+ @InjectMocks
+ SDNCServiceResponse ssr;
+
+ @Before
+ public void init(){
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void test() {
+ ssr=new SDNCServiceResponse("sdncRequestId", "200",
+ "msg", "indicator");
+ Map<String, String> mp = new HashMap<>();
+ mp.put("name", "value");
+ ssr.setParams(mp);
+ assert(ssr.getParams().equals(mp));
+ assertNotNull(ssr);
+ }
+}
diff --git a/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/ServiceInformationTest.java b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/ServiceInformationTest.java
new file mode 100644
index 0000000000..2b87bbf101
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/src/test/java/org/openecomp/mso/adapters/sdncrest/ServiceInformationTest.java
@@ -0,0 +1,42 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* 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.openecomp.mso.adapters.sdncrest;
+
+import org.junit.Test;
+
+public class ServiceInformationTest {
+
+
+
+ @Test
+ public void test() {
+ ServiceInformation si= new ServiceInformation("id","service","GlobalId","name");
+
+ si.setServiceInstanceId("id");
+ si.setServiceType("service");
+ si.setSubscriberGlobalId("GlobalId");
+ si.setSubscriberName("name");
+ assert(si.getServiceInstanceId().equals("id"));
+ assert(si.getServiceType().equals("service"));
+ assert(si.getSubscriberGlobalId().equals("GlobalId"));
+ assert(si.getSubscriberName().equals("name"));
+ }
+}