diff options
author | Dunietz, Irwin <id1681@att.com> | 2020-01-16 15:13:14 -0500 |
---|---|---|
committer | Takamune Cho <takamune.cho@att.com> | 2020-01-29 19:44:48 +0000 |
commit | b5fe8a69e90b950c07dc11af481eab7e9bab52c6 (patch) | |
tree | 3da81ce60554e65b93776b9aea647f3c6d8679ab /appc-inbound/appc-design-services/provider/src/test | |
parent | 9b32cb60360a2a2973c621053510718de0072111 (diff) |
Change code in appc dispatcher for new LCMs in R6
Also introduce some minor improvements to robustness, efficiency, & formatting.
Issue-ID: APPC-1789
Signed-off-by: Dunietz, Irwin <id1681@att.com>
Change-Id: I82d970c2f7cde6c8dab1222af86ea70ce93b7e50
Diffstat (limited to 'appc-inbound/appc-design-services/provider/src/test')
2 files changed, 109 insertions, 51 deletions
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 index 43105a79a..fe59637a6 100644 --- 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 @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Copyright (C) 2017 Amdocs * ============================================================================= @@ -11,15 +11,14 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * * ============LICENSE_END========================================================= */ @@ -31,19 +30,20 @@ import org.onap.appc.design.dbervices.DbResponseProcessor; public class TestDbResponse { @Test - public void testDbResponse() throws Exception{ + public void testDbResponse() throws Exception { DbResponseProcessor dbResponse = new DbResponseProcessor(); - 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", "getAppcTimestampUTC"); - + 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", "getAppcTimestampUTC"); + dbResponse.parseResponse("Test", "retrieveVnfPermissions"); + dbResponse.parseResponse("Test", "saveVnfPermissions"); } } 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 index 50f7ac65d..cbfca0aec 100644 --- 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 @@ -2,22 +2,21 @@ * ============LICENSE_START======================================================= * ONAP : APPC * ================================================================================ - * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2019 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. - * * ============LICENSE_END========================================================= */ @@ -25,12 +24,14 @@ package org.onap.appc.design.validator; import java.util.ArrayList; import java.util.List; +import org.junit.Assert; 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; +import org.onap.appc.design.data.UserPermissionInfo; public class TestDesigndata { @@ -38,64 +39,121 @@ public class TestDesigndata { @Test public void testSetUserID() { - dr.setUserId("00000"); - dr.getUserId(); + String userId = "0000"; + dr.setUserId(userId); + Assert.assertEquals("Unexpected getUserId value", userId, 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"); + String action = "TestAction"; + di.setAction(action); + Assert.assertEquals("Unexpected getAction value", action, di.getAction()); + String artifact_name = "TestName"; + di.setArtifact_name(artifact_name); + Assert.assertEquals("Unexpected getArtifact_name value", artifact_name, di.getArtifact_name()); + String artifact_type = "TestType"; + di.setArtifact_type(artifact_type); + Assert.assertEquals("Unexpected getArtifact_type value", artifact_type, di.getArtifact_type()); + String inCart = "TestCart"; + di.setInCart(inCart); + Assert.assertEquals("Unexpected getInCart value", inCart, di.getInCart()); + String protocol = "TestProtocol"; + di.setProtocol(protocol); + Assert.assertEquals("Unexpected getProtocol value", protocol, di.getProtocol()); + String vnf_type = "TestVNF"; + di.setVnf_type(vnf_type); + Assert.assertEquals("Unexpected getVnf_type value", vnf_type, di.getVnf_type()); + String vnfc_type = "TestVNFC"; + di.setVnfc_type(vnfc_type); + Assert.assertEquals("Unexpected getVnfc_type value", vnfc_type, di.getVnfc_type()); li.add(di); dr.setDesignInfoList(li); + Assert.assertEquals("Unexpected getDesignInfoList value", li, dr.getDesignInfoList()); } @Test public void testSetArtifactInfo() { ArtifactInfo ai = new ArtifactInfo(); List<ArtifactInfo> li = new ArrayList<ArtifactInfo>(); - ai.setArtifact_content("TestContent"); + String artifact_content = "TestContent"; + ai.setArtifact_content(artifact_content); + Assert.assertEquals("Unexpected getArtifact_content value", artifact_content, ai.getArtifact_content()); li.add(ai); dr.setArtifactInfo(li); + Assert.assertEquals("Unexpected getArtifactInfo value", li, 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"); + String action = "TestAction"; + si.setAction(action); + Assert.assertEquals("Unexpected getAction value", action, si.getAction()); + String action_status = "TestActionStatus"; + si.setAction_status(action_status); + Assert.assertEquals("Unexpected getAction_status value", action_status, si.getAction_status()); + String artifact_status = "TestArtifactStatus"; + si.setArtifact_status(artifact_status); + Assert.assertEquals("Unexpected getArtifact_status value", artifact_status, si.getArtifact_status()); + String vnf_type = "TestVNF"; + si.setVnf_type(vnf_type); + Assert.assertEquals("Unexpected getVnf_type value", vnf_type, si.getVnf_type()); + String vnfc_type = "TestVNFC"; + si.setVnfc_type(vnfc_type); + Assert.assertEquals("Unexpected getVnfc_type value", vnfc_type, si.getVnfc_type()); li.add(si); dr.setStatusInfoList(li); + Assert.assertEquals("Unexpected getStatusInfoList value", li, 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"); - dreq.getAction(); - dreq.getArtifact_contents(); - dreq.getArtifact_name(); - dreq.getProtocol(); - dreq.getUserId(); - dreq.getVnf_type(); - dreq.getVnfc_type(); - dreq.toString(); + String action = "TestAction"; + dreq.setAction(action); + Assert.assertEquals("Unexpected getAction value", action, dreq.getAction()); + String artifact_contents = "TestContent"; + dreq.setArtifact_contents(artifact_contents); + Assert.assertEquals("Unexpected getArtifact_contents value", artifact_contents, dreq.getArtifact_contents()); + String artifact_name = "TestName"; + dreq.setArtifact_name(artifact_name); + Assert.assertEquals("Unexpected getArtifact_name value", artifact_name, dreq.getArtifact_name()); + String protocol = "TestProtocol"; + dreq.setProtocol(protocol); + Assert.assertEquals("Unexpected getProtocol value", protocol, dreq.getProtocol()); + String userId = "0000"; + dreq.setUserId(userId); + Assert.assertEquals("Unexpected getUserId value", userId, dreq.getUserId()); + String vnf_type = "testvnf"; + dreq.setVnf_type(vnf_type); + Assert.assertEquals("Unexpected getVnf_type value", vnf_type, dreq.getVnf_type()); + String vnfc_type = "testvnfc"; + dreq.setVnfc_type(vnfc_type); + Assert.assertEquals("Unexpected getVnfc_type value", vnfc_type, dreq.getVnfc_type()); + String expecting = + "DesignRequest [userId=" + userId + ", vnf_type=" + vnf_type + ", vnfc_type=" + vnfc_type + ", protocol=" + + protocol + ", action=" + action + ", artifact_name=" + artifact_name + ", artifact_contents=" + + artifact_contents + "]"; + Assert.assertEquals("Unexpected toString value", expecting, dreq.toString()); } + + @Test + public void testUserPermissionInfo() { + UserPermissionInfo upi = new UserPermissionInfo(); + List<UserPermissionInfo> li = new ArrayList<UserPermissionInfo>(); + String userId = "uu1234"; + upi.setUserID(userId); + Assert.assertEquals("Unexpected getUserId value", userId, upi.getUserID()); + String permission = "owner"; + upi.setPermission(permission); + Assert.assertEquals("Unexpected getPermission value", permission, upi.getPermission()); + li.add(upi); + dr.setUsers(li); + Assert.assertEquals("Unexpected getUsers value", li, dr.getUsers()); + } + } |