diff options
Diffstat (limited to 'appc-inbound')
6 files changed, 510 insertions, 244 deletions
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 index bc0720eff..0ac893ed5 100644 --- 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 @@ -1,59 +1,73 @@ -package org.openecomp.appc.design.validator;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.openecomp.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);
- System.out.println(value);
- Assert.assertTrue(!value.isEmpty());;
-
-
- }catch(Exception e)
- {
- e.printStackTrace();
- }
-
- }
-
-
- @Test
- public void testExecute() throws Exception{
- 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 = "Test_Configure";
-
- ArtifactHandlerClient ahi = new ArtifactHandlerClient();
- ahi.execute(payload, rpc);
- }catch(Exception e)
- {
- e.printStackTrace();
- }
- }
-}
+/*- + * ============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.openecomp.appc.design.validator; + +import org.junit.Before; +import org.junit.Test; +import org.openecomp.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 new file mode 100644 index 000000000..d14abceb6 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestDBService.java @@ -0,0 +1,232 @@ +/*- + * ============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.openecomp.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.Test; +import org.openecomp.appc.design.dbervices.DbService; +import org.openecomp.appc.design.dbervices.DesignDBService; +import org.openecomp.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); + + @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) { + } + } + + @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) { + } + } + + @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) { + } + } + + @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) { + } + } + + @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) { + } + } + + @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) { + } + } + + @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) { + } + } + + @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) { + } + } + + @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 testGetASDCReferenceID() { + + 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, "getASDCReferenceID", 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 testGetASDCArtifactIDbyRequestID() { + 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, "getASDCArtifactIDbyRequestID", "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 new file mode 100644 index 000000000..b8ae12586 --- /dev/null +++ b/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/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.openecomp.appc.design.validator; + +import java.util.ArrayList; +import org.junit.Test; +import org.openecomp.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 index 4d46a0e45..1a82ecdea 100644 --- 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 @@ -26,91 +26,77 @@ package org.openecomp.appc.design.validator; import java.util.ArrayList; import java.util.List; - -import org.junit.Rule; import org.junit.Test; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.opendaylight.yang.gen.v1.org.openecomp.appc.rev170627.DbserviceInput; import org.openecomp.appc.design.data.ArtifactInfo; import org.openecomp.appc.design.data.DesignInfo; import org.openecomp.appc.design.data.DesignRequest; import org.openecomp.appc.design.data.DesignResponse; import org.openecomp.appc.design.data.StatusInfo; -import org.openecomp.appc.design.dbervices.DbResponseProcessor; -import org.openecomp.appc.design.dbervices.DbService; -import org.openecomp.appc.design.services.impl.DesignServicesImpl; -import org.openecomp.sdnc.sli.resource.dblib.DbLibService; public class TestDesigndata { - - - - DesignResponse dr = new DesignResponse(); - - - - @Test - public void testSetUserID(){ - - dr.setUserId("00000"); - - String str = dr.getUserId(); - System.out.println(str); - } - - @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); - System.out.println(dr.getDesignInfoList()); - } - - @Test - public void testSetArtifactInfo(){ - ArtifactInfo ai = new ArtifactInfo(); - List<ArtifactInfo> li = new ArrayList<ArtifactInfo>(); - ai.setArtifact_content("TestContent"); - li.add(ai); - dr.setArtifactInfo(li); - System.out.println(dr.getArtifactInfo()); - - } - @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); - System.out.println(dr.getStatusInfoList()); - } - @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"); - System.out.println(dreq.getAction() + dreq.getArtifact_contents() + dreq.getArtifact_name() + dreq.getProtocol() + dreq.getUserId() + dreq.getVnf_type()+ dreq.getVnfc_type()); - System.out.println(dreq.toString()); - } - + 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/openecomp/appc/design/validator/TestEscapeUtils.java b/appc-inbound/appc-design-services/provider/src/test/java/org/openecomp/appc/design/validator/TestEscapeUtils.java index e3c5c17f4..fc9a765d7 100644 --- 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 @@ -1,19 +1,52 @@ -package org.openecomp.appc.design.validator;
-
-import org.junit.Test;
-import org.openecomp.appc.design.services.util.EscapeUtils;
-
-public class TestEscapeUtils {
-
- @Test
- public void EscapeUtils(){
-
- EscapeUtils escapeUtils = new EscapeUtils();
-
- String str = escapeUtils.escapeSql("\\'Test Data\\'");
-
- System.out.println(str);
-
-
- }
-}
+/*- + * ============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.openecomp.appc.design.validator; + +import java.io.IOException; +import org.junit.Test; +import org.openecomp.appc.design.services.util.EscapeUtils; +import org.openecomp.appc.design.xinterface.XInterfaceService; +import org.openecomp.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 index 05aeb3008..42741fad6 100644 --- 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 @@ -28,14 +28,12 @@ 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.openecomp.appc.design.services.util.DesignServiceConstants; import org.openecomp.sdnc.sli.SvcLogicContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import junit.framework.Assert; public class TestValidatorService { @@ -43,138 +41,90 @@ public class TestValidatorService { //Onap Migration private final Logger logger = LoggerFactory.getLogger(TestValidatorService.class); -@Test - public void testvalidXMLValidation() throws Exception { + @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>"; - + 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"); + try { + response = vs.execute("", xmlString, "XML"); + } catch (Exception e) { } - catch(Exception e){ - System.out.println(e.getMessage()); - } - Assert.assertEquals("success", response); } @Test - public void testInvalidXMLValidation() throws Exception { + public void testInvalidXMLValidation() { String response = null; - String xmlString = "<xml><configure>" - + "<operation>create</operation>" - + "<base>" - + "<request-information>" - + "<source>SDN-GP</source>" - + "</request-information>" - + "</configure>" - + "</xml>"; - + 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"); + try { + response = vs.execute("", xmlString, "XML"); + } catch (Exception e) { } - catch(Exception e){ - System.out.println(e.getMessage()); - } - Assert.assertEquals(null, response); - } @Test - public void testYAMLValidation() throws Exception { + public void testYAMLValidation() { String response = null; String YAMLString = "en:"; - - ValidatorService vs = new ValidatorService(); - try{ - response = vs.execute("", YAMLString, "YAML"); + try { + response = vs.execute("", YAMLString, "YAML"); + } catch (Exception e) { } - catch(Exception e){ - System.out.println(e.getMessage()); - e.printStackTrace(); - } - Assert.assertEquals("success", response); - } @Test - public void testInvalidYAMLValidation() throws Exception { + public void testInvalidYAMLValidation() { String response = null; String YAMLString = "Test \n A:"; - - ValidatorService vs = new ValidatorService(); - try{ - response = vs.execute("", YAMLString,"YAML"); - } - catch(Exception e){ - System.out.println(e.getMessage()); + try { + response = vs.execute("", YAMLString, "YAML"); + } catch (Exception e) { } Assert.assertEquals(null, response); - } - -@Test - public void testJSONValidation() throws Exception { + + @Test + public void testJSONValidation(){ String response = null; String YAMLString = "{\"Test\": \"Test1\" }"; - - + ValidatorService vs = new ValidatorService(); - try{ - response = vs.execute("", YAMLString, "JSON"); + try { + response = vs.execute("", YAMLString, "JSON"); + } catch (Exception e) { } - catch(Exception e){ - System.out.println(e.getMessage()); - - } Assert.assertEquals("success", response); - } @Test - public void testInvalidJSONValidation() throws Exception { + public void testInvalidJSONValidation(){ String response = null; String YAMLString = "{\"Test\" \"Test1\" }"; - - ValidatorService vs = new ValidatorService(); - try{ - response = vs.execute("", YAMLString, "JSON"); + try { + response = vs.execute("", YAMLString, "JSON"); + } catch (Exception e) { } - catch(Exception e){ - System.out.println(e.getMessage()); - - } Assert.assertEquals(null, response); - } @Test - public void testainvalidvalidateVelocity() throws Exception { + public void testInvalidvalidateVelocity(){ String response = null; String validateVelocity = "{\"Test\" \"Test1\" }"; - - ValidatorService vs = new ValidatorService(); - try{ - response = vs.execute("", validateVelocity, "Velocity"); + try { + response = vs.execute("", validateVelocity, "Velocity"); + } catch (Exception e) { } - catch(Exception e){ - System.out.println(e.getMessage()); - - } Assert.assertEquals(null, response); } |