From 025301d08b061482c1f046d562bf017c8cbcfe8d Mon Sep 17 00:00:00 2001 From: ChrisC Date: Tue, 31 Jan 2017 11:40:03 +0100 Subject: Initial OpenECOMP MSO commit Change-Id: Ia6a7574859480717402cc2f22534d9973a78fa6d Signed-off-by: ChrisC --- .../mso/camunda/tests/CamundaRequestTest.java | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java (limited to 'mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java') diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java new file mode 100644 index 0000000000..bd2fee6f1e --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaRequestTest.java @@ -0,0 +1,81 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - 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========================================================= + */ + +package org.openecomp.mso.camunda.tests; + + + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; + +import org.codehaus.jackson.JsonGenerationException; +import org.codehaus.jackson.map.JsonMappingException; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.map.SerializationConfig; +import org.junit.Test; + +import org.openecomp.mso.apihandler.camundabeans.CamundaInput; +import org.openecomp.mso.apihandler.camundabeans.CamundaRequest; +import org.openecomp.mso.apihandler.common.CommonConstants; + +/** + * This class implements test methods of Camunda Beans. + * + * + */ +public class CamundaRequestTest { + + @Test + public final void testSerialization() throws JsonGenerationException, + JsonMappingException, IOException { + CamundaRequest camundaRequest = new CamundaRequest(); + CamundaInput camundaInput = new CamundaInput(); + CamundaInput host = new CamundaInput(); + CamundaInput schema = new CamundaInput(); + CamundaInput reqid = new CamundaInput(); + CamundaInput svcid = new CamundaInput(); + CamundaInput timeout = new CamundaInput(); + camundaInput + .setValue(" 155415ab-b4a7-4382-b4c6-d17d950604Layer3ServiceActivateRequestOMXhttps://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws50515631 SDN-ETHERNET-INTERNETHI/VLXM/950604//SW_INTERNETSubName01 MTSNJA4LCP1 "); + camundaRequest.setServiceInput(camundaInput); + host.setValue("localhost"); + camundaRequest.setHost(host); + schema.setValue("v1"); + camundaRequest.setSchema(schema); + reqid.setValue("reqid123"); + camundaRequest.setReqid(reqid); + svcid.setValue("svcid123"); + camundaRequest.setSvcid(svcid); + timeout.setValue(""); + camundaRequest.setTimeout(timeout); + ObjectMapper mapper = new ObjectMapper(); + mapper.configure(SerializationConfig.Feature.WRAP_ROOT_VALUE, true); + + String json = mapper.writeValueAsString(camundaRequest); + System.out.println(json); + assertEquals( + "{\"variables\":{\""+CommonConstants.CAMUNDA_SERVICE_INPUT+"\":{\"value\":\" 155415ab-b4a7-4382-b4c6-d17d950604Layer3ServiceActivateRequestOMXhttps://csi-tst-q22.it.att.com:22443/Services/com/cingular/csi/sdn/SendManagedNetworkStatusNotification.jws50515631 SDN-ETHERNET-INTERNETHI/VLXM/950604//SW_INTERNETSubName01 MTSNJA4LCP1 \",\"type\":\"String\"}" + + ",\"host\":{\"value\":\"localhost\",\"type\":\"String\"},\"att-mso-schema-version\":{\"value\":\"v1\",\"type\":\"String\"},\"att-mso-request-id\":{\"value\":\"reqid123\",\"type\":\"String\"},\"att-mso-service-instance-id\":{\"value\":\"svcid123\",\"type\":\"String\"},\"att-mso-service-request-timeout\":{\"value\":\"\",\"type\":\"String\"}}}", + json); + + } + +} -- cgit 1.2.3-korg