From 781b1a6df324419c846c84ea983c18fc8362bfd3 Mon Sep 17 00:00:00 2001 From: Patrick Brady Date: Wed, 13 Dec 2017 11:19:06 -0800 Subject: Third part of onap rename This part of the commit changes the folder structure on all other folders of appc. Change-Id: I8acfa11cdfcdcd36be0e137245d1dd7324f1abd3 Signed-off-by: Patrick Brady Issue-ID: APPC-13 --- .../design/validator/TestArifactHandlerClient.java | 73 +++++++ .../onap/appc/design/validator/TestDBService.java | 242 +++++++++++++++++++++ .../onap/appc/design/validator/TestDbResponse.java | 51 +++++ .../onap/appc/design/validator/TestDesigndata.java | 102 +++++++++ .../appc/design/validator/TestEscapeUtils.java | 52 +++++ .../design/validator/TestValidatorService.java | 131 +++++++++++ .../design/validator/TestArifactHandlerClient.java | 73 ------- .../appc/design/validator/TestDBService.java | 242 --------------------- .../appc/design/validator/TestDbResponse.java | 51 ----- .../appc/design/validator/TestDesigndata.java | 102 --------- .../appc/design/validator/TestEscapeUtils.java | 52 ----- .../design/validator/TestValidatorService.java | 131 ----------- 12 files changed, 651 insertions(+), 651 deletions(-) create mode 100644 appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestArifactHandlerClient.java create mode 100644 appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestDBService.java create mode 100644 appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestDbResponse.java create mode 100644 appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestDesigndata.java create mode 100644 appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestEscapeUtils.java create mode 100644 appc-inbound/appc-design-services/provider/src/test/java/org/onap/appc/design/validator/TestValidatorService.java delete mode 100644 appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestArifactHandlerClient.java delete mode 100644 appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestDBService.java delete mode 100644 appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestDbResponse.java delete mode 100644 appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestDesigndata.java delete mode 100644 appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestEscapeUtils.java delete mode 100644 appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestValidatorService.java (limited to 'appc-inbound/appc-design-services/provider/src/test') 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 li = new ArrayList(); + 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 li = new ArrayList(); + ai.setArtifact_content("TestContent"); + li.add(ai); + dr.setArtifactInfo(li); + } + + @Test + public void testStatusInfo() { + StatusInfo si = new StatusInfo(); + List li = new ArrayList(); + 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 = "" + "create" + "" + "" + + "SDN-GP" + "" + "" + "" + ""; + + 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 = "" + "create" + "" + "" + + "SDN-GP" + "" + "" + ""; + + 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); + + } +} diff --git a/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestArifactHandlerClient.java b/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestArifactHandlerClient.java deleted file mode 100644 index 9f6622e36..000000000 --- a/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestArifactHandlerClient.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ============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/openecomp/appc/design/validator/TestDBService.java b/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestDBService.java deleted file mode 100644 index ffc2cadce..000000000 --- a/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestDBService.java +++ /dev/null @@ -1,242 +0,0 @@ -/*- - * ============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/openecomp/appc/design/validator/TestDbResponse.java b/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestDbResponse.java deleted file mode 100644 index 73e3dfc99..000000000 --- a/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestDbResponse.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============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/openecomp/appc/design/validator/TestDesigndata.java b/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestDesigndata.java deleted file mode 100644 index f5c4bfffd..000000000 --- a/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestDesigndata.java +++ /dev/null @@ -1,102 +0,0 @@ -/*- - * ============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 li = new ArrayList(); - 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 li = new ArrayList(); - ai.setArtifact_content("TestContent"); - li.add(ai); - dr.setArtifactInfo(li); - } - - @Test - public void testStatusInfo() { - StatusInfo si = new StatusInfo(); - List li = new ArrayList(); - 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/openecomp/appc/design/validator/TestEscapeUtils.java b/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestEscapeUtils.java deleted file mode 100644 index 4a99d42e9..000000000 --- a/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestEscapeUtils.java +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * ============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/openecomp/appc/design/validator/TestValidatorService.java b/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestValidatorService.java deleted file mode 100644 index 622483c66..000000000 --- a/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestValidatorService.java +++ /dev/null @@ -1,131 +0,0 @@ -/*- - * ============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 = "" + "create" + "" + "" - + "SDN-GP" + "" + "" + "" + ""; - - 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 = "" + "create" + "" + "" - + "SDN-GP" + "" + "" + ""; - - 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); - - } -} -- cgit