From 16529076b3c306c2a4d35004bbec6c561578e819 Mon Sep 17 00:00:00 2001 From: Dilip kumar Pampana Date: Mon, 5 Mar 2018 16:41:37 -0500 Subject: Aai Test cases added junits were missed in the code contributions for Beijing for appc-outbound/appc-aai-client Issue-ID: APPC-692 Change-Id: I9bde9cc48e7fa396f2b4ac3af3b181ae03b84143 Signed-off-by: Dilip kumar Pampana --- .../onap/appc/aai/client/node/AAIResourceNode.java | 4 +-- .../appc/aai/client/node/TestAAIResourceNode.java | 30 ++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) (limited to 'appc-outbound/appc-aai-client') diff --git a/appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/node/AAIResourceNode.java b/appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/node/AAIResourceNode.java index 0e28727bc..ed9b9d074 100644 --- a/appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/node/AAIResourceNode.java +++ b/appc-outbound/appc-aai-client/provider/src/main/java/org/onap/appc/aai/client/node/AAIResourceNode.java @@ -373,7 +373,7 @@ public class AAIResourceNode implements SvcLogicJavaPlugin { } } - private void getVnfcInformationForVserver(Map vnfcParams, SvcLogicContext newVnfcCtx, + public void getVnfcInformationForVserver(Map vnfcParams, SvcLogicContext newVnfcCtx, Map inParams, SvcLogicContext ctx, AaiService aaiService, String responsePrefix) throws Exception { log.info("getVnfcInformationForVserver()::vnfcParams:" + vnfcParams.toString()); @@ -400,7 +400,7 @@ public class AAIResourceNode implements SvcLogicJavaPlugin { ctx.setAttribute(responsePrefix + "vm.vnfc.vnfc-ipaddress-v4-oam-vip", vnfcV4OamIp); } - private Map setVmParams(SvcLogicContext ctx, String vServerId) { + public Map setVmParams(SvcLogicContext ctx, String vServerId) { log.info("setVmParams()::setVmParamsVM level action:" + vServerId); Map params = new HashMap<>(); int vmCount = 0; diff --git a/appc-outbound/appc-aai-client/provider/src/test/java/org/onap/appc/aai/client/node/TestAAIResourceNode.java b/appc-outbound/appc-aai-client/provider/src/test/java/org/onap/appc/aai/client/node/TestAAIResourceNode.java index e6ac0567a..efb09e0be 100644 --- a/appc-outbound/appc-aai-client/provider/src/test/java/org/onap/appc/aai/client/node/TestAAIResourceNode.java +++ b/appc-outbound/appc-aai-client/provider/src/test/java/org/onap/appc/aai/client/node/TestAAIResourceNode.java @@ -248,4 +248,34 @@ Map inParams =new HashMap(); assertEquals(ctx.getAttribute("template-model-id"),"model0001"); } + @Test + public final void testSetVmParams() { + SvcLogicContext ctx = new SvcLogicContext(); + String vServerId = "vserver02"; + ctx.setAttribute("tmp.vnfInfo.vm-count","3"); + ctx.setAttribute("tmp.vnfInfo.vm[0].vserver-id","vserver01"); + ctx.setAttribute("tmp.vnfInfo.vm[1].vserver-id","vserver02"); + ctx.setAttribute("tmp.vnfInfo.vm[1].tenant-id","ten01"); + ctx.setAttribute("tmp.vnfInfo.vm[1].cloud-region-id","cr01"); + ctx.setAttribute("tmp.vnfInfo.vm[1].cloud-owner","co01"); + AAIResourceNode aairn= new AAIResourceNode(); + Map params = aairn.setVmParams(ctx, vServerId); + assertNotNull(params); + } + @Test + public final void testGetVnfcInformationForVserver() throws Exception{ + MockAAIResourceNode aairn = new MockAAIResourceNode(); + SvcLogicContext ctx = new SvcLogicContext(); + SvcLogicContext newVnfcCtx = new SvcLogicContext(); + Map inParams = new HashMap(); + Map vnfcParams = new HashMap(); + String responsePrefix="test."; + inParams.put(AppcAaiClientConstant.INPUT_PARAM_RESPONSE_PREFIX, "test"); + vnfcParams.put("vnfcName", "vnfcName2"); + aairn.getVnfcInformationForVserver(vnfcParams, newVnfcCtx, inParams, ctx, aairn.getAaiService(), responsePrefix); + assertEquals(ctx.getAttribute("test.vm.vnfc.vnfc-name"),"vnfcName2"); + assertEquals(ctx.getAttribute("test.vm.vnfc.vnfc-type"), "vnfcType2"); + assertEquals(ctx.getAttribute("test.vm.vnfc.vnfc-function-code"), "vnfcFuncCode2"); + assertEquals(ctx.getAttribute("test.vm.vnfc.vnfc-group-notation"), "vnfcGrpNot2"); + } } -- cgit 1.2.3-korg