diff options
author | Seshu Kumar M <seshu.kumar.m@huawei.com> | 2018-03-12 14:12:00 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-03-12 14:12:00 +0000 |
commit | bb969466dc08129d5903a96ad06170f57bd9f32b (patch) | |
tree | 7eb5578e98e2ca98d74b709391a11731adaedeae | |
parent | 9a809bf710ac0fcb7897916ee17af6b335a4fcb6 (diff) | |
parent | 1c23f39426e690afad840158574a23fa41ce04b2 (diff) |
Merge changes I9b4fc5b0,I2a4216c5
* changes:
Adding Junit
Adding Junit
5 files changed, 279 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")); + } +} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponseTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponseTest.java new file mode 100644 index 0000000000..f8867ae4f8 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponseTest.java @@ -0,0 +1,49 @@ +/* +* ============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.sdnc.impl; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class SDNCResponseTest { + + private SDNCResponse sdncresponse = new SDNCResponse(null, 0, null); + + @Test + public void testSDNCResponse() + { + sdncresponse.setReqId("reqId"); + sdncresponse.setRespCode(0); + sdncresponse.setRespMsg("respMsg"); + sdncresponse.setSdncRespXml("sdncRespXml"); + assertEquals(sdncresponse.getReqId(), "reqId"); + assertEquals(sdncresponse.getRespCode(), 0); + assertEquals(sdncresponse.getRespMsg(), "respMsg"); + assertEquals(sdncresponse.getSdncRespXml(),"sdncRespXml"); + } + + @Test + public void testtoString() + { + assert(sdncresponse.toString()!=null); + } +} +
\ No newline at end of file |