Adding Junit 95/39095/2
authorSumapriya <SS00493505@techmahindra.com>
Tue, 27 Mar 2018 13:41:48 +0000 (19:11 +0530)
committerSeshu Kumar M <seshu.kumar.m@huawei.com>
Tue, 27 Mar 2018 21:32:35 +0000 (21:32 +0000)
Adding Junit for:
1.CallbackHeader.java
2.ObjectFactory.java
3.RequestHeader.java
4.RequestTunables.java
5.SDNCAdapterCallbackRequest.java
6.SDNCAdapterRequest.java
7.SDNCResponse.java

Sonar Link:
https://sonar.onap.org/code?id=org.onap.so%3Aso&selected=org.onap.so%3AMSOCommonBPMN%3Asrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fmso%2Fclient%2Fsdnc%2Fsync

Change-Id: If0ae47961df2537bebe5f02cb615b66913509422
Issue-ID: SO-535
Signed-off-by: Sumapriya <SS00493505@techmahindra.com>
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/CallbackHeaderTest.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/ObjectFactoryTest.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestHeaderTest.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestTunablesTest.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequestTest.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequestTest.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCResponseTest.java [new file with mode: 0644]

diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/CallbackHeaderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/CallbackHeaderTest.java
new file mode 100644 (file)
index 0000000..995bb5b
--- /dev/null
@@ -0,0 +1,42 @@
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+*     http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+package org.openecomp.mso.client.sdnc.sync;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import org.junit.Test;\r
+\r
+public class CallbackHeaderTest {\r
+       \r
+       CallbackHeader cbh = new CallbackHeader();\r
+       CallbackHeader cbh1 = new CallbackHeader("reqId", "respCode", "respMsg");\r
+\r
+       @Test\r
+       public void testCallbackHeader() {\r
+               cbh.setRequestId("requestId");\r
+               cbh.setResponseCode("responseCode");\r
+               cbh.setResponseMessage("responseMessage");\r
+               assertEquals(cbh.getRequestId(), "requestId");\r
+               assertEquals(cbh.getResponseCode(), "responseCode");\r
+               assertEquals(cbh.getResponseMessage(), "responseMessage");\r
+               assert(cbh.toString()!=null);\r
+       }\r
+\r
+}\r
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/ObjectFactoryTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/ObjectFactoryTest.java
new file mode 100644 (file)
index 0000000..04bc7dc
--- /dev/null
@@ -0,0 +1,39 @@
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+*     http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+\r
+package org.openecomp.mso.client.sdnc.sync;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import org.junit.Test;\r
+\r
+public class ObjectFactoryTest {\r
+       ObjectFactory of = new ObjectFactory();\r
+\r
+       @Test\r
+       public void testObjectFactory() {\r
+               of.createRequestHeader();\r
+               of.createSDNCAdapterRequest();\r
+               of.createSDNCAdapterResponse();\r
+               \r
+               \r
+       }\r
+\r
+}\r
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestHeaderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestHeaderTest.java
new file mode 100644 (file)
index 0000000..1d04572
--- /dev/null
@@ -0,0 +1,45 @@
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+*     http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+package org.openecomp.mso.client.sdnc.sync;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import org.junit.Test;\r
+\r
+public class RequestHeaderTest {\r
+       RequestHeader rh = new RequestHeader();\r
+\r
+       @Test\r
+       public void testRequestHeader() {\r
+               rh.setRequestId("requestId");\r
+               rh.setSvcInstanceId("svcInstanceId");\r
+               rh.setSvcAction("svcAction");\r
+               rh.setSvcOperation("svcOperation");\r
+               rh.setCallbackUrl("callbackUrl");\r
+               rh.setMsoAction("msoAction");\r
+               assertEquals(rh.getRequestId(), "requestId");\r
+               assertEquals(rh.getSvcInstanceId(), "svcInstanceId");\r
+               assertEquals(rh.getSvcAction(), "svcAction");\r
+               assertEquals(rh.getSvcOperation(), "svcOperation");\r
+               assertEquals(rh.getCallbackUrl(), "callbackUrl");\r
+               assertEquals(rh.getMsoAction(), "msoAction");\r
+               assert(rh.toString()!=null);    \r
+       }\r
+}\r
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestTunablesTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestTunablesTest.java
new file mode 100644 (file)
index 0000000..1219f69
--- /dev/null
@@ -0,0 +1,58 @@
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+*     http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+package org.openecomp.mso.client.sdnc.sync;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import org.junit.Test;\r
+import org.openecomp.mso.properties.MsoPropertiesFactory;\r
+\r
+public class RequestTunablesTest {\r
+       MsoPropertiesFactory mpf = new MsoPropertiesFactory();\r
+       \r
+       RequestTunables rt = new RequestTunables("reqId", "msoAction", "operation", "action", mpf);\r
+\r
+       @Test\r
+       public void testRequestTunables() {\r
+               rt.setReqId("reqId");\r
+               rt.setReqMethod("reqMethod");\r
+               rt.setMsoAction("msoAction");\r
+               rt.setAction("action");\r
+               rt.setOperation("operation");\r
+               rt.setSdncUrl("sdncUrl");\r
+               rt.setTimeout("timeout");\r
+               rt.setAsyncInd("asyncInd");\r
+               rt.setHeaderName("headerName");\r
+               rt.setSdncaNotificationUrl("sdncaNotificationUrl");\r
+               rt.setNamespace("namespace");\r
+               assertEquals(rt.getReqId(), "reqId");\r
+               assertEquals(rt.getReqMethod(), "reqMethod");\r
+               assertEquals(rt.getMsoAction(), "msoAction");\r
+               assertEquals(rt.getAction(), "action");\r
+               assertEquals(rt.getOperation(), "operation");\r
+               assertEquals(rt.getSdncUrl(), "sdncUrl");\r
+               assertEquals(rt.getTimeout(), "timeout");\r
+               assertEquals(rt.getAsyncInd(), "asyncInd");\r
+               assertEquals(rt.getHeaderName(), "headerName");\r
+               assertEquals(rt.getSdncaNotificationUrl(), "sdncaNotificationUrl");\r
+               assertEquals(rt.getNamespace(), "namespace");\r
+               assert(rt.toString()!=null);    \r
+       }\r
+}\r
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequestTest.java
new file mode 100644 (file)
index 0000000..53fbb0a
--- /dev/null
@@ -0,0 +1,41 @@
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+*     http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+package org.openecomp.mso.client.sdnc.sync;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import org.junit.Test;\r
+\r
+public class SDNCAdapterCallbackRequestTest {\r
+       \r
+       SDNCAdapterCallbackRequest sdnccall = new SDNCAdapterCallbackRequest();\r
+       CallbackHeader cbh = new CallbackHeader();\r
+       Object o = new Object();\r
+\r
+       @Test\r
+       public void testSDNCAdapterCallbackRequest() {\r
+               sdnccall.setCallbackHeader(cbh);\r
+               sdnccall.setRequestData(o);\r
+               assertEquals(sdnccall.getCallbackHeader(), cbh);\r
+               assertEquals(sdnccall.getRequestData(), o);\r
+               assert(sdnccall.toString()!=null);      \r
+       }\r
+\r
+}\r
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequestTest.java
new file mode 100644 (file)
index 0000000..6b10f25
--- /dev/null
@@ -0,0 +1,39 @@
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+*     http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+package org.openecomp.mso.client.sdnc.sync;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import org.junit.Test;\r
+\r
+public class SDNCAdapterRequestTest {\r
+       \r
+       SDNCAdapterRequest adapter = new SDNCAdapterRequest();\r
+       RequestHeader rh = new RequestHeader();\r
+       Object o = new Object();\r
+\r
+       @Test\r
+       public void testSDNCAdapterRequest() {\r
+               adapter.setRequestHeader(rh);\r
+               adapter.setRequestData(o);\r
+               assertEquals(adapter.getRequestHeader(), rh);\r
+               assertEquals(adapter.getRequestData(), o);\r
+               }\r
+}\r
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCResponseTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCResponseTest.java
new file mode 100644 (file)
index 0000000..d8c2324
--- /dev/null
@@ -0,0 +1,43 @@
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright 2018 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+*     http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+package org.openecomp.mso.client.sdnc.sync;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import org.junit.Test;\r
+\r
+public class SDNCResponseTest {\r
+       \r
+       SDNCResponse sdnc = new SDNCResponse("reqId");\r
+       SDNCResponse sdnc1 = new SDNCResponse("reqId", 0, "respMsg");\r
+\r
+       @Test\r
+       public void testSDNCResponse() {\r
+               sdnc.setReqId("reqId");\r
+               sdnc.setRespCode(0);\r
+               sdnc.setRespMsg("respMsg");\r
+               sdnc.setSdncResp("sdncResp");\r
+               assertEquals(sdnc.getReqId(), "reqId");\r
+               assertEquals(sdnc.getRespCode(), 0);\r
+               assertEquals(sdnc.getRespMsg(), "respMsg");\r
+               assertEquals(sdnc.getSdncResp(), "sdncResp");\r
+               assert(sdnc.toString()!= null); \r
+       }\r
+}\r