From 5a6a6de6f1a26a1897e4917a0df613e25a24eb70 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Mon, 30 Jul 2018 15:56:09 -0400 Subject: Containerization feature of SO Change-Id: I95381232eeefcd247a66a5cec370a8ce1c288e18 Issue-ID: SO-670 Signed-off-by: Benjamin, Max (mb388a) --- .../java/org/onap/so/adapters/sdnc/BaseTest.java | 52 +++ .../java/org/onap/so/adapters/sdnc/FileUtil.java | 76 ++++ .../onap/so/adapters/sdnc/ObjectFactoryTest.java | 113 +++++ .../so/adapters/sdnc/SDNCAdapterRequestTest.java | 57 +++ .../adapters/sdnc/client/CallbackHeaderTest.java | 49 +++ .../client/SDNCAdapterCallbackRequestTest.java | 57 +++ .../adapters/sdnc/impl/MapRequestTunablesTest.java | 128 ++++++ .../sdnc/impl/SDNCAdapterPortTypeImplTest.java | 111 +++++ .../so/adapters/sdnc/impl/SDNCResponseTest.java | 49 +++ .../so/adapters/sdnc/impl/SDNCRestClientTest.java | 54 +++ .../org/onap/so/adapters/sdnc/impl/UtilsTest.java | 64 +++ .../adapters/sdnc/sdncrest/ObjectMappingTest.java | 479 +++++++++++++++++++++ .../adapters/sdnc/sdncrest/SDNCConnectorTest.java | 63 +++ .../sdncrest/SDNCServiceRequestConnectorTest.java | 39 ++ .../adapters/sdnc/util/SDNCRequestIdUtilTest.java | 46 ++ .../mso/adapters/sdnc/ObjectFactoryTest.java | 113 ----- .../mso/adapters/sdnc/SDNCAdapterRequestTest.java | 57 --- .../adapters/sdnc/client/CallbackHeaderTest.java | 49 --- .../client/SDNCAdapterCallbackRequestTest.java | 57 --- .../mso/adapters/sdnc/impl/InvestigationTest.java | 114 ----- .../adapters/sdnc/impl/RequestTunablesTest.java | 86 ---- .../sdnc/impl/SDNCAdapterRestImplTest.java | 79 ---- .../mso/adapters/sdnc/impl/SDNCResponseTest.java | 49 --- .../sdnc/notify/SDNCNotifyResourceTest.java | 52 --- .../adapters/sdnc/sdncrest/BPRestCallbackTest.java | 38 -- .../adapters/sdnc/sdncrest/ObjectMappingTest.java | 478 -------------------- .../sdnc/sdncrest/TypedRequestTunablesTest.java | 48 --- .../adapters/sdnc/util/SDNCRequestIdUtilTest.java | 45 -- .../src/test/resources/SdncServiceResponse.xml | 12 + .../src/test/resources/application-test.properties | 102 +++++ .../src/test/resources/logback-test.xml | 25 +- .../src/test/resources/mso.properties | 42 -- .../src/test/resources/mso.sdnc.properties | 152 ------- .../src/test/resources/sdncTestPayload.xml | 34 ++ .../src/test/resources/sdnc_adapter_request.xml | 10 +- 35 files changed, 1605 insertions(+), 1474 deletions(-) create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/FileUtil.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/ObjectFactoryTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/SDNCAdapterRequestTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/client/CallbackHeaderTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/MapRequestTunablesTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImplTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCResponseTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCRestClientTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/UtilsTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/ObjectMappingTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnectorTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnectorTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/util/SDNCRequestIdUtilTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/ObjectFactoryTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequestTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeaderTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/InvestigationTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunablesTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImplTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponseTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/notify/SDNCNotifyResourceTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallbackTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/sdncrest/ObjectMappingTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/sdncrest/TypedRequestTunablesTest.java delete mode 100644 adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtilTest.java create mode 100644 adapters/mso-sdnc-adapter/src/test/resources/SdncServiceResponse.xml create mode 100644 adapters/mso-sdnc-adapter/src/test/resources/application-test.properties delete mode 100644 adapters/mso-sdnc-adapter/src/test/resources/mso.properties delete mode 100644 adapters/mso-sdnc-adapter/src/test/resources/mso.sdnc.properties create mode 100644 adapters/mso-sdnc-adapter/src/test/resources/sdncTestPayload.xml (limited to 'adapters/mso-sdnc-adapter/src/test') diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java new file mode 100644 index 0000000000..29a1db89aa --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/BaseTest.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.so.adapters.sdnc; + +import org.junit.After; +import org.junit.Rule; +import org.junit.rules.ExpectedException; +import org.junit.runner.RunWith; +import org.onap.so.cloud.Application; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = Application.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +@AutoConfigureWireMock(port = 0) +public abstract class BaseTest { + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + protected TestRestTemplate restTemplate = new TestRestTemplate("test", "test"); + + @Value("${wiremock.server.port}") + protected String wireMockPort; + + @After + public void after() { + + } +} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/FileUtil.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/FileUtil.java new file mode 100644 index 0000000000..f2fba5900f --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/FileUtil.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.so.adapters.sdnc; + +import org.onap.so.logger.MsoLogger; + +import java.io.IOException; +import java.io.InputStream; + +/** + * file utility class + */ +public class FileUtil { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, FileUtil.class); + + /** + * Read the specified resource file and return the contents as a String. + * + * @param fileName Name of the resource file + * @return the contents of the resource file as a String + * @throws IOException if there is a problem reading the file + */ + public static String readResourceFile(String fileName) { + InputStream stream; + try { + stream = getResourceAsStream(fileName); + byte[] bytes; + bytes = new byte[stream.available()]; + if(stream.read(bytes) > 0) { + stream.close(); + return new String(bytes); + } else { + stream.close(); + return ""; + } + } catch (IOException e) { + LOGGER.debug("Exception:", e); + return ""; + } + } + + /** + * Get an InputStream for the resource specified. + * + * @param resourceName Name of resource for which to get InputStream. + * @return an InputStream for the resource specified. + * @throws IOException If we can't get the InputStream for whatever reason. + */ + private static InputStream getResourceAsStream(String resourceName) throws IOException { + InputStream stream = + FileUtil.class.getClassLoader().getResourceAsStream(resourceName); + if (stream == null) { + throw new IOException("Can't access resource '" + resourceName + "'"); + } + return stream; + } +} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/ObjectFactoryTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/ObjectFactoryTest.java new file mode 100644 index 0000000000..7a9b039089 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/ObjectFactoryTest.java @@ -0,0 +1,113 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.so.adapters.sdnc; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.CoreMatchers.containsString; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.io.StringWriter; +import java.nio.charset.Charset; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Marshaller; +import javax.xml.bind.Unmarshaller; + +import org.junit.Test; + +public class ObjectFactoryTest { + + private Marshaller jaxbMarshaller; + private Unmarshaller jaxbUnmarshaller; + + /** + * Test method for {@link org.onap.so.adapters.sdnc.ObjectFactory#createRequestHeader()}. + */ + @Test + public final void testCreateRequestHeader () { + ObjectFactory of = new ObjectFactory (); + RequestHeader rh = of.createRequestHeader (); + rh.setCallbackUrl ("callback"); + rh.setMsoAction ("action"); + rh.setRequestId ("reqid"); + rh.setSvcAction ("svcAction"); + rh.setSvcInstanceId ("svcId"); + rh.setSvcOperation ("op"); + + try { + JAXBContext jaxbContext = JAXBContext.newInstance(RequestHeader.class); + jaxbMarshaller = jaxbContext.createMarshaller(); + + JAXBContext jaxbContext2 = JAXBContext.newInstance(RequestHeader.class); + jaxbUnmarshaller = jaxbContext2.createUnmarshaller(); + } + catch (JAXBException e) { + e.printStackTrace (); + fail(); + return; + } + + StringWriter writer = new StringWriter(); + try { + jaxbMarshaller.marshal (rh, writer); + } catch (JAXBException e) { + e.printStackTrace(); + fail (); + } + String marshalled = writer.toString (); + assertThat(marshalled, containsString("reqid")); + + InputStream inputStream = new ByteArrayInputStream(marshalled.getBytes(Charset.forName("UTF-8"))); + try { + RequestHeader res2 = (RequestHeader) jaxbUnmarshaller.unmarshal (inputStream); + assertEquals("callback", res2.getCallbackUrl ()); + assertEquals("action", res2.getMsoAction ()); + assertEquals("op", res2.getSvcOperation ()); + } catch (JAXBException e) { + e.printStackTrace(); + fail(); + } + } + + /** + * Test method for {@link org.onap.so.adapters.sdnc.ObjectFactory#createSDNCAdapterResponse()}. + */ + @Test + public final void testCreateSDNCAdapterResponse () { + ObjectFactory of = new ObjectFactory (); + SDNCAdapterResponse ar = of.createSDNCAdapterResponse (); + assertNotNull(ar); + } + + @Test + public final void testCreateSDNCAdapterRequest () { + ObjectFactory of = new ObjectFactory (); + SDNCAdapterRequest ar = of.createSDNCAdapterRequest (); + assertNotNull(ar); + } + +} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/SDNCAdapterRequestTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/SDNCAdapterRequestTest.java new file mode 100644 index 0000000000..e0a1982db1 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/SDNCAdapterRequestTest.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.so.adapters.sdnc; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.so.adapters.sdnc.SDNCAdapterRequest; +import org.onap.so.adapters.sdnc.RequestHeader; + + +public class SDNCAdapterRequestTest { + + static Object sd= new SDNCAdapterRequest(); + static RequestHeader rh=new RequestHeader(); + + @BeforeClass + public static final void RHeader() + { + rh.setCallbackUrl("callback"); + rh.setMsoAction ("action"); + rh.setRequestId ("reqid"); + rh.setSvcAction ("svcAction"); + rh.setSvcInstanceId ("svcId"); + rh.setSvcOperation ("op"); + } + @Test + public final void testtoString(){ + ((SDNCAdapterRequest) sd).setRequestData("data"); + ((SDNCAdapterRequest) sd).setRequestHeader(rh); + assertNotNull(((SDNCAdapterRequest) sd).getRequestData()) ; + assertEquals("data", ((SDNCAdapterRequest) sd).getRequestData()); + assertEquals(rh, ((SDNCAdapterRequest) sd).getRequestHeader()); + } + +} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/client/CallbackHeaderTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/client/CallbackHeaderTest.java new file mode 100644 index 0000000000..dbb5c9aa44 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/client/CallbackHeaderTest.java @@ -0,0 +1,49 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 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.onap.so.adapters.sdnc.client; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; + +public class CallbackHeaderTest { + + static CallbackHeader cb = new CallbackHeader(); + + @Test + public final void testCallbackHeader() { + cb.setRequestId("413658f4-7f42-482e-b834-23a5c15657da-1474471336781"); + cb.setResponseCode("200"); + cb.setResponseMessage("OK"); + assertNotNull(cb.getRequestId()); + assertNotNull(cb.getResponseCode()); + assertNotNull(cb.getResponseMessage()); + assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", cb.getRequestId()); + assertEquals("200", cb.getResponseCode()); + assertEquals("OK", cb.getResponseMessage()); + } + + @Test + public void testtoString() { + assertNotNull(cb.toString()); + } +} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java new file mode 100644 index 0000000000..d7f4f8e6f7 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.so.adapters.sdnc.client; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.onap.so.adapters.sdnc.client.CallbackHeader; +import org.onap.so.adapters.sdnc.client.SDNCAdapterCallbackRequest; + +public class SDNCAdapterCallbackRequestTest { + + static SDNCAdapterCallbackRequest sdc = new SDNCAdapterCallbackRequest(); + static CallbackHeader ch = new CallbackHeader("413658f4-7f42-482e-b834-23a5c15657da-1474471336781","200","OK"); + + @Test + public void testSDNCAdapterCallbackRequest() + { + sdc.setCallbackHeader(ch); + sdc.setRequestData("data"); + assertNotNull(sdc.getCallbackHeader()); + assertNotNull(sdc.getRequestData()); + assertEquals(ch, sdc.getCallbackHeader()); + assertEquals("data", sdc.getRequestData()); + + } + + @Test + public void testtoString() + { + assertNotNull(ch.toString()); + assertNotNull(sdc.toString()); + } + +} + + diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/MapRequestTunablesTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/MapRequestTunablesTest.java new file mode 100644 index 0000000000..cd93f6e71b --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/MapRequestTunablesTest.java @@ -0,0 +1,128 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.so.adapters.sdnc.impl; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.adapters.sdnc.SDNCAdapterApplication; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SDNCAdapterApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public class MapRequestTunablesTest { + + @Autowired + private MapRequestTunables tunableMapper; + + @Test + public void test_setTunables(){ + RequestTunables expectedResult = new RequestTunables("testReqId", "","vnf-topology-operation","assign"); + expectedResult.setAsyncInd("N"); + expectedResult.setSdncUrl("https://localhost:8443/restconf/operations/VNF-API:vnf-topology-operation"); + expectedResult.setTimeout("270000"); + expectedResult.setReqMethod("POST"); + expectedResult.setHeaderName("sdnc-request-header"); + expectedResult.setNamespace("org:openecomp:sdnctl:vnf"); + + RequestTunables testMapper = new RequestTunables("testReqId", "","vnf-topology-operation","assign"); + + RequestTunables mappedTunable = tunableMapper.setTunables(testMapper); + + assertThat(mappedTunable, sameBeanAs(expectedResult)); + } + + @Test + public void test_setTunables_EmptyOperation_EmptyMSOAction(){ + RequestTunables expectedResult = new RequestTunables("testReqId", "","","query"); + expectedResult.setAsyncInd("N"); + expectedResult.setSdncUrl("http://localhost:8443/restconf/operations/GENERIC-RESOURCE-API:"); + expectedResult.setTimeout("60000"); + expectedResult.setReqMethod("GET"); + expectedResult.setHeaderName("sdnc-request-header"); + expectedResult.setNamespace(""); + + RequestTunables testMapper = new RequestTunables("testReqId", "","","query"); + + RequestTunables mappedTunable = tunableMapper.setTunables(testMapper); + + assertThat(mappedTunable, sameBeanAs(expectedResult)); + } + + @Test + public void test_setTunables_EmptyOperation(){ + RequestTunables expectedResult = new RequestTunables("testReqId", "infra","","query"); + expectedResult.setAsyncInd("N"); + expectedResult.setSdncUrl("https://localhost:8443/restconf/config"); + expectedResult.setTimeout("60000"); + expectedResult.setReqMethod("GET"); + expectedResult.setHeaderName("sdnc-request-header"); + expectedResult.setNamespace(""); + + RequestTunables testMapper = new RequestTunables("testReqId", "infra","","query"); + + RequestTunables mappedTunable = tunableMapper.setTunables(testMapper); + + assertThat(mappedTunable, sameBeanAs(expectedResult)); + } + + @Test + public void test_setTunables_EmptyOperation_EmptyMSOActionPUT(){ + RequestTunables expectedResult = new RequestTunables("testReqId", "","","put"); + expectedResult.setAsyncInd("N"); + expectedResult.setSdncUrl("https://localhost:8443/restconf/config"); + expectedResult.setTimeout("60000"); + expectedResult.setReqMethod("PUT"); + expectedResult.setHeaderName("sdnc-request-header"); + expectedResult.setNamespace(""); + + RequestTunables testMapper = new RequestTunables("testReqId", "","","put"); + + RequestTunables mappedTunable = tunableMapper.setTunables(testMapper); + + assertThat(mappedTunable, sameBeanAs(expectedResult)); + } + + + @Test + public void test_setTunables_EmptyOperation_EmptyMSOActionRESTDELETE(){ + RequestTunables expectedResult = new RequestTunables("testReqId", "","","restdelete"); + expectedResult.setAsyncInd("N"); + expectedResult.setSdncUrl("https://localhost:8443/restconf/config"); + expectedResult.setTimeout("60000"); + expectedResult.setReqMethod("DELETE"); + expectedResult.setHeaderName("sdnc-request-header"); + expectedResult.setNamespace(""); + + RequestTunables testMapper = new RequestTunables("testReqId", "","","restdelete"); + + RequestTunables mappedTunable = tunableMapper.setTunables(testMapper); + + assertThat(mappedTunable, sameBeanAs(expectedResult)); + } + +} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImplTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImplTest.java new file mode 100644 index 0000000000..8f73c02285 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImplTest.java @@ -0,0 +1,111 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.so.adapters.sdnc.impl; + +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.IOException; +import java.io.StringWriter; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.adapters.sdnc.RequestHeader; +import org.onap.so.adapters.sdnc.SDNCAdapterApplication; +import org.onap.so.adapters.sdnc.SDNCAdapterPortType; +import org.onap.so.adapters.sdnc.SDNCAdapterRequest; +import org.onap.so.adapters.sdnc.SDNCAdapterResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = SDNCAdapterApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles({"test","non-async"}) +public class SDNCAdapterPortTypeImplTest { + + @Autowired + private SDNCAdapterPortType sdncAdapter; + + + SDNCAdapterRequest sdncAdapterRequest; + + public void setupTestEntities() throws ParserConfigurationException, SAXException, IOException, TransformerException { + buildTestRequest(); + } + + private void buildTestRequest() throws ParserConfigurationException, SAXException, IOException, TransformerException { + sdncAdapterRequest= new SDNCAdapterRequest(); + File fXmlFile = new File("src/test/resources/sdncTestPayload.xml"); + DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); + Document doc = dBuilder.parse(fXmlFile); + StringWriter sw = new StringWriter(); + TransformerFactory tf = TransformerFactory.newInstance(); + Transformer transformer = tf.newTransformer(); + transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); + transformer.setOutputProperty(OutputKeys.METHOD, "xml"); + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); + + transformer.transform(new DOMSource(doc), new StreamResult(sw)); + System.out.println(sw.toString()); + sdncAdapterRequest.setRequestData(sw.toString()); + RequestHeader requestHeader = new RequestHeader(); + requestHeader.setCallbackUrl("http://localhost:9090/callback"); + requestHeader.setMsoAction("gammainternet"); + requestHeader.setRequestId("testReqId"); + requestHeader.setSvcAction("assign"); + requestHeader.setSvcInstanceId("servInstanceId"); + requestHeader.setSvcOperation("svc-topology-operation"); + sdncAdapterRequest.setRequestHeader(requestHeader ); + } + + + + @Test + public void sendRequest() throws ParserConfigurationException, SAXException, IOException, TransformerException { + // Given + setupTestEntities(); + + // When + SDNCAdapterResponse response = sdncAdapter.sdncAdapter(sdncAdapterRequest); + if(response ==null) + fail("Null infraRequest"); + + // Then + //assertThat(infraRequest, sameBeanAs(testRequest).ignoring("requestBody").ignoring("endTime").ignoring("startTime").ignoring("modifyTime")); + } +} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCResponseTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCResponseTest.java new file mode 100644 index 0000000000..498fa3fa6d --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCResponseTest.java @@ -0,0 +1,49 @@ +/* +* ============LICENSE_START======================================================= + * ONAP : SO + * ================================================================================ + * Copyright (C) 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.onap.so.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() + { + assertNotNull(sdncresponse.toString()); + } +} + diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCRestClientTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCRestClientTest.java new file mode 100644 index 0000000000..076a9f3c6a --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/SDNCRestClientTest.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.so.adapters.sdnc.impl; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static org.junit.Assert.assertNotNull; + +import org.apache.http.HttpStatus; +import org.junit.Test; +import org.onap.so.adapters.sdnc.BaseTest; +import org.springframework.beans.factory.annotation.Autowired; +import static com.github.tomakehurst.wiremock.client.WireMock.*; + + +public class SDNCRestClientTest extends BaseTest { + + @Autowired + private SDNCRestClient sdncClient; + + @Test + public void getSdncRespTestException() { + + RequestTunables rt = new RequestTunables("", "", "", ""); + rt.setTimeout("1000"); + rt.setReqMethod("POST"); + rt.setSdncUrl("http://localhost:" + wireMockPort + "/sdnc"); + + stubFor(post(urlPathEqualTo("/sdnc")) + .willReturn(aResponse().withHeader("Content-Type", "application/xml").withBody("").withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); + + SDNCResponse response = sdncClient.getSdncResp("", rt); + assertNotNull(response); + } +} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/UtilsTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/UtilsTest.java new file mode 100644 index 0000000000..596f26caa6 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/impl/UtilsTest.java @@ -0,0 +1,64 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.so.adapters.sdnc.impl; + +import static org.junit.Assert.assertEquals; +import java.io.File; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.JAXBException; +import javax.xml.bind.Unmarshaller; +import org.junit.Test; +import org.onap.so.adapters.sdnc.SDNCAdapterRequest; +import org.w3c.dom.Document; +import org.w3c.dom.Node; + +public class UtilsTest { + + @Test + public final void testUnmarshal () { + + String expectedXml = "FIREWALL-LITEmtjnj40evbc0ecebSHARED/restconf/config/Firewall-API:feature-model/feature-list/FIREWALL-LITE/mtjnj40evbc0eceb/ "; + + try { + + File file = new File("src/test/resources/sdncBpmnAdiodFirewallRequest.xml"); + JAXBContext jaxbContext = JAXBContext.newInstance(SDNCAdapterRequest.class); + + Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); + SDNCAdapterRequest request = (SDNCAdapterRequest) jaxbUnmarshaller.unmarshal(file); + + RequestTunables rt = new RequestTunables("0460ba40-60c8-4b07-8878-c8e8d87cde04-1527983610512", + "", + "/L3SDN-API:services/layer3-service-list/MIS%2F1806%2F25057%2FSW_INTERNET/service-data/feature-list/FIREWALL-LITE/", + "put"); + + Node node = (Node) request.getRequestData(); + Document reqDoc = node.getOwnerDocument(); + String sdncReqBody = Utils.genSdncPutReq(reqDoc, rt); + assertEquals(sdncReqBody.replaceAll("[\\t\\n\\r]+", ""), expectedXml); + + } catch (JAXBException e) { + e.printStackTrace(); + } + + } + +} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/ObjectMappingTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/ObjectMappingTest.java new file mode 100644 index 0000000000..88849015e0 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/ObjectMappingTest.java @@ -0,0 +1,479 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.so.adapters.sdnc.sdncrest; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.util.Arrays; + +import org.junit.Test; +import org.onap.so.adapters.sdncrest.SDNCEvent; +import org.onap.so.adapters.sdncrest.SDNCServiceError; +import org.onap.so.adapters.sdncrest.SDNCServiceRequest; +import org.onap.so.adapters.sdncrest.SDNCServiceResponse; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + + + +/** + * JSON object mapping tests. + */ +public class ObjectMappingTest { + private static final String EOL = "\n"; + + private final String SDNC_SERVICE_REQUEST = + "{" + EOL + + " \"SDNCServiceRequest\": {" + EOL + + " \"requestInformation\": {" + EOL + + " \"requestId\": \"413658f4-7f42-482e-b834-23a5c15657da\"," + EOL + + " \"source\": \"CCD\"," + EOL + + " \"notificationUrl\": \"https://ccd-host:8080/notifications\"" + EOL + + " }," + EOL + + " \"serviceInformation\": {" + EOL + + " \"serviceType\": \"vHNFaaS\"," + EOL + + " \"serviceInstanceId\": \"74e65b2b637441bca078e63e44bb511b\"," + EOL + + " \"subscriberName\": \"IST_SG_0902_3003\"," + EOL + + " \"subscriberGlobalId\": \"IST15_0902_3003\"" + EOL + + " }," + EOL + + " \"bpNotificationUrl\": \"http://localhost:8080/mso/SDNCAdapterCallbackService\"," + EOL + + "((BP-TIMEOUT))" + + " \"sdncRequestId\": \"413658f4-7f42-482e-b834-23a5c15657da-1474471336781\"," + EOL + + " \"sdncService\": \"vhnf\"," + EOL + + " \"sdncOperation\": \"service-topology-cust-assign-operation\"," + EOL + + " \"sdncServiceDataType\": \"XML\"," + EOL + + " \"sdncServiceData\": \"c26dfed652164d60a17461734422b085HOSTNAME\"" + EOL + + " }" + EOL + + "}" + EOL; + + private final String SDNC_SERVICE_RESPONSE = + "{" + EOL + + " \"SDNCServiceResponse\": {" + EOL + + " \"sdncRequestId\": \"413658f4-7f42-482e-b834-23a5c15657da-1474471336781\"," + EOL + + " \"responseCode\": \"200\"," + EOL + + "((RESPONSE-MESSAGE))" + + " \"ackFinalIndicator\": \"Y\"" + EOL + + "((RESPONSE-PARAMS))" + + " }" + EOL + + "}" + EOL; + + private final String SDNC_SERVICE_ERROR = + "{" + EOL + + " \"SDNCServiceError\": {" + EOL + + " \"sdncRequestId\": \"413658f4-7f42-482e-b834-23a5c15657da-1474471336781\"," + EOL + + " \"responseCode\": \"500\"," + EOL + + "((RESPONSE-MESSAGE))" + + " \"ackFinalIndicator\": \"Y\"" + EOL + + " }" + EOL + + "}" + EOL; + + private final String SDNC_EVENT = + "{" + EOL + + " \"SDNCEvent\": {" + EOL + + " \"eventType\": \"ACTIVATION\"," + EOL + + " \"eventCorrelatorType\": \"HOST-NAME\"," + EOL + + " \"eventCorrelator\": \"USOSTCDALTX0101UJZZ31\"" + EOL + + "((EVENT-PARAMS))" + + " }" + EOL + + "}" + EOL; + + private final String PARAMS = + "{\"P1\":\"V1\",\"P2\":\"V2\",\"P3\":\"V3\"}"; + + @Test + public final void jsonToSDNCServiceRequest() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); + + String json = SDNC_SERVICE_REQUEST; + json = json.replace("((BP-TIMEOUT))", "\"bpTimeout\": \"" + "PT5M" + "\"," + EOL); + + SDNCServiceRequest object = mapper.readValue(json, SDNCServiceRequest.class); + assertEquals("413658f4-7f42-482e-b834-23a5c15657da", object.getRequestInformation().getRequestId()); + assertEquals("CCD", object.getRequestInformation().getSource()); + assertEquals("https://ccd-host:8080/notifications", object.getRequestInformation().getNotificationUrl()); + assertEquals("vHNFaaS", object.getServiceInformation().getServiceType()); + assertEquals("74e65b2b637441bca078e63e44bb511b", object.getServiceInformation().getServiceInstanceId()); + assertEquals("IST_SG_0902_3003", object.getServiceInformation().getSubscriberName()); + assertEquals("IST15_0902_3003", object.getServiceInformation().getSubscriberGlobalId()); + assertEquals("http://localhost:8080/mso/SDNCAdapterCallbackService", object.getBPNotificationUrl()); + assertEquals("PT5M", object.getBPTimeout()); + assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSdncRequestId()); + assertEquals("vhnf", object.getSdncService()); + assertEquals("service-topology-cust-assign-operation", object.getSdncOperation()); + assertEquals("XML", object.getSdncServiceDataType()); + assertTrue(object.getSdncServiceData().startsWith("")); + } + + @Test + public final void jsonToSDNCServiceRequestWithoutOptionalFields() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); + + // bpTimeout is optional. + String json = SDNC_SERVICE_REQUEST; + json = json.replace("((BP-TIMEOUT))", ""); + + SDNCServiceRequest object = mapper.readValue(json, SDNCServiceRequest.class); + assertEquals("413658f4-7f42-482e-b834-23a5c15657da", object.getRequestInformation().getRequestId()); + assertEquals("CCD", object.getRequestInformation().getSource()); + assertEquals("https://ccd-host:8080/notifications", object.getRequestInformation().getNotificationUrl()); + assertEquals("vHNFaaS", object.getServiceInformation().getServiceType()); + assertEquals("74e65b2b637441bca078e63e44bb511b", object.getServiceInformation().getServiceInstanceId()); + assertEquals("IST_SG_0902_3003", object.getServiceInformation().getSubscriberName()); + assertEquals("IST15_0902_3003", object.getServiceInformation().getSubscriberGlobalId()); + assertEquals("http://localhost:8080/mso/SDNCAdapterCallbackService", object.getBPNotificationUrl()); + assertNull(object.getBPTimeout()); + assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSdncRequestId()); + assertEquals("vhnf", object.getSdncService()); + assertEquals("service-topology-cust-assign-operation", object.getSdncOperation()); + assertEquals("XML", object.getSdncServiceDataType()); + assertTrue(object.getSdncServiceData().startsWith("")); + } + + @Test + public final void jsonFromSDNCServiceRequest() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); + + // Convert source json string to object. + String json1 = SDNC_SERVICE_REQUEST; + json1 = json1.replace("((BP-TIMEOUT))", "\"bpTimeout\": \"" + "PT5M" + "\"," + EOL); + SDNCServiceRequest object1 = mapper.readValue(json1, SDNCServiceRequest.class); + + // Convert resulting object back to json. + String json2 = object1.toJson(); + System.out.println("Generated JSON for " + object1.getClass().getSimpleName() + + ":" + System.lineSeparator() + json2); + assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceRequest\":{")); + + // Convert generated json string to another object. + SDNCServiceRequest object2 = mapper.readValue(json2, SDNCServiceRequest.class); + + // Compare the first object to the second object. + assertTrue(serializedEquals(object1, object2)); + } + + @Test + public final void jsonFromSDNCServiceRequestWithoutOptionalFields() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); + + // Convert source json string to object. + String json1 = SDNC_SERVICE_REQUEST; + json1 = json1.replace("((BP-TIMEOUT))", ""); + SDNCServiceRequest object1 = mapper.readValue(json1, SDNCServiceRequest.class); + + // Convert resulting object back to json. + String json2 = object1.toJson(); + System.out.println("Generated JSON for " + object1.getClass().getSimpleName() + + ":" + System.lineSeparator() + json2); + assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceRequest\":{")); + + // Convert generated json string to another object. + SDNCServiceRequest object2 = mapper.readValue(json2, SDNCServiceRequest.class); + + // Compare the first object to the second object. + assertTrue(serializedEquals(object1, object2)); + } + + @Test + public final void jsonToSDNCServiceResponse() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); + + String json = SDNC_SERVICE_RESPONSE; + json = json.replace("((RESPONSE-MESSAGE))", " \"responseMessage\": \"" + "OK" + "\"," + EOL); + json = json.replace(EOL + "((RESPONSE-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL); + + SDNCServiceResponse object = mapper.readValue(json, SDNCServiceResponse.class); + assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSdncRequestId()); + assertEquals("200", object.getResponseCode()); + assertEquals("OK", object.getResponseMessage()); + assertEquals("Y", object.getAckFinalIndicator()); + assertEquals("V1", object.getParams().get("P1")); + assertEquals("V2", object.getParams().get("P2")); + assertEquals("V3", object.getParams().get("P3")); + } + + @Test + public final void jsonToSDNCServiceResponseWithoutOptionalFields() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); + + // responseMessage is optional. + String json = SDNC_SERVICE_RESPONSE; + json = json.replace("((RESPONSE-MESSAGE))", ""); + json = json.replace("((RESPONSE-PARAMS))", ""); + + SDNCServiceResponse object = mapper.readValue(json, SDNCServiceResponse.class); + assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSdncRequestId()); + assertEquals("200", object.getResponseCode()); + assertNull(object.getResponseMessage()); + assertEquals("Y", object.getAckFinalIndicator()); + assertNull(object.getParams()); + } + + @Test + public final void jsonFromSDNCServiceResponse() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); + + // Convert source json string to object. + String json1 = SDNC_SERVICE_RESPONSE; + json1 = json1.replace("((RESPONSE-MESSAGE))", "\"responseMessage\": \"" + "OK" + "\"," + EOL); + json1 = json1.replace(EOL + "((RESPONSE-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL); + SDNCServiceResponse object1 = mapper.readValue(json1, SDNCServiceResponse.class); + + // Convert resulting object back to json. + String json2 = object1.toJson(); + System.out.println("Generated JSON for " + object1.getClass().getSimpleName() + + ":" + System.lineSeparator() + json2); + assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceResponse\":{")); + + // Convert generated json string to another object. + SDNCServiceResponse object2 = mapper.readValue(json2, SDNCServiceResponse.class); + + // Compare the first object to the second object. + assertTrue(serializedEquals(object1, object2)); + } + + @Test + public final void jsonFromSDNCServiceResponseWithoutOptionalFields() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); + + // Convert source json string to object. + String json1 = SDNC_SERVICE_RESPONSE; + json1 = json1.replace("((RESPONSE-MESSAGE))", ""); + json1 = json1.replace("((RESPONSE-PARAMS))", ""); + SDNCServiceResponse object1 = mapper.readValue(json1, SDNCServiceResponse.class); + + // Convert resulting object back to json. + String json2 = object1.toJson(); + System.out.println("Generated JSON for " + object1.getClass().getSimpleName() + + ":" + System.lineSeparator() + json2); + assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceResponse\":{")); + + // Convert generated json string to another object. + SDNCServiceResponse object2 = mapper.readValue(json2, SDNCServiceResponse.class); + + // Compare the first object to the second object. + assertTrue(serializedEquals(object1, object2)); + } + + @Test + public final void jsonToSDNCServiceError() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); + + String json = SDNC_SERVICE_ERROR; + json = json.replace("((RESPONSE-MESSAGE))", "\"responseMessage\": \"" + "SOMETHING BAD" + "\"," + EOL); + + SDNCServiceError object = mapper.readValue(json, SDNCServiceError.class); + assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSdncRequestId()); + assertEquals("500", object.getResponseCode()); + assertEquals("SOMETHING BAD", object.getResponseMessage()); + assertEquals("Y", object.getAckFinalIndicator()); + } + + @Test + public final void jsonToSDNCServiceErrorWithoutOptionalFields() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); + + // responseMessage is optional. + String json = SDNC_SERVICE_ERROR; + json = json.replace("((RESPONSE-MESSAGE))", ""); + + SDNCServiceError object = mapper.readValue(json, SDNCServiceError.class); + assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSdncRequestId()); + assertEquals("500", object.getResponseCode()); + assertNull(object.getResponseMessage()); + assertEquals("Y", object.getAckFinalIndicator()); + } + + @Test + public final void jsonFromSDNCServiceError() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); + + // Convert source json string to object. + String json1 = SDNC_SERVICE_ERROR; + json1 = json1.replace("((RESPONSE-MESSAGE))", "\"responseMessage\": \"" + "OK" + "\"," + EOL); + SDNCServiceError object1 = mapper.readValue(json1, SDNCServiceError.class); + + // Convert resulting object back to json. + String json2 = object1.toJson(); + System.out.println("Generated JSON for " + object1.getClass().getSimpleName() + + ":" + System.lineSeparator() + json2); + assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceError\":{")); + + // Convert generated json string to another object. + SDNCServiceError object2 = mapper.readValue(json2, SDNCServiceError.class); + + // Compare the first object to the second object. + assertTrue(serializedEquals(object1, object2)); + } + + @Test + public final void jsonFromSDNCServiceErrorWithoutOptionalFields() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); + + // Convert source json string to object. + String json1 = SDNC_SERVICE_ERROR; + json1 = json1.replace("((RESPONSE-MESSAGE))", ""); + SDNCServiceError object1 = mapper.readValue(json1, SDNCServiceError.class); + + // Convert resulting object back to json. + String json2 = object1.toJson(); + System.out.println("Generated JSON for " + object1.getClass().getSimpleName() + + ":" + System.lineSeparator() + json2); + assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceError\":{")); + + // Convert generated json string to another object. + SDNCServiceError object2 = mapper.readValue(json2, SDNCServiceError.class); + + // Compare the first object to the second object. + assertTrue(serializedEquals(object1, object2)); + } + + @Test + public final void jsonToSDNCEvent() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); + + String json = SDNC_EVENT; + json = json.replace(EOL + "((EVENT-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL); + + SDNCEvent object = mapper.readValue(json, SDNCEvent.class); + assertEquals("ACTIVATION", object.getEventType()); + assertEquals("HOST-NAME", object.getEventCorrelatorType()); + assertEquals("USOSTCDALTX0101UJZZ31", object.getEventCorrelator()); + assertEquals("V1", object.getParams().get("P1")); + assertEquals("V2", object.getParams().get("P2")); + assertEquals("V3", object.getParams().get("P3")); + } + + @Test + public final void jsonToSDNCEventWithoutOptionalFields() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); + + // params are optional. + String json = SDNC_EVENT; + json = json.replace("((EVENT-PARAMS))", ""); + + SDNCEvent object = mapper.readValue(json, SDNCEvent.class); + assertEquals("ACTIVATION", object.getEventType()); + assertEquals("HOST-NAME", object.getEventCorrelatorType()); + assertEquals("USOSTCDALTX0101UJZZ31", object.getEventCorrelator()); + assertNull(object.getParams()); + } + + @Test + public final void jsonFromSDNCEvent() throws Exception { + logTest(); + ObjectMapper mapper = new ObjectMapper(); + mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); + mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); + + // Convert source json string to object. + String json1 = SDNC_EVENT; + json1 = json1.replace(EOL + "((EVENT-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL); + SDNCEvent object1 = mapper.readValue(json1, SDNCEvent.class); + + // Convert resulting object back to json. + String json2 = object1.toJson(); + System.out.println("Generated JSON for " + object1.getClass().getSimpleName() + + ":" + System.lineSeparator() + json2); + assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCEvent\":{")); + + // Convert generated json string to another object. + SDNCEvent object2 = mapper.readValue(json2, SDNCEvent.class); + + // Compare the first object to the second object. + assertTrue(serializedEquals(object1, object2)); + } + + /** + * Tests equality of two objects by comparing their serialized form. + * WARNING: this works pretty well as long as the objects don't contain + * collections like maps and sets that are semantically equal, but have + * different internal ordering of elements. + */ + private boolean serializedEquals(Serializable object1, Serializable object2) throws IOException { + ByteArrayOutputStream byteStream1 = new ByteArrayOutputStream(); + ObjectOutputStream objectStream1 = new ObjectOutputStream(byteStream1); + objectStream1.writeObject(object1); + objectStream1.close(); + + ByteArrayOutputStream byteStream2 = new ByteArrayOutputStream(); + ObjectOutputStream objectStream2 = new ObjectOutputStream(byteStream2); + objectStream2.writeObject(object2); + objectStream2.close(); + + return Arrays.equals(byteStream1.toByteArray(), byteStream2.toByteArray()); + } + + private void logTest() { + StackTraceElement[] st = Thread.currentThread().getStackTrace(); + String method = st[2].getMethodName(); + System.out.println("RUNNING TEST: " + method); + } +} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnectorTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnectorTest.java new file mode 100644 index 0000000000..23830ae3f3 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnectorTest.java @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.so.adapters.sdnc.sdncrest; + +import org.apache.http.HttpStatus; +import org.junit.Test; +import org.onap.so.adapters.sdnc.BaseTest; +import org.onap.so.adapters.sdncrest.SDNCResponseCommon; +import org.springframework.beans.factory.annotation.Autowired; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static org.junit.Assert.assertNotNull; +import static com.github.tomakehurst.wiremock.client.WireMock.*; + +public class SDNCConnectorTest extends BaseTest { + + @Autowired + private SDNCConnector sdncConnector; + + @Test + public void sendTest() { + String content = "1234"; + + String response = "\n" + + "\t\t// \n" + + "\t\t// protocol\n" + + "\t\t// malformed-message\n" + + "\t\t// Error parsing input: The element type \"input\" must be terminated by the matching end-tag \"</input>\".\n" + + "\t\t// \n" + + "\t\t// "; + + TypedRequestTunables rt = new TypedRequestTunables("", ""); + rt.setTimeout("1000"); + rt.setReqMethod("POST"); + rt.setSdncUrl("http://localhost:" + wireMockPort + "/sdnc"); + + stubFor(post(urlPathEqualTo("/sdnc")) + .willReturn(aResponse().withHeader("Content-Type", "application/xml").withBody(response).withStatus(HttpStatus.SC_MULTIPLE_CHOICES))); + + SDNCResponseCommon responseCommon = sdncConnector.send(content, rt); + assertNotNull(responseCommon); + } +} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnectorTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnectorTest.java new file mode 100644 index 0000000000..eddd74b213 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnectorTest.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 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.so.adapters.sdnc.sdncrest; + +import org.junit.Test; +import org.onap.so.adapters.sdnc.FileUtil; +import org.onap.so.adapters.sdncrest.SDNCResponseCommon; + +import static org.junit.Assert.assertNotNull; + +public class SDNCServiceRequestConnectorTest { + + @Test + public void parseResponseContentTest() throws Exception { + + String content = FileUtil.readResourceFile("SdncServiceResponse.xml"); + SDNCResponseCommon responseCommon = SDNCServiceRequestConnector.parseResponseContent(content); + + assertNotNull(responseCommon); + } +} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/util/SDNCRequestIdUtilTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/util/SDNCRequestIdUtilTest.java new file mode 100644 index 0000000000..7ba8b68602 --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/java/org/onap/so/adapters/sdnc/util/SDNCRequestIdUtilTest.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - 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.so.adapters.sdnc.util; + +import static org.junit.Assert.assertEquals; + +import java.util.UUID; + +import org.junit.Test; + + +public class SDNCRequestIdUtilTest { + + /** + * Test method for {@link org.onap.so.adapters.sdnc.SDNCRequestIdUtil#getSDNCOriginalRequestId()}. + */ + @Test + public final void testGetSDNCOriginalRequestId () { + String originalRequestId = UUID.randomUUID().toString(); + String postfixedRequestId = originalRequestId + "-1466203712068"; + String postfixedRequestId2 = originalRequestId + "-1466203712068-2"; + + assertEquals(originalRequestId, SDNCRequestIdUtil.getSDNCOriginalRequestId(postfixedRequestId)); + assertEquals(postfixedRequestId2, SDNCRequestIdUtil.getSDNCOriginalRequestId(postfixedRequestId2)); + + } + +} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/ObjectFactoryTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/ObjectFactoryTest.java deleted file mode 100644 index c3949a6a79..0000000000 --- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/ObjectFactoryTest.java +++ /dev/null @@ -1,113 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.openecomp.mso.adapters.sdnc; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.hamcrest.CoreMatchers.containsString; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.io.StringWriter; -import java.nio.charset.Charset; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; - -import org.junit.Test; - -public class ObjectFactoryTest { - - private Marshaller jaxbMarshaller; - private Unmarshaller jaxbUnmarshaller; - - /** - * Test method for {@link org.openecomp.mso.adapters.sdnc.ObjectFactory#createRequestHeader()}. - */ - @Test - public final void testCreateRequestHeader () { - ObjectFactory of = new ObjectFactory (); - RequestHeader rh = of.createRequestHeader (); - rh.setCallbackUrl ("callback"); - rh.setMsoAction ("action"); - rh.setRequestId ("reqid"); - rh.setSvcAction ("svcAction"); - rh.setSvcInstanceId ("svcId"); - rh.setSvcOperation ("op"); - - try { - JAXBContext jaxbContext = JAXBContext.newInstance(RequestHeader.class); - jaxbMarshaller = jaxbContext.createMarshaller(); - - JAXBContext jaxbContext2 = JAXBContext.newInstance(RequestHeader.class); - jaxbUnmarshaller = jaxbContext2.createUnmarshaller(); - } - catch (JAXBException e) { - e.printStackTrace (); - fail(); - return; - } - - StringWriter writer = new StringWriter(); - try { - jaxbMarshaller.marshal (rh, writer); - } catch (JAXBException e) { - e.printStackTrace(); - fail (); - } - String marshalled = writer.toString (); - assertThat(marshalled, containsString("reqid")); - - InputStream inputStream = new ByteArrayInputStream(marshalled.getBytes(Charset.forName("UTF-8"))); - try { - RequestHeader res2 = (RequestHeader) jaxbUnmarshaller.unmarshal (inputStream); - assertEquals("callback", res2.getCallbackUrl ()); - assertEquals("action", res2.getMsoAction ()); - assertEquals("op", res2.getSvcOperation ()); - } catch (JAXBException e) { - e.printStackTrace(); - fail(); - } - } - - /** - * Test method for {@link org.openecomp.mso.adapters.sdnc.ObjectFactory#createSDNCAdapterResponse()}. - */ - @Test - public final void testCreateSDNCAdapterResponse () { - ObjectFactory of = new ObjectFactory (); - SDNCAdapterResponse ar = of.createSDNCAdapterResponse (); - assertNotNull(ar); - } - - @Test - public final void testCreateSDNCAdapterRequest () { - ObjectFactory of = new ObjectFactory (); - SDNCAdapterRequest ar = of.createSDNCAdapterRequest (); - assertNotNull(ar); - } - -} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequestTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequestTest.java deleted file mode 100644 index b9d88406f9..0000000000 --- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequestTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.openecomp.mso.adapters.sdnc; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.BeforeClass; -import org.junit.Test; -import org.openecomp.mso.adapters.sdnc.SDNCAdapterRequest; -import org.openecomp.mso.adapters.sdnc.RequestHeader; - - -public class SDNCAdapterRequestTest { - - static Object sd= new SDNCAdapterRequest(); - static RequestHeader rh=new RequestHeader(); - - @BeforeClass - public static final void RHeader() - { - rh.setCallbackUrl("callback"); - rh.setMsoAction ("action"); - rh.setRequestId ("reqid"); - rh.setSvcAction ("svcAction"); - rh.setSvcInstanceId ("svcId"); - rh.setSvcOperation ("op"); - } - @Test - public final void testtoString(){ - ((SDNCAdapterRequest) sd).setRequestData("data"); - ((SDNCAdapterRequest) sd).setRequestHeader(rh); - assertNotNull(((SDNCAdapterRequest) sd).getRequestData()) ; - assertEquals("data", ((SDNCAdapterRequest) sd).getRequestData()); - assertEquals(rh, ((SDNCAdapterRequest) sd).getRequestHeader()); - } - -} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeaderTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeaderTest.java deleted file mode 100644 index 39518e2081..0000000000 --- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeaderTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* -* ============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.client; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; - -public class CallbackHeaderTest { - - static CallbackHeader cb = new CallbackHeader(); - - @Test - public final void testCallbackHeader() { - cb.setRequestId("413658f4-7f42-482e-b834-23a5c15657da-1474471336781"); - cb.setResponseCode("200"); - cb.setResponseMessage("OK"); - assertNotNull(cb.getRequestId()); - assertNotNull(cb.getResponseCode()); - assertNotNull(cb.getResponseMessage()); - assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", cb.getRequestId()); - assertEquals("200", cb.getResponseCode()); - assertEquals("OK", cb.getResponseMessage()); - } - - @Test - public void testtoString() { - assertNotNull(cb.toString()); - } -} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java deleted file mode 100644 index ecffd1c5ad..0000000000 --- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequestTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.openecomp.mso.adapters.sdnc.client; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; -import org.openecomp.mso.adapters.sdnc.client.CallbackHeader; -import org.openecomp.mso.adapters.sdnc.client.SDNCAdapterCallbackRequest; - -public class SDNCAdapterCallbackRequestTest { - - static SDNCAdapterCallbackRequest sdc = new SDNCAdapterCallbackRequest(); - static CallbackHeader ch = new CallbackHeader("413658f4-7f42-482e-b834-23a5c15657da-1474471336781","200","OK"); - - @Test - public void testSDNCAdapterCallbackRequest() - { - sdc.setCallbackHeader(ch); - sdc.setRequestData("data"); - assertNotNull(sdc.getCallbackHeader()); - assertNotNull(sdc.getRequestData()); - assertEquals(ch, sdc.getCallbackHeader()); - assertEquals("data", sdc.getRequestData()); - - } - - @Test - public void testtoString() - { - assertNotNull(ch.toString()); - assertNotNull(sdc.toString()); - } - -} - - diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/InvestigationTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/InvestigationTest.java deleted file mode 100644 index 234a9d2272..0000000000 --- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/impl/InvestigationTest.java +++ /dev/null @@ -1,114 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.openecomp.mso.adapters.sdnc.impl; - -import java.io.File; -import java.io.IOException; -import java.io.StringReader; -import java.util.Scanner; -import java.util.UUID; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.Test; -import org.openecomp.mso.properties.MsoJavaProperties; -import org.openecomp.mso.properties.MsoPropertiesException; -import org.openecomp.mso.properties.MsoPropertiesFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -public class InvestigationTest { - - private static MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory(); - - public static final String SDNC_PROP = MsoJavaProperties.class.getClassLoader().getResource("mso.sdnc.properties").toString().substring(5); - - @Before - public final void initBeforeEachTest() throws MsoPropertiesException { - msoPropertiesFactory.removeAllMsoProperties(); - msoPropertiesFactory.initializeMsoProperties("MSO_PROP_SDNC_ADAPTER", SDNC_PROP); - } - - @AfterClass - public static final void kill () throws MsoPropertiesException { - - msoPropertiesFactory.removeMsoProperties("MSO_PROP_SDNC_ADAPTER"); - } - - @Test - public void run() throws ParserConfigurationException, IOException, SAXException { - - RequestTunables rt = new RequestTunables("reqid","","svc-topology-operation","delete", msoPropertiesFactory); - rt.setTunables(); - /*Document reqDoc = parse(); - NodeList nodeList = reqDoc.getElementsByTagName("sdncadapterworkflow:SDNCRequestData"); - Node node = null; - System.out.println("nodeList length: "+ nodeList.getLength()); - for (int i =0; ic26dfed652164d60a17461734422b085HOSTNAME\"" + EOL + - " }" + EOL + - "}" + EOL; - - private final String SDNC_SERVICE_RESPONSE = - "{" + EOL + - " \"SDNCServiceResponse\": {" + EOL + - " \"sdncRequestId\": \"413658f4-7f42-482e-b834-23a5c15657da-1474471336781\"," + EOL + - " \"responseCode\": \"200\"," + EOL + - "((RESPONSE-MESSAGE))" + - " \"ackFinalIndicator\": \"Y\"" + EOL + - "((RESPONSE-PARAMS))" + - " }" + EOL + - "}" + EOL; - - private final String SDNC_SERVICE_ERROR = - "{" + EOL + - " \"SDNCServiceError\": {" + EOL + - " \"sdncRequestId\": \"413658f4-7f42-482e-b834-23a5c15657da-1474471336781\"," + EOL + - " \"responseCode\": \"500\"," + EOL + - "((RESPONSE-MESSAGE))" + - " \"ackFinalIndicator\": \"Y\"" + EOL + - " }" + EOL + - "}" + EOL; - - private final String SDNC_EVENT = - "{" + EOL + - " \"SDNCEvent\": {" + EOL + - " \"eventType\": \"ACTIVATION\"," + EOL + - " \"eventCorrelatorType\": \"HOST-NAME\"," + EOL + - " \"eventCorrelator\": \"USOSTCDALTX0101UJZZ31\"" + EOL + - "((EVENT-PARAMS))" + - " }" + EOL + - "}" + EOL; - - private final String PARAMS = - "{\"P1\":\"V1\",\"P2\":\"V2\",\"P3\":\"V3\"}"; - - @Test - public final void jsonToSDNCServiceRequest() throws Exception { - logTest(); - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); - - String json = SDNC_SERVICE_REQUEST; - json = json.replace("((BP-TIMEOUT))", "\"bpTimeout\": \"" + "PT5M" + "\"," + EOL); - - SDNCServiceRequest object = mapper.readValue(json, SDNCServiceRequest.class); - assertEquals("413658f4-7f42-482e-b834-23a5c15657da", object.getRequestInformation().getRequestId()); - assertEquals("CCD", object.getRequestInformation().getSource()); - assertEquals("https://ccd-host:8080/notifications", object.getRequestInformation().getNotificationUrl()); - assertEquals("vHNFaaS", object.getServiceInformation().getServiceType()); - assertEquals("74e65b2b637441bca078e63e44bb511b", object.getServiceInformation().getServiceInstanceId()); - assertEquals("IST_SG_0902_3003", object.getServiceInformation().getSubscriberName()); - assertEquals("IST15_0902_3003", object.getServiceInformation().getSubscriberGlobalId()); - assertEquals("http://localhost:8080/mso/SDNCAdapterCallbackService", object.getBPNotificationUrl()); - assertEquals("PT5M", object.getBPTimeout()); - assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId()); - assertEquals("vhnf", object.getSDNCService()); - assertEquals("service-topology-cust-assign-operation", object.getSDNCOperation()); - assertEquals("XML", object.getSDNCServiceDataType()); - assertTrue(object.getSDNCServiceData().startsWith("")); - } - - @Test - public final void jsonToSDNCServiceRequestWithoutOptionalFields() throws Exception { - logTest(); - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); - - // bpTimeout is optional. - String json = SDNC_SERVICE_REQUEST; - json = json.replace("((BP-TIMEOUT))", ""); - - SDNCServiceRequest object = mapper.readValue(json, SDNCServiceRequest.class); - assertEquals("413658f4-7f42-482e-b834-23a5c15657da", object.getRequestInformation().getRequestId()); - assertEquals("CCD", object.getRequestInformation().getSource()); - assertEquals("https://ccd-host:8080/notifications", object.getRequestInformation().getNotificationUrl()); - assertEquals("vHNFaaS", object.getServiceInformation().getServiceType()); - assertEquals("74e65b2b637441bca078e63e44bb511b", object.getServiceInformation().getServiceInstanceId()); - assertEquals("IST_SG_0902_3003", object.getServiceInformation().getSubscriberName()); - assertEquals("IST15_0902_3003", object.getServiceInformation().getSubscriberGlobalId()); - assertEquals("http://localhost:8080/mso/SDNCAdapterCallbackService", object.getBPNotificationUrl()); - assertNull(object.getBPTimeout()); - assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId()); - assertEquals("vhnf", object.getSDNCService()); - assertEquals("service-topology-cust-assign-operation", object.getSDNCOperation()); - assertEquals("XML", object.getSDNCServiceDataType()); - assertTrue(object.getSDNCServiceData().startsWith("")); - } - - @Test - public final void jsonFromSDNCServiceRequest() throws Exception { - logTest(); - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); - - // Convert source json string to object. - String json1 = SDNC_SERVICE_REQUEST; - json1 = json1.replace("((BP-TIMEOUT))", "\"bpTimeout\": \"" + "PT5M" + "\"," + EOL); - SDNCServiceRequest object1 = mapper.readValue(json1, SDNCServiceRequest.class); - - // Convert resulting object back to json. - String json2 = object1.toJson(); - System.out.println("Generated JSON for " + object1.getClass().getSimpleName() - + ":" + System.lineSeparator() + json2); - assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceRequest\":{")); - - // Convert generated json string to another object. - SDNCServiceRequest object2 = mapper.readValue(json2, SDNCServiceRequest.class); - - // Compare the first object to the second object. - assertTrue(serializedEquals(object1, object2)); - } - - @Test - public final void jsonFromSDNCServiceRequestWithoutOptionalFields() throws Exception { - logTest(); - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); - - // Convert source json string to object. - String json1 = SDNC_SERVICE_REQUEST; - json1 = json1.replace("((BP-TIMEOUT))", ""); - SDNCServiceRequest object1 = mapper.readValue(json1, SDNCServiceRequest.class); - - // Convert resulting object back to json. - String json2 = object1.toJson(); - System.out.println("Generated JSON for " + object1.getClass().getSimpleName() - + ":" + System.lineSeparator() + json2); - assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceRequest\":{")); - - // Convert generated json string to another object. - SDNCServiceRequest object2 = mapper.readValue(json2, SDNCServiceRequest.class); - - // Compare the first object to the second object. - assertTrue(serializedEquals(object1, object2)); - } - - @Test - public final void jsonToSDNCServiceResponse() throws Exception { - logTest(); - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); - - String json = SDNC_SERVICE_RESPONSE; - json = json.replace("((RESPONSE-MESSAGE))", " \"responseMessage\": \"" + "OK" + "\"," + EOL); - json = json.replace(EOL + "((RESPONSE-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL); - - SDNCServiceResponse object = mapper.readValue(json, SDNCServiceResponse.class); - assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId()); - assertEquals("200", object.getResponseCode()); - assertEquals("OK", object.getResponseMessage()); - assertEquals("Y", object.getAckFinalIndicator()); - assertEquals("V1", object.getParams().get("P1")); - assertEquals("V2", object.getParams().get("P2")); - assertEquals("V3", object.getParams().get("P3")); - } - - @Test - public final void jsonToSDNCServiceResponseWithoutOptionalFields() throws Exception { - logTest(); - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); - - // responseMessage is optional. - String json = SDNC_SERVICE_RESPONSE; - json = json.replace("((RESPONSE-MESSAGE))", ""); - json = json.replace("((RESPONSE-PARAMS))", ""); - - SDNCServiceResponse object = mapper.readValue(json, SDNCServiceResponse.class); - assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId()); - assertEquals("200", object.getResponseCode()); - assertNull(object.getResponseMessage()); - assertEquals("Y", object.getAckFinalIndicator()); - assertNull(object.getParams()); - } - - @Test - public final void jsonFromSDNCServiceResponse() throws Exception { - logTest(); - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); - - // Convert source json string to object. - String json1 = SDNC_SERVICE_RESPONSE; - json1 = json1.replace("((RESPONSE-MESSAGE))", "\"responseMessage\": \"" + "OK" + "\"," + EOL); - json1 = json1.replace(EOL + "((RESPONSE-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL); - SDNCServiceResponse object1 = mapper.readValue(json1, SDNCServiceResponse.class); - - // Convert resulting object back to json. - String json2 = object1.toJson(); - System.out.println("Generated JSON for " + object1.getClass().getSimpleName() - + ":" + System.lineSeparator() + json2); - assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceResponse\":{")); - - // Convert generated json string to another object. - SDNCServiceResponse object2 = mapper.readValue(json2, SDNCServiceResponse.class); - - // Compare the first object to the second object. - assertTrue(serializedEquals(object1, object2)); - } - - @Test - public final void jsonFromSDNCServiceResponseWithoutOptionalFields() throws Exception { - logTest(); - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); - - // Convert source json string to object. - String json1 = SDNC_SERVICE_RESPONSE; - json1 = json1.replace("((RESPONSE-MESSAGE))", ""); - json1 = json1.replace("((RESPONSE-PARAMS))", ""); - SDNCServiceResponse object1 = mapper.readValue(json1, SDNCServiceResponse.class); - - // Convert resulting object back to json. - String json2 = object1.toJson(); - System.out.println("Generated JSON for " + object1.getClass().getSimpleName() - + ":" + System.lineSeparator() + json2); - assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceResponse\":{")); - - // Convert generated json string to another object. - SDNCServiceResponse object2 = mapper.readValue(json2, SDNCServiceResponse.class); - - // Compare the first object to the second object. - assertTrue(serializedEquals(object1, object2)); - } - - @Test - public final void jsonToSDNCServiceError() throws Exception { - logTest(); - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); - - String json = SDNC_SERVICE_ERROR; - json = json.replace("((RESPONSE-MESSAGE))", "\"responseMessage\": \"" + "SOMETHING BAD" + "\"," + EOL); - - SDNCServiceError object = mapper.readValue(json, SDNCServiceError.class); - assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId()); - assertEquals("500", object.getResponseCode()); - assertEquals("SOMETHING BAD", object.getResponseMessage()); - assertEquals("Y", object.getAckFinalIndicator()); - } - - @Test - public final void jsonToSDNCServiceErrorWithoutOptionalFields() throws Exception { - logTest(); - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); - - // responseMessage is optional. - String json = SDNC_SERVICE_ERROR; - json = json.replace("((RESPONSE-MESSAGE))", ""); - - SDNCServiceError object = mapper.readValue(json, SDNCServiceError.class); - assertEquals("413658f4-7f42-482e-b834-23a5c15657da-1474471336781", object.getSDNCRequestId()); - assertEquals("500", object.getResponseCode()); - assertNull(object.getResponseMessage()); - assertEquals("Y", object.getAckFinalIndicator()); - } - - @Test - public final void jsonFromSDNCServiceError() throws Exception { - logTest(); - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); - - // Convert source json string to object. - String json1 = SDNC_SERVICE_ERROR; - json1 = json1.replace("((RESPONSE-MESSAGE))", "\"responseMessage\": \"" + "OK" + "\"," + EOL); - SDNCServiceError object1 = mapper.readValue(json1, SDNCServiceError.class); - - // Convert resulting object back to json. - String json2 = object1.toJson(); - System.out.println("Generated JSON for " + object1.getClass().getSimpleName() - + ":" + System.lineSeparator() + json2); - assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceError\":{")); - - // Convert generated json string to another object. - SDNCServiceError object2 = mapper.readValue(json2, SDNCServiceError.class); - - // Compare the first object to the second object. - assertTrue(serializedEquals(object1, object2)); - } - - @Test - public final void jsonFromSDNCServiceErrorWithoutOptionalFields() throws Exception { - logTest(); - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); - - // Convert source json string to object. - String json1 = SDNC_SERVICE_ERROR; - json1 = json1.replace("((RESPONSE-MESSAGE))", ""); - SDNCServiceError object1 = mapper.readValue(json1, SDNCServiceError.class); - - // Convert resulting object back to json. - String json2 = object1.toJson(); - System.out.println("Generated JSON for " + object1.getClass().getSimpleName() - + ":" + System.lineSeparator() + json2); - assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCServiceError\":{")); - - // Convert generated json string to another object. - SDNCServiceError object2 = mapper.readValue(json2, SDNCServiceError.class); - - // Compare the first object to the second object. - assertTrue(serializedEquals(object1, object2)); - } - - @Test - public final void jsonToSDNCEvent() throws Exception { - logTest(); - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); - - String json = SDNC_EVENT; - json = json.replace(EOL + "((EVENT-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL); - - SDNCEvent object = mapper.readValue(json, SDNCEvent.class); - assertEquals("ACTIVATION", object.getEventType()); - assertEquals("HOST-NAME", object.getEventCorrelatorType()); - assertEquals("USOSTCDALTX0101UJZZ31", object.getEventCorrelator()); - assertEquals("V1", object.getParams().get("P1")); - assertEquals("V2", object.getParams().get("P2")); - assertEquals("V3", object.getParams().get("P3")); - } - - @Test - public final void jsonToSDNCEventWithoutOptionalFields() throws Exception { - logTest(); - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); - - // params are optional. - String json = SDNC_EVENT; - json = json.replace("((EVENT-PARAMS))", ""); - - SDNCEvent object = mapper.readValue(json, SDNCEvent.class); - assertEquals("ACTIVATION", object.getEventType()); - assertEquals("HOST-NAME", object.getEventCorrelatorType()); - assertEquals("USOSTCDALTX0101UJZZ31", object.getEventCorrelator()); - assertNull(object.getParams()); - } - - @Test - public final void jsonFromSDNCEvent() throws Exception { - logTest(); - ObjectMapper mapper = new ObjectMapper(); - mapper.enable(SerializationFeature.WRAP_ROOT_VALUE); - mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE); - - // Convert source json string to object. - String json1 = SDNC_EVENT; - json1 = json1.replace(EOL + "((EVENT-PARAMS))", "," + EOL + " \"params\": " + PARAMS + EOL); - SDNCEvent object1 = mapper.readValue(json1, SDNCEvent.class); - - // Convert resulting object back to json. - String json2 = object1.toJson(); - System.out.println("Generated JSON for " + object1.getClass().getSimpleName() - + ":" + System.lineSeparator() + json2); - assertTrue(json2.replaceAll("\\s+","").startsWith("{\"SDNCEvent\":{")); - - // Convert generated json string to another object. - SDNCEvent object2 = mapper.readValue(json2, SDNCEvent.class); - - // Compare the first object to the second object. - assertTrue(serializedEquals(object1, object2)); - } - - /** - * Tests equality of two objects by comparing their serialized form. - * WARNING: this works pretty well as long as the objects don't contain - * collections like maps and sets that are semantically equal, but have - * different internal ordering of elements. - */ - private boolean serializedEquals(Serializable object1, Serializable object2) throws IOException { - ByteArrayOutputStream byteStream1 = new ByteArrayOutputStream(); - ObjectOutputStream objectStream1 = new ObjectOutputStream(byteStream1); - objectStream1.writeObject(object1); - objectStream1.close(); - - ByteArrayOutputStream byteStream2 = new ByteArrayOutputStream(); - ObjectOutputStream objectStream2 = new ObjectOutputStream(byteStream2); - objectStream2.writeObject(object2); - objectStream2.close(); - - return Arrays.equals(byteStream1.toByteArray(), byteStream2.toByteArray()); - } - - private void logTest() { - StackTraceElement[] st = Thread.currentThread().getStackTrace(); - String method = st[2].getMethodName(); - System.out.println("RUNNING TEST: " + method); - } -} diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/sdncrest/TypedRequestTunablesTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/sdncrest/TypedRequestTunablesTest.java deleted file mode 100644 index 5651f8adab..0000000000 --- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/sdncrest/TypedRequestTunablesTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.openecomp.mso.adapters.sdnc.sdncrest; - -import org.junit.Assert; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; - -public class TypedRequestTunablesTest { - - @Test - public void testTypedRequestTunables() { - - TypedRequestTunables test = new TypedRequestTunables("reqId","myUrlSuffix"); - test.setServiceKey("service","operation"); - assertEquals(test.getReqId(),"reqId"); - Assert.assertNull(test.getError()); - Assert.assertNull(test.getReqMethod()); - Assert.assertNull(test.getTimeout()); - Assert.assertNull(test.getSdncUrl()); - Assert.assertNull(test.getHeaderName()); - Assert.assertNull(test.getNamespace()); - Assert.assertNull(test.getMyUrl()); - Assert.assertFalse(test.setTunables()); - - } - -} - diff --git a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtilTest.java b/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtilTest.java deleted file mode 100644 index 77d22e44df..0000000000 --- a/adapters/mso-sdnc-adapter/src/test/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtilTest.java +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - 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.openecomp.mso.adapters.sdnc.util; - -import static org.junit.Assert.assertEquals; - -import java.util.UUID; -import org.junit.Test; - - -public class SDNCRequestIdUtilTest { - - /** - * Test method for {@link org.openecomp.mso.adapters.sdnc.SDNCRequestIdUtil#getSDNCOriginalRequestId()}. - */ - @Test - public final void testGetSDNCOriginalRequestId () { - String originalRequestId = UUID.randomUUID().toString(); - String postfixedRequestId = originalRequestId + "-1466203712068"; - String postfixedRequestId2 = originalRequestId + "-1466203712068-2"; - - assertEquals(originalRequestId, SDNCRequestIdUtil.getSDNCOriginalRequestId(postfixedRequestId)); - assertEquals(postfixedRequestId2, SDNCRequestIdUtil.getSDNCOriginalRequestId(postfixedRequestId2)); - - } - -} diff --git a/adapters/mso-sdnc-adapter/src/test/resources/SdncServiceResponse.xml b/adapters/mso-sdnc-adapter/src/test/resources/SdncServiceResponse.xml new file mode 100644 index 0000000000..1aeda73bdf --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/resources/SdncServiceResponse.xml @@ -0,0 +1,12 @@ + + + 8ac1f688-70d1-4eb7-8422-5bf3ffe5c1ff-1525453645560 + 200 + Success: Activation Success + Y + + test + test + + + \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/test/resources/application-test.properties b/adapters/mso-sdnc-adapter/src/test/resources/application-test.properties new file mode 100644 index 0000000000..1ae9269ffa --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/resources/application-test.properties @@ -0,0 +1,102 @@ +#MSO SDNCA Properties go here +### +### UNIQUE SDNCURLs for Requests supported by SDNCA. URLS have unique tags eg a format like sdncurlXY (XY is unique eg digits) +### +org.onap.so.adapters.sdnc.sdncurl5=https://localhost:8443/restconf/config +org.onap.so.adapters.sdnc.sdncurl6=https://localhost:8443/restconf/operations/VNF-API: +org.onap.so.adapters.sdnc.sdncurl9=https://localhost:8443/restconf/operations/NORTHBOUND-API:service-topology-operation +org.onap.so.adapters.sdnc.sdncurl10=https://localhost:8443/restconf/operations/GENERIC-RESOURCE-API: +org.onap.so.adapters.sdnc.sdncurl12=https://localhost:8443/ +org.onap.so.adapters.sdnc.sdncurl14=http://localhost:8443/restconf/operations/GENERIC-RESOURCE-API: +### BPEL ASYNC CALLBACK/NOTIFICATION URL +### +org.onap.so.adapters.sdnc.bpelurl=http://localhost:8089/mso/SDNCAdapterCallbackService +org.onap.so.adapters.sdnc.rest.bpelurl=http://localhost:${wiremock.server.port}/mso/WorkflowMessage +### +### SDNC ASYNC NOTIFICATION/RESPONSE URL +### +org.onap.so.adapters.sdnc.myurl=http://localhost:8080/adapters/rest/SDNCNotify +### Production value diff from other servers +org.onap.so.adapters.sdnc.sdncauth=406B2AE613211B6FB52466DE6E1769AC +org.onap.so.adapters.sdnc.bpelauth=F8E9452B55DDE4CCE77547B0E748105C54CF5EF1351B4E2CBAABF2981EFE776D +org.onap.so.adapters.sdnc.sdncconnecttime=5000 +### +### Distinct Requests Supported by SDNCA. sdncurls added on top of file. fields may be null eg msoaction,operation resulting in .. construct +### +###org.onap.so.adapters.sdnc.MSOACTION.OPERATION.ACTION=METHOD|TIMEOUT|URL|HEADERNAME|NAMESPACE +### +org.onap.so.adapters.sdnc.infra..query=GET|60000|sdncurl5| +org.onap.so.adapters.sdnc.vfmodule..query=GET|60000|sdncurl12| +org.onap.so.adapters.sdnc...query=GET|60000|sdncurl14| +org.onap.so.adapters.sdnc...put=PUT|60000|sdncurl5| +org.onap.so.adapters.sdnc...restdelete=DELETE|60000|sdncurl5| +org.onap.so.adapters.sdnc..vnf-topology-operation.assign=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf +org.onap.so.adapters.sdnc..vnf-topology-operation.activate=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf +org.onap.so.adapters.sdnc..vnf-topology-operation.rollback=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf +org.onap.so.adapters.sdnc..vnf-topology-operation.delete=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf +org.onap.so.adapters.sdnc..vnf-topology-operation.changeassign=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf +org.onap.so.adapters.sdnc..vnf-topology-operation.changedelete=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf +org.onap.so.adapters.sdnc..network-topology-operation.reserve=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf +org.onap.so.adapters.sdnc..network-topology-operation.assign=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf +org.onap.so.adapters.sdnc..network-topology-operation.activate=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf +org.onap.so.adapters.sdnc..network-topology-operation.rollback=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf +org.onap.so.adapters.sdnc..network-topology-operation.delete=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf +org.onap.so.adapters.sdnc..network-topology-operation.changeassign=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf +org.onap.so.adapters.sdnc..network-topology-operation.changedelete=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf + + +org.onap.so.adapters.sdnc..service-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc..service-topology-operation.rollback=POST|270000|sdncur10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc..service-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc..service-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc.generic-resource.network-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc.generic-resource.network-topology-operation.unassign=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc.generic-resource.network-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc.generic-resource.network-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc.generic-resource.vnf-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc.generic-resource.vnf-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc.generic-resource.vnf-topology-operation.unassign=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc.generic-resource.vnf-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc.generic-resource.vnf-topology-operation.rollback=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc.generic-resource.vnf-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc.generic-resource.vnf-topology-operation.changeassign=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc.generic-resource.vnf-topology-operation.changedelete=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc.generic-resource.vf-module-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc.generic-resource.vf-module-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc.generic-resource.vf-module-topology-operation.unassign=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc.generic-resource.vf-module-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc.generic-resource.vf-module-topology-operation.rollback=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc.generic-resource.vf-module-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc.generic-resource.vf-module-topology-operation.changeassign=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc.generic-resource.vf-module-topology-operation.changedelete=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc..contrail-route-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc..contrail-route-topology-operation.unassign=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc..contrail-route-topology-operation.create=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc..contrail-route-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc..contrail-route-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc..contrail-route-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc..security-zone-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc..security-zone-topology-operation.unassign=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc..security-zone-topology-operation.create=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc..security-zone-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc..security-zone-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource +org.onap.so.adapters.sdnc..security-zone-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|org:onap:sdnc:northbound:generic-resource + + +### Application-dev.yaml file entries below + +server.port=8080 +server.tomcat.max-threads=50 +ssl-enable: false +spring.security.usercredentials[0].username=test +spring.security.usercredentials[0].password=$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu +spring.security.usercredentials[0].role=SDNC-Client +management.endpoints.enabled-by-default=false +management.endpoint.info.enabled=true +mso.logPath=/app/logs/sdnc +mso.site-name=dev +mso.async.core-pool-size=50 +mso.async.max-pool-size=50 +mso.async.queue-capacity=500 +mso.catalog.db.spring.endpoint="http://localhost:" +mso.db.auth:Basic YnBlbDptc28tZGItMTUwNyE= diff --git a/adapters/mso-sdnc-adapter/src/test/resources/logback-test.xml b/adapters/mso-sdnc-adapter/src/test/resources/logback-test.xml index a66a1e8cd3..3a3e57ac9d 100644 --- a/adapters/mso-sdnc-adapter/src/test/resources/logback-test.xml +++ b/adapters/mso-sdnc-adapter/src/test/resources/logback-test.xml @@ -20,28 +20,33 @@ - - - %d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n - - + + + %d{HH:mm:ss.SSS} [%thread] |%X{RequestId}| %-5level + %logger{1024} - %msg%n + + + - + - + - + + + + + - + - diff --git a/adapters/mso-sdnc-adapter/src/test/resources/mso.properties b/adapters/mso-sdnc-adapter/src/test/resources/mso.properties deleted file mode 100644 index 2428b512b1..0000000000 --- a/adapters/mso-sdnc-adapter/src/test/resources/mso.properties +++ /dev/null @@ -1,42 +0,0 @@ -### -# ============LICENSE_START======================================================= -# ECOMP MSO -# ================================================================================ -# 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========================================================= -### - -### SDNCURL -### -#EE# -org.openecomp.mso.adapters.sdnc.sdncgeturl=https://localhost:8443/restconf/config/L3SDN-API: -org.openecomp.mso.adapters.sdnc.sdncposturl=https://localhost:8443/restconf/operations/L3SDN-API: -### -### BPEL ASYNC CALLLBACK/NOTIFICATION URL -### -#EE# -org.openecomp.mso.adapters.sdnc.bpelurl=http://localhost:8080/active-bpel/services/SDNCAdapterCallbackV1 -### -### SDNC ASYNC NOTIFICATION/RESPONSE URL -### -#EE# -org.openecomp.mso.adapters.sdnc.myurl=https://localhost:8443/adapters/rest/SDNCNotify -### -org.openecomp.mso.adapters.sdnc.sdncauth=admin:admin -org.openecomp.mso.adapters.sdnc.bpelauth=avosAdmin:jboss123 -org.openecomp.mso.adapters.sdnc.sdncconnecttime=2000 -org.openecomp.mso.adapters.sdnc.sdncreadtime=5000 - -org.openecomp.mso.adapters.sdnc...query=toto diff --git a/adapters/mso-sdnc-adapter/src/test/resources/mso.sdnc.properties b/adapters/mso-sdnc-adapter/src/test/resources/mso.sdnc.properties deleted file mode 100644 index f53e2d2b65..0000000000 --- a/adapters/mso-sdnc-adapter/src/test/resources/mso.sdnc.properties +++ /dev/null @@ -1,152 +0,0 @@ -#MSO SDNCA Properties go here -### -### UNIQUE SDNCURLs for Requests supported by SDNCA. URLS have unique tags eg a format like sdncurlXY (XY is unique eg digits) -### -org.openecomp.mso.adapters.sdnc.sdncurl1=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/L3SDN-API: -org.openecomp.mso.adapters.sdnc.sdncurl2=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/config/L3SDN-API: -org.openecomp.mso.adapters.sdnc.sdncurl3=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/AicHoming: -org.openecomp.mso.adapters.sdnc.sdncurl4=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/Firewall-API: -org.openecomp.mso.adapters.sdnc.sdncurl5=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/config -org.openecomp.mso.adapters.sdnc.sdncurl6=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/VNF-API: -org.openecomp.mso.adapters.sdnc.sdncurl7=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/L3UCPE-API: -org.openecomp.mso.adapters.sdnc.sdncurl8=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/NBNC-API: -org.openecomp.mso.adapters.sdnc.sdncurl9=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/NORTHBOUND-API:service-topology-operation -org.openecomp.mso.adapters.sdnc.sdncurl10=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/GENERIC-RESOURCE-API: -org.openecomp.mso.adapters.sdnc.sdncurl11=https://sdncodl.it.us.03.aic.cip.att.com:8443/restconf/operations/VNFTOPOLOGYAIC-API: -org.openecomp.mso.adapters.sdnc.sdncurl12=https://sdncodl.it.us.03.aic.cip.att.com:8443/ -org.openecomp.mso.adapters.sdnc.sdncurl13=http://mtznjv1fcbc01.kvm.cip.att.com:8181/restconf/operations/SDNW-API: -#org.openecomp.mso.adapters.sdnc.sdncurl14=http://txcdtl01bb2697.itservices.sbc.com:8181/restconf/operations/GENERIC-RESOURCE-API:port-mirror-topology-operation -org.openecomp.mso.adapters.sdnc.sdncurl14=http://mtanjv9sdbc51-eth1-0.aic.cip.att.com:8443/restconf/operations/GENERIC-RESOURCE-API: -### BPEL ASYNC CALLBACK/NOTIFICATION URL -### -org.openecomp.mso.adapters.sdnc.bpelurl=http://mtanjv9mobp01-eth1-0.aic.cip.att.com:8080/mso/SDNCAdapterCallbackService -org.openecomp.mso.adapters.sdnc.rest.bpelurl=http://mtanjv9mobp01-eth1-0.aic.cip.att.com:8080/mso/WorkflowMessage -### -### SDNC ASYNC NOTIFICATION/RESPONSE URL -### -org.openecomp.mso.adapters.sdnc.myurl=http://mtanjv9moja02-eth1-0.aic.cip.att.com:8080/adapters/rest/SDNCNotify -### Production value diff from other servers -org.openecomp.mso.adapters.sdnc.sdncauth=406B2AE613211B6FB52466DE6E1769AC -org.openecomp.mso.adapters.sdnc.bpelauth=F8E9452B55DDE4CCE77547B0E748105C54CF5EF1351B4E2CBAABF2981EFE776D -org.openecomp.mso.adapters.sdnc.sdncconnecttime=5000 -### -### Distinct Requests Supported by SDNCA. sdncurls added on top of file. fields may be null eg msoaction,operation resulting in .. construct -### -###org.openecomp.mso.adapters.sdnc.MSOACTION.OPERATION.ACTION=METHOD|TIMEOUT|URL|HEADERNAME|NAMESPACE -### -org.openecomp.mso.adapters.sdnc..service-homing-operation.homing=POST|60000|sdncurl3|sdnc-homing-header|com:att:sdnctl:aicHoming -org.openecomp.mso.adapters.sdnc.infra..query=GET|60000|sdncurl5| -org.openecomp.mso.adapters.sdnc.mobility..query=GET|60000|sdncurl5| -org.openecomp.mso.adapters.sdnc.vfmodule..query=GET|60000|sdncurl12| -org.openecomp.mso.adapters.sdnc...query=GET|60000|sdncurl2| -org.openecomp.mso.adapters.sdnc...put=PUT|60000|sdncurl5| -org.openecomp.mso.adapters.sdnc...restdelete=DELETE|60000|sdncurl5| -org.openecomp.mso.adapters.sdnc.gammainternet.svc-topology-operation.assign=POST|60000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.svc-topology-operation.delete=POST|250000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.reserve=POST|60000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.activate=POST|90000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.delete=POST|250000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.turnup=POST|60000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.changereserve=POST|60000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.changedelete=POST|250000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc.gammainternet.service-configuration-operation.changeactivate=POST|60000|sdncurl1|sdnc-request-header|com:att:sdnctl:l3api -org.openecomp.mso.adapters.sdnc..feature-configuration-operation.activate=POST|60000|sdncurl4|sdnc-feature-request-header|com:att:sdnctl:firewallapi -org.openecomp.mso.adapters.sdnc..feature-configuration-operation.changeactivate=POST|60000|sdncurl4|sdnc-feature-request-header|com:att:sdnctl:firewallapi -org.openecomp.mso.adapters.sdnc..feature-configuration-operation.delete=POST|60000|sdncurl4|sdnc-feature-request-header|com:att:sdnctl:firewallapi -org.openecomp.mso.adapters.sdnc..vnf-topology-operation.assign=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..vnf-topology-operation.activate=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..vnf-topology-operation.rollback=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..vnf-topology-operation.delete=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..vnf-topology-operation.changeassign=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..vnf-topology-operation.changedelete=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.reserve=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.assign=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.activate=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.rollback=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.delete=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.changeassign=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc..network-topology-operation.changedelete=POST|270000|sdncurl6|sdnc-request-header|org:openecomp:sdnctl:vnf -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.prepare=POST|360000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.activate=POST|60000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.delete=POST|360000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.complete=POST|60000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.activatevnf=POST|600000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.designvnf=POST|60000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc.ucpe.service-configuration-operation.removevnf=POST|60000|sdncurl7|sdnc-request-header|com:att:sdnctl:l3ucpe -org.openecomp.mso.adapters.sdnc..svc-topology-operation.assign=POST|285000|sdncurl8|sdnc-request-header|com:att:sdnctl:nbncapi -org.openecomp.mso.adapters.sdnc..svc-topology-operation.activate=POST|285000|sdncurl8|sdnc-request-header|com:att:sdnctl:nbncapi -org.openecomp.mso.adapters.sdnc..svc-topology-operation.delete=POST|285000|sdncurl8|sdnc-request-header|com:att:sdnctl:nbncapi - -org.openecomp.mso.adapters.sdnc.service.ucpe.service-topology-assign-operation=POST|120000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.ucpe.service-topology-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.ucpe-vnf.service-topology-cust-assign-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.ucpe-vnf.service-topology-cust-stage-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.ucpe-vnf.service-topology-cust-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.ucpe-vnf.service-topology-cust-remove-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.dhv.service-topology-assign-operation=POST|120000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.infra.service-topology-infra-assign-operation=POST|120000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.infra.service-topology-infra-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vhnportal.service-topology-cust-assign-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vhnportal.service-topology-cust-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vhngw.service-topology-cust-assign-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vhngw.service-topology-infra-register-vnf-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vhngw.service-topology-cust-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vvig.service-topology-cust-assign-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.vvig.service-topology-cust-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.pe.service-topology-cust-assign-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.pe.service-topology-cust-stage-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 -org.openecomp.mso.adapters.sdnc.service.pe.service-topology-cust-activate-operation=POST|90000|sdncurl9|sdnc-request-header|com:att:sdnctl:northbound-api:v1 - -org.openecomp.mso.adapters.sdnc..service-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..service-topology-operation.rollback=POST|270000|sdncur10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..service-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..service-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.network-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.network-topology-operation.unassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.network-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.network-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.unassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.rollback=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.changeassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vnf-topology-operation.changedelete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.unassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.rollback=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.changeassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.generic-resource.vf-module-topology-operation.changedelete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..contrail-route-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..contrail-route-topology-operation.unassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..contrail-route-topology-operation.create=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..contrail-route-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..contrail-route-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..contrail-route-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..security-zone-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..security-zone-topology-operation.unassign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..security-zone-topology-operation.create=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..security-zone-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..security-zone-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..security-zone-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource - -org.openecomp.mso.adapters.sdnc..vnf-topology-aic-operation.assign=POST|270000|sdncurl11|sdnc-request-header|com:att:sdnctl:vnftopologyaic -org.openecomp.mso.adapters.sdnc..vnf-topology-aic-operation.activate=POST|270000|sdncurl11|sdnc-request-header|com:att:sdnctl:vnftopologyaic - -org.openecomp.mso.adapters.sdnc.TRANSPORT.service-topology-operation.assign=POST|270000|sdncurl13|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.TRANSPORT.service-topology-operation.rollback=POST|270000|sdncur13|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.TRANSPORT.service-topology-operation.delete=POST|270000|sdncurl13|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.TRANSPORT.service-topology-operation.deactivate=POST|270000|sdncurl13|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc.TRANSPORT.service-topology-operation.activate=POST|270000|sdncurl13|sdnc-request-header|com:att:sdnctl:generic-resource - -org.openecomp.mso.adapters.sdnc..port-mirror-topology-operation.assign=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..port-mirror-topology-operation.activate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..port-mirror-topology-operation.deactivate=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..port-mirror-topology-operation.enable=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..port-mirror-topology-operation.disable=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource -org.openecomp.mso.adapters.sdnc..port-mirror-topology-operation.delete=POST|270000|sdncurl10|sdnc-request-header|com:att:sdnctl:generic-resource - diff --git a/adapters/mso-sdnc-adapter/src/test/resources/sdncTestPayload.xml b/adapters/mso-sdnc-adapter/src/test/resources/sdncTestPayload.xml new file mode 100644 index 0000000000..643632ceed --- /dev/null +++ b/adapters/mso-sdnc-adapter/src/test/resources/sdncTestPayload.xml @@ -0,0 +1,34 @@ + + + b184fee2-3bda-4bb7-9475-e18dbeb994c0 + MSO + + + + CreateServiceInstance + + + + MSO-dev-service-type + + 52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f + aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e + 1.0 + MSO Test Network + + d46c06c9-dcb2-48c9-888f-35219a8c492e + + MSO_1610_dev + + + MSO-DEV-SI-1802-v6-2-19-113 + + + someUserParam + someValue + + + + \ No newline at end of file diff --git a/adapters/mso-sdnc-adapter/src/test/resources/sdnc_adapter_request.xml b/adapters/mso-sdnc-adapter/src/test/resources/sdnc_adapter_request.xml index 16a0399262..f132aa7497 100644 --- a/adapters/mso-sdnc-adapter/src/test/resources/sdnc_adapter_request.xml +++ b/adapters/mso-sdnc-adapter/src/test/resources/sdnc_adapter_request.xml @@ -1,7 +1,7 @@ + xmlns:ns5="http://org.onap/so/request/types/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1"> sdncRequestId-test serviceInstanceId-test @@ -25,12 +25,12 @@ serviceId-test subscriptionServiceType-test - + modelInvariantUuid-test modelUuid-test modelVersion-test modelName-test - + serviceInstanceId-test globalSubscriberId-test -- cgit 1.2.3-korg