aboutsummaryrefslogtreecommitdiffstats
path: root/appc-inbound/appc-design-services/provider/src/test/java/org/onap
diff options
context:
space:
mode:
Diffstat (limited to 'appc-inbound/appc-design-services/provider/src/test/java/org/onap')
-rw-r--r--appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestArifactHandlerClient.java73
-rw-r--r--appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestDBService.java242
-rw-r--r--appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestDbResponse.java51
-rw-r--r--appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestDesigndata.java102
-rw-r--r--appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestEscapeUtils.java52
-rw-r--r--appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestValidatorService.java131
6 files changed, 651 insertions, 0 deletions
diff --git a/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestArifactHandlerClient.java b/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestArifactHandlerClient.java
new file mode 100644
index 000000000..9f6622e36
--- /dev/null
+++ b/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestArifactHandlerClient.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.appc.design.validator;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.appc.design.services.util.ArtifactHandlerClient;
+import junit.framework.Assert;
+import static org.mockito.Mockito.*;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.Properties;
+import org.apache.commons.io.FileUtils;
+
+public class TestArifactHandlerClient {
+
+ @Test
+ public void testCreateArtifactData(){
+
+ try{
+ String content = FileUtils.readFileToString(new File("src/test/resources/uploadArtifact"));
+ String payload = " { \"userID\": \"00000\", \"vnf-type\" : \"DesigTest-VNF\", \"action\" : \"Configure\", \"artifact-name\":\"DesignRestArtifact_reference\",\"artifact-version\" :\"0.01\",\"artifact-type\" :\"DESIGNTOOL-TEST\",\"artifact-contents\": "
+ + content +
+ " } ";
+ String requestID ="0000";
+ ArtifactHandlerClient ahi = new ArtifactHandlerClient();
+ String value = ahi.createArtifactData(payload, requestID);
+ Assert.assertTrue(!value.isEmpty());
+ }catch(Exception e)
+ {
+ }
+ }
+
+ @Test
+ public void testExecute(){
+
+ try{
+ String content = FileUtils.readFileToString(new File("src/test/resources/uploadArtifact"));
+ String payload = " { \"userID\": \"00000\", \"vnf-type\" : \"DesigTest-VNF\", \"action\" : \"Configure\", \"artifact-name\":\"DesignRestArtifact_reference\",\"artifact-version\" :\"0.01\",\"artifact-type\" :\"DESIGNTOOL-TEST\",\"artifact-contents\": "
+ + content +
+ " } ";
+ String rpc = "Post";
+ ArtifactHandlerClient ahi = new ArtifactHandlerClient();
+ ahi.execute(payload, rpc);
+ }catch(Exception e)
+ {
+ }
+ }
+}
diff --git a/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestDBService.java b/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestDBService.java
new file mode 100644
index 000000000..ffc2cadce
--- /dev/null
+++ b/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestDBService.java
@@ -0,0 +1,242 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.appc.design.validator;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Properties;
+import org.apache.commons.io.FileUtils;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.appc.design.dbervices.DbService;
+import org.onap.appc.design.dbervices.DesignDBService;
+import org.onap.appc.design.propertyServices.PropertyUpdateService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import junit.framework.Assert;
+import org.powermock.reflect.Whitebox;
+
+public class TestDBService {
+
+ private final org.slf4j.Logger logger = LoggerFactory.getLogger(TestDBService.class);
+
+ @Ignore("Test is taking 60 seconds")
+ @Test
+ public void testGetDesigns() {
+ try {
+ String payload = "{\"userID\": \"0000\", \"vnf-type\" : \"DesigTest-VNF\" }";
+ DesignDBService dbservice = DesignDBService.initialise();
+ dbservice.execute("getDesigns", payload, "1234");
+ } catch (Exception e) {
+ }
+ }
+
+ @Ignore("Test is taking 120 seconds")
+ @Test
+ public void testGetStatus() {
+ try {
+ String content = FileUtils.readFileToString(new File("src/test/resources/uploadArtifact"));
+ String payload = " { \"userID\": \"0000\", \"vnf-type\" : \"DesigTest-VNF\", \"action\" : \"Configure\", \"artifact-name\":\"DesignRestArtifact_reference\",\"artifact-version\" :\"0.01\",\"artifact-type\" :\"DESIGNTOOL-TEST\",\"artifact-contents\": "+ content + " } ";
+ DesignDBService dbservice = DesignDBService.initialise();
+ DbService db = new DbService();
+ Whitebox.invokeMethod(db, "getDbLibService");
+ dbservice.execute("getStatus", payload, "1234");
+ } catch (Exception e) {
+ }
+ }
+
+ @Ignore("Test is taking 120 seconds")
+ @Test
+ public void testUploadArtifact() {
+ try {
+ String content = FileUtils.readFileToString(new File("src/test/resources/uploadArtifact"));
+ String payload = " { \"userID\": \"0000\", \"vnf-type\" : \"DesigTest-VNF\", \"action\" : \"Configure\", \"artifact-name\":\"DesignRestArtifact_reference\",\"artifact-version\" :\"0.01\",\"artifact-type\" :\"DESIGNTOOL-TEST\",\"artifact-contents\": "+ content + " } ";
+ DesignDBService dbservice = DesignDBService.initialise();
+ DbService db = new DbService();
+ Whitebox.invokeMethod(db, "getDbLibService");
+ dbservice.execute("uploadArtifact", payload, "1234");
+ } catch (Exception e) {
+ }
+ }
+
+ @Ignore("Test is taking 120 seconds")
+ @Test
+ public void testGetArtifact() {
+ try {
+ String content = FileUtils.readFileToString(new File("src/test/resources/uploadArtifact"));
+ String payload = " { \"userID\": \"0000\", \"vnf-type\" : \"DesigTest-VNF\", \"action\" : \"Configure\", \"artifact-name\":\"DesignRestArtifact_reference\",\"artifact-version\" :\"0.01\",\"artifact-type\" :\"DESIGNTOOL-TEST\",\"artifact-contents\": "+ content + " } ";
+ DesignDBService design = DesignDBService.initialise();
+ DbService db = new DbService();
+ Whitebox.invokeMethod(db, "getDbLibService");
+ design.execute("getArtifact", payload, "1234");
+ } catch (Exception e) {
+ }
+ }
+
+ @Ignore("Test is taking 120 seconds")
+ @Test
+ public void testSetIncart() {
+ try {
+ String content = FileUtils.readFileToString(new File("src/test/resources/uploadArtifact"));
+ String payload = " { \"userID\": \"0000\",\"action-level\":\"VNf\",\"protocol\":\"Test\", \"inCart\":\"Y\",\"vnf-type\" : \"DesigTest-VNF\", \"action\" : \"Configure\", \"artifact-name\":\"DesignRestArtifact_reference\",\"artifact-version\" :\"0.01\",\"artifact-type\" :\"DESIGNTOOL-TEST\",\"artifact-contents\": "+ content + " } ";
+ DesignDBService design = DesignDBService.initialise();
+ DbService db = new DbService();
+ Whitebox.invokeMethod(db, "getDbLibService");
+ design.execute("setInCart", payload, "1234");
+ } catch (Exception e) {
+ }
+ }
+
+ @Ignore("Test is taking 120 seconds")
+ @Test
+ public void testSetProtocolReference() {
+ try {
+ String content = FileUtils.readFileToString(new File("src/test/resources/uploadArtifact"));
+ String payload = " { \"userID\": \"0000\",\"action-level\":\"VNf\",\"protocol\":\"Test\", \"vnf-type\" : \"DesigTest-VNF\", \"action\" : \"Configure\", \"artifact-name\":\"DesignRestArtifact_reference\",\"artifact-version\" :\"0.01\",\"artifact-type\" :\"DESIGNTOOL-TEST\",\"artifact-contents\": "+ content + " } ";
+ DesignDBService design = DesignDBService.initialise();
+ DbService db = new DbService();
+ Whitebox.invokeMethod(db, "getDbLibService");
+ design.execute("setProtocolReference", payload, "1234");
+ } catch (Exception e) {
+ }
+ }
+
+ @Ignore("Test is taking 120 seconds")
+ @Test
+ public void testSetStatus() {
+ try {
+ String content = FileUtils.readFileToString(new File("src/test/resources/uploadArtifact"));
+ String payload = " { \"userID\": \"0000\",\"status\":\"Test\", \"vnf-type\" : \"DesigTest-VNF\", \"action\" : \"Configure\", \"artifact-name\":\"DesignRestArtifact_reference\",\"artifact-version\" :\"0.01\",\"artifact-type\" :\"DESIGNTOOL-TEST\",\"artifact-status\":\"\",\"artifact-contents\": "+ content + " } ";
+ DesignDBService design = DesignDBService.initialise();
+ DbService db = new DbService();
+ Whitebox.invokeMethod(db, "getDbLibService");
+ design.execute("setStatus", payload, "1234");
+ } catch (Exception e) {
+ }
+ }
+
+ @Ignore("Test is taking 120 seconds")
+ @Test
+ public void testGetArtifactReference() {
+ try {
+ String content = FileUtils.readFileToString(new File("src/test/resources/uploadArtifact"));
+ String payload = " { \"userID\": \"0000\",\"status\":\"Test\", \"vnf-type\" : \"DesigTest-VNF\", \"action\" : \"Configure\", \"artifact-name\":\"DesignRestArtifact_reference\",\"artifact-version\" :\"0.01\",\"artifact-type\" :\"DESIGNTOOL-TEST\",\"artifact-status\":\"\",\"artifact-contents\": "+ content + " } ";
+ DesignDBService design = DesignDBService.initialise();
+ DbService db = new DbService();
+ Whitebox.invokeMethod(db, "getDbLibService");
+ design.execute("getArtifactReference", payload, "1234");
+ } catch (Exception e) {
+ }
+ }
+
+ @Ignore("Test is taking 120 seconds")
+ @Test
+ public void testGetGuiReference() {
+ try {
+ String content = FileUtils.readFileToString(new File("src/test/resources/uploadArtifact"));
+ String payload = " { \"userID\": \"0000\",\"status\":\"Test\", \"vnf-type\" : \"DesigTest-VNF\", \"action\" : \"Configure\", \"artifact-name\":\"DesignRestArtifact_reference\",\"artifact-version\" :\"0.01\",\"artifact-type\" :\"DESIGNTOOL-TEST\",\"artifact-status\":\"\",\"artifact-contents\": "+ content + " } ";
+ DesignDBService design = DesignDBService.initialise();
+ DbService db = new DbService();
+ Whitebox.invokeMethod(db, "getDbLibService");
+ design.execute("getGuiReference", payload, "1234");
+ } catch (Exception e) {
+ }
+ }
+
+ @Test
+ public void testPropertyUpdateService() {
+ PropertyUpdateService ps = new PropertyUpdateService();
+ }
+
+ @Test
+ public void testLinkstatusRelationShip() {
+ try {
+ String content = FileUtils.readFileToString(new File("src/test/resources/uploadArtifact"));
+ String payload = " { \"userID\": \"0000\",\"status\":\"Test\", \"vnf-type\" : \"DesigTest-VNF\", \"action\" : \"Configure\", \"artifact-name\":\"DesignRestArtifact_reference\",\"artifact-version\" :\"0.01\",\"artifact-type\" :\"DESIGNTOOL-TEST\",\"artifact-status\":\"\",\"artifact-contents\": "+ content + " } ";
+ DesignDBService design = DesignDBService.initialise();
+ Whitebox.invokeMethod(design, "linkstatusRelationShip", 1, 1, payload);
+ } catch (Exception e) {
+ }
+ }
+
+ @Test
+ public void testGetSDCReferenceID() {
+
+ try {
+ String content = FileUtils.readFileToString(new File("src/test/resources/uploadArtifact"));
+ String payload = " { \"userID\": \"0000\",\"status\":\"Test\", \"vnf-type\" : \"DesigTest-VNF\", \"action\" : \"Configure\", \"artifact-name\":\"DesignRestArtifact_reference\",\"artifact-version\" :\"0.01\",\"artifact-type\" :\"DESIGNTOOL-TEST\",\"artifact-status\":\"\",\"artifact-contents\": "+ content + " } ";
+ DesignDBService design = DesignDBService.initialise();
+ Whitebox.invokeMethod(design, "getSDCReferenceID", payload);
+ } catch (Exception e) {
+ }
+ }
+
+ @Test
+ public void testGetDataFromActionStatus() {
+ try {
+ String content = FileUtils.readFileToString(new File("src/test/resources/uploadArtifact"));
+ String payload = " { \"userID\": \"0000\",\"status\":\"Test\", \"vnf-type\" : \"DesigTest-VNF\", \"action\" : \"Configure\", \"artifact-name\":\"DesignRestArtifact_reference\",\"artifact-version\" :\"0.01\",\"artifact-type\" :\"DESIGNTOOL-TEST\",\"artifact-status\":\"\",\"artifact-contents\": "+ content + " } ";
+ DesignDBService design = DesignDBService.initialise();
+ Whitebox.invokeMethod(design, "getDataFromActionStatus", payload, "Test");
+ } catch (Exception e) {
+ }
+ }
+
+ @Test
+ public void testSetActionStatus() {
+ try {
+ String content = FileUtils.readFileToString(new File("src/test/resources/uploadArtifact"));
+ String payload = " { \"userID\": \"0000\",\"status\":\"Test\", \"vnf-type\" : \"DesigTest-VNF\", \"action\" : \"Configure\", \"artifact-name\":\"DesignRestArtifact_reference\",\"artifact-version\" :\"0.01\",\"artifact-type\" :\"DESIGNTOOL-TEST\",\"artifact-status\":\"\",\"artifact-contents\": "+ content + " } ";
+ DesignDBService design = DesignDBService.initialise();
+ Whitebox.invokeMethod(design, "setActionStatus", payload, "Accepted");
+ } catch (Exception e) {
+ }
+ }
+
+ @Test
+ public void testGetSDCArtifactIDbyRequestID() {
+ try {
+ String content = FileUtils.readFileToString(new File("src/test/resources/uploadArtifact"));
+ String payload = " { \"userID\": \"0000\",\"status\":\"Test\", \"vnf-type\" : \"DesigTest-VNF\", \"action\" : \"Configure\", \"artifact-name\":\"DesignRestArtifact_reference\",\"artifact-version\" :\"0.01\",\"artifact-type\" :\"DESIGNTOOL-TEST\",\"artifact-status\":\"\",\"artifact-contents\": "+ content + " } ";
+ DesignDBService design = DesignDBService.initialise();
+ Whitebox.invokeMethod(design, "getSDCArtifactIDbyRequestID", "0");
+ } catch (Exception e) {
+ }
+ }
+
+ @Test
+ public void testCreateArtifactTrackingRecord() {
+ try {
+ String content = FileUtils.readFileToString(new File("src/test/resources/uploadArtifact"));
+ String payload = " { \"userID\": \"0000\",\"status\":\"Test\", \"vnf-type\" : \"DesigTest-VNF\", \"action\" : \"Configure\", \"artifact-name\":\"DesignRestArtifact_reference\",\"artifact-version\" :\"0.01\",\"artifact-type\" :\"DESIGNTOOL-TEST\",\"artifact-status\":\"\",\"artifact-contents\": "+ content + " } ";
+ DesignDBService design = DesignDBService.initialise();
+ Whitebox.invokeMethod(design, "createArtifactTrackingRecord",payload,"0",1,1);
+ } catch (Exception e) {
+ }
+ }
+}
diff --git a/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestDbResponse.java b/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestDbResponse.java
new file mode 100644
index 000000000..73e3dfc99
--- /dev/null
+++ b/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestDbResponse.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.appc.design.validator;
+
+import java.util.ArrayList;
+import org.junit.Test;
+import org.onap.appc.design.dbervices.DbResponseProcessor;
+
+public class TestDbResponse {
+
+ @Test
+ public void testDbResponse() {
+ DbResponseProcessor dbResponse = new DbResponseProcessor();
+ try {
+ dbResponse.parseResponse("Test", "getDesigns");
+ dbResponse.parseResponse("Test", "addInCart");
+ dbResponse.parseResponse("Test", "getArtifactReference");
+ dbResponse.parseResponse("Test", "getArtifact");
+ dbResponse.parseResponse("Test", "getGUIReference");
+ dbResponse.parseResponse("Test", "getStatus");
+ dbResponse.parseResponse("Test", "uploadArtifact");
+ dbResponse.parseResponse("Test", "setProtocolReference");
+ dbResponse.parseResponse("Test", "setInCart");
+ dbResponse.parseResponse("Test", "getStatus");
+ dbResponse.parseResponse("Test", "Test");
+ } catch (Exception e) {
+ }
+ }
+}
diff --git a/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestDesigndata.java b/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestDesigndata.java
new file mode 100644
index 000000000..f5c4bfffd
--- /dev/null
+++ b/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestDesigndata.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.appc.design.validator;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Test;
+import org.onap.appc.design.data.ArtifactInfo;
+import org.onap.appc.design.data.DesignInfo;
+import org.onap.appc.design.data.DesignRequest;
+import org.onap.appc.design.data.DesignResponse;
+import org.onap.appc.design.data.StatusInfo;
+
+public class TestDesigndata {
+
+ DesignResponse dr = new DesignResponse();
+
+ @Test
+ public void testSetUserID() {
+ dr.setUserId("00000");
+ dr.getUserId();
+ }
+
+ @Test
+ public void testSetDesignInfoList() {
+ DesignInfo di = new DesignInfo();
+ List<DesignInfo> li = new ArrayList<DesignInfo>();
+ di.setAction("TestAction");
+ di.setArtifact_name("TestName");
+ di.setArtifact_type("TestType");
+ di.setInCart("TestCart");
+ di.setProtocol("TestProtocol");
+ di.setVnf_type("TestVNF");
+ di.setVnfc_type("TestVNFC");
+ li.add(di);
+ dr.setDesignInfoList(li);
+ }
+
+ @Test
+ public void testSetArtifactInfo() {
+ ArtifactInfo ai = new ArtifactInfo();
+ List<ArtifactInfo> li = new ArrayList<ArtifactInfo>();
+ ai.setArtifact_content("TestContent");
+ li.add(ai);
+ dr.setArtifactInfo(li);
+ }
+
+ @Test
+ public void testStatusInfo() {
+ StatusInfo si = new StatusInfo();
+ List<StatusInfo> li = new ArrayList<StatusInfo>();
+ si.setAction("TestAction");
+ si.setAction_status("TestActionStatus");
+ si.setArtifact_status("TestArtifactStatus");
+ si.setVnf_type("TestVNF");
+ si.setVnfc_type("TestVNFC");
+ li.add(si);
+ dr.setStatusInfoList(li);
+ }
+
+ @Test
+ public void testDesignRequest() {
+ DesignRequest dreq = new DesignRequest();
+ dreq.setAction("TestAction");
+ dreq.setArtifact_contents("TestContent");
+ dreq.setArtifact_name("TestName");
+ dreq.setProtocol("TestProtocol");
+ dreq.setUserId("0000");
+ dreq.setVnf_type("testvnf");
+ dreq.setVnfc_type("testvnfc");
+ dreq.getAction();
+ dreq.getArtifact_contents();
+ dreq.getArtifact_name();
+ dreq.getProtocol();
+ dreq.getUserId();
+ dreq.getVnf_type();
+ dreq.getVnfc_type();
+ dreq.toString();
+ }
+}
diff --git a/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestEscapeUtils.java b/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestEscapeUtils.java
new file mode 100644
index 000000000..4a99d42e9
--- /dev/null
+++ b/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestEscapeUtils.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.appc.design.validator;
+
+import java.io.IOException;
+import org.junit.Test;
+import org.onap.appc.design.services.util.EscapeUtils;
+import org.onap.appc.design.xinterface.XInterfaceService;
+import org.onap.appc.design.xinterface.XResponseProcessor;
+import junit.framework.Assert;
+
+public class TestEscapeUtils {
+
+ @Test
+ public void testEscapeUtils() {
+
+ EscapeUtils escapeUtils = new EscapeUtils();
+ String str = escapeUtils.escapeSql("\\'Test Data\\'");
+ assert (true);
+ }
+
+ @Test
+ public void testXResponseProcessor(){
+
+ XResponseProcessor xr = new XResponseProcessor();
+ Object o = new Object();
+ xr.parseResponse(o, "Test");
+ Assert.assertEquals(null, null);
+ }
+}
diff --git a/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestValidatorService.java b/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestValidatorService.java
new file mode 100644
index 000000000..622483c66
--- /dev/null
+++ b/appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestValidatorService.java
@@ -0,0 +1,131 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Copyright (C) 2017 Amdocs
+ * =============================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.appc.design.validator;
+
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Properties;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.appc.design.services.util.DesignServiceConstants;
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import junit.framework.Assert;
+
+public class TestValidatorService {
+
+//Onap Migration
+
+ private final Logger logger = LoggerFactory.getLogger(TestValidatorService.class);
+ @Test
+ public void testValidXMLValidation(){
+ String response = null;
+ String xmlString = "<xml><configure>" + "<operation>create</operation>" + "<base>" + "<request-information>"
+ + "<source>SDN-GP</source>" + "</request-information>" + "</base>" + "</configure>" + "</xml>";
+
+ ValidatorService vs = new ValidatorService();
+ try {
+ response = vs.execute("", xmlString, "XML");
+ } catch (Exception e) {
+ }
+ Assert.assertEquals("success", response);
+
+ }
+ @Test
+ public void testInvalidXMLValidation() {
+ String response = null;
+ String xmlString = "<xml><configure>" + "<operation>create</operation>" + "<base>" + "<request-information>"
+ + "<source>SDN-GP</source>" + "</request-information>" + "</configure>" + "</xml>";
+
+ ValidatorService vs = new ValidatorService();
+ try {
+ response = vs.execute("", xmlString, "XML");
+ } catch (Exception e) {
+ }
+ Assert.assertEquals(null, response);
+ }
+ @Test
+ public void testYAMLValidation() {
+ String response = null;
+ String YAMLString = "en:";
+ ValidatorService vs = new ValidatorService();
+ try {
+ response = vs.execute("", YAMLString, "YAML");
+ } catch (Exception e) {
+ }
+ Assert.assertEquals("success", response);
+ }
+ @Test
+ public void testInvalidYAMLValidation() {
+ String response = null;
+ String YAMLString = "Test \n A:";
+ ValidatorService vs = new ValidatorService();
+ try {
+ response = vs.execute("", YAMLString, "YAML");
+ } catch (Exception e) {
+ }
+
+ Assert.assertEquals(null, response);
+ }
+
+ @Test
+ public void testJSONValidation(){
+ String response = null;
+ String YAMLString = "{\"Test\": \"Test1\" }";
+
+ ValidatorService vs = new ValidatorService();
+ try {
+ response = vs.execute("", YAMLString, "JSON");
+ } catch (Exception e) {
+ }
+ Assert.assertEquals("success", response);
+ }
+ @Test
+ public void testInvalidJSONValidation(){
+ String response = null;
+ String YAMLString = "{\"Test\" \"Test1\" }";
+ ValidatorService vs = new ValidatorService();
+ try {
+ response = vs.execute("", YAMLString, "JSON");
+ } catch (Exception e) {
+ }
+ Assert.assertEquals(null, response);
+ }
+
+ @Test
+ public void testInvalidvalidateVelocity(){
+ String response = null;
+ String validateVelocity = "{\"Test\" \"Test1\" }";
+ ValidatorService vs = new ValidatorService();
+ try {
+ response = vs.execute("", validateVelocity, "Velocity");
+ } catch (Exception e) {
+ }
+ Assert.assertEquals(null, response);
+
+ }
+}