From 82e8dd21d0043d1c66ad054af7d61a68529f4aeb Mon Sep 17 00:00:00 2001 From: Sumapriya Date: Tue, 27 Mar 2018 19:11:48 +0530 Subject: Adding Junit 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 --- .../mso/client/sdnc/sync/CallbackHeaderTest.java | 42 ++++++++++++++++ .../mso/client/sdnc/sync/ObjectFactoryTest.java | 39 +++++++++++++++ .../mso/client/sdnc/sync/RequestHeaderTest.java | 45 +++++++++++++++++ .../mso/client/sdnc/sync/RequestTunablesTest.java | 58 ++++++++++++++++++++++ .../sdnc/sync/SDNCAdapterCallbackRequestTest.java | 41 +++++++++++++++ .../client/sdnc/sync/SDNCAdapterRequestTest.java | 39 +++++++++++++++ .../mso/client/sdnc/sync/SDNCResponseTest.java | 43 ++++++++++++++++ 7 files changed, 307 insertions(+) create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/CallbackHeaderTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/ObjectFactoryTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestHeaderTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestTunablesTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequestTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequestTest.java create mode 100644 bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCResponseTest.java (limited to 'bpmn') 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 index 0000000000..995bb5b19c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/CallbackHeaderTest.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.client.sdnc.sync; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class CallbackHeaderTest { + + CallbackHeader cbh = new CallbackHeader(); + CallbackHeader cbh1 = new CallbackHeader("reqId", "respCode", "respMsg"); + + @Test + public void testCallbackHeader() { + cbh.setRequestId("requestId"); + cbh.setResponseCode("responseCode"); + cbh.setResponseMessage("responseMessage"); + assertEquals(cbh.getRequestId(), "requestId"); + assertEquals(cbh.getResponseCode(), "responseCode"); + assertEquals(cbh.getResponseMessage(), "responseMessage"); + assert(cbh.toString()!=null); + } + +} 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 index 0000000000..04bc7dc132 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/ObjectFactoryTest.java @@ -0,0 +1,39 @@ +/* +* ============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.client.sdnc.sync; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class ObjectFactoryTest { + ObjectFactory of = new ObjectFactory(); + + @Test + public void testObjectFactory() { + of.createRequestHeader(); + of.createSDNCAdapterRequest(); + of.createSDNCAdapterResponse(); + + + } + +} 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 index 0000000000..1d04572207 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestHeaderTest.java @@ -0,0 +1,45 @@ +/* +* ============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.client.sdnc.sync; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class RequestHeaderTest { + RequestHeader rh = new RequestHeader(); + + @Test + public void testRequestHeader() { + rh.setRequestId("requestId"); + rh.setSvcInstanceId("svcInstanceId"); + rh.setSvcAction("svcAction"); + rh.setSvcOperation("svcOperation"); + rh.setCallbackUrl("callbackUrl"); + rh.setMsoAction("msoAction"); + assertEquals(rh.getRequestId(), "requestId"); + assertEquals(rh.getSvcInstanceId(), "svcInstanceId"); + assertEquals(rh.getSvcAction(), "svcAction"); + assertEquals(rh.getSvcOperation(), "svcOperation"); + assertEquals(rh.getCallbackUrl(), "callbackUrl"); + assertEquals(rh.getMsoAction(), "msoAction"); + assert(rh.toString()!=null); + } +} 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 index 0000000000..1219f69874 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestTunablesTest.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.client.sdnc.sync; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.openecomp.mso.properties.MsoPropertiesFactory; + +public class RequestTunablesTest { + MsoPropertiesFactory mpf = new MsoPropertiesFactory(); + + RequestTunables rt = new RequestTunables("reqId", "msoAction", "operation", "action", mpf); + + @Test + public void testRequestTunables() { + rt.setReqId("reqId"); + rt.setReqMethod("reqMethod"); + rt.setMsoAction("msoAction"); + rt.setAction("action"); + rt.setOperation("operation"); + rt.setSdncUrl("sdncUrl"); + rt.setTimeout("timeout"); + rt.setAsyncInd("asyncInd"); + rt.setHeaderName("headerName"); + rt.setSdncaNotificationUrl("sdncaNotificationUrl"); + rt.setNamespace("namespace"); + assertEquals(rt.getReqId(), "reqId"); + assertEquals(rt.getReqMethod(), "reqMethod"); + assertEquals(rt.getMsoAction(), "msoAction"); + assertEquals(rt.getAction(), "action"); + assertEquals(rt.getOperation(), "operation"); + assertEquals(rt.getSdncUrl(), "sdncUrl"); + assertEquals(rt.getTimeout(), "timeout"); + assertEquals(rt.getAsyncInd(), "asyncInd"); + assertEquals(rt.getHeaderName(), "headerName"); + assertEquals(rt.getSdncaNotificationUrl(), "sdncaNotificationUrl"); + assertEquals(rt.getNamespace(), "namespace"); + assert(rt.toString()!=null); + } +} 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 index 0000000000..53fbb0a4aa --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequestTest.java @@ -0,0 +1,41 @@ +/* +* ============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.client.sdnc.sync; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class SDNCAdapterCallbackRequestTest { + + SDNCAdapterCallbackRequest sdnccall = new SDNCAdapterCallbackRequest(); + CallbackHeader cbh = new CallbackHeader(); + Object o = new Object(); + + @Test + public void testSDNCAdapterCallbackRequest() { + sdnccall.setCallbackHeader(cbh); + sdnccall.setRequestData(o); + assertEquals(sdnccall.getCallbackHeader(), cbh); + assertEquals(sdnccall.getRequestData(), o); + assert(sdnccall.toString()!=null); + } + +} 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 index 0000000000..6b10f25e70 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequestTest.java @@ -0,0 +1,39 @@ +/* +* ============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.client.sdnc.sync; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class SDNCAdapterRequestTest { + + SDNCAdapterRequest adapter = new SDNCAdapterRequest(); + RequestHeader rh = new RequestHeader(); + Object o = new Object(); + + @Test + public void testSDNCAdapterRequest() { + adapter.setRequestHeader(rh); + adapter.setRequestData(o); + assertEquals(adapter.getRequestHeader(), rh); + assertEquals(adapter.getRequestData(), o); + } +} 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 index 0000000000..d8c23249c4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCResponseTest.java @@ -0,0 +1,43 @@ +/* +* ============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.client.sdnc.sync; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class SDNCResponseTest { + + SDNCResponse sdnc = new SDNCResponse("reqId"); + SDNCResponse sdnc1 = new SDNCResponse("reqId", 0, "respMsg"); + + @Test + public void testSDNCResponse() { + sdnc.setReqId("reqId"); + sdnc.setRespCode(0); + sdnc.setRespMsg("respMsg"); + sdnc.setSdncResp("sdncResp"); + assertEquals(sdnc.getReqId(), "reqId"); + assertEquals(sdnc.getRespCode(), 0); + assertEquals(sdnc.getRespMsg(), "respMsg"); + assertEquals(sdnc.getSdncResp(), "sdncResp"); + assert(sdnc.toString()!= null); + } +} -- cgit 1.2.3-korg