From a4088cbaed725867db1a677e56ecf58f6fae91cd Mon Sep 17 00:00:00 2001 From: "r.bogacki" Date: Fri, 22 Mar 2019 15:43:49 +0100 Subject: JUnit tests for BBInputSetup Increase junit tests coverage according to Sonar analyses. Fix imports. Change-Id: Ia6c3f4a3178f5293ee6750f7581cd7107c8ced84 Issue-ID: SO-1692 Signed-off-by: Robert Bogacki --- .../tasks/BBInputSetupTest.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'bpmn') diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index df9f2259a1..eb26bf34ee 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -43,6 +45,7 @@ import java.util.Map; import java.util.Optional; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -2712,5 +2715,24 @@ public class BBInputSetupTest { assertEquals("Lookup Key Map populated with VfModule Id", vfModuleId, lookupKeyMap.get(ResourceKey.VF_MODULE_ID)); assertEquals("Lookup Key Map populated with VolumeGroup Id", volumeGroupId, lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID)); } + + @Test + public void testGettingVnfcToConfiguration() throws Exception { + + String vnfcName = "vnfcName"; + org.onap.aai.domain.yang.Configuration expectedAAI = new org.onap.aai.domain.yang.Configuration(); + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName); + AAIResultWrapper configurationWrapper = + new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI)); + + doReturn(new AAIResultWrapper(null)).when(SPY_bbInputSetupUtils).getAAIResourceDepthOne(aaiResourceUri); + Vnfc vnfc = SPY_bbInputSetup.getVnfcToConfiguration(vnfcName); + Assert.assertNull(vnfc); + + doReturn(configurationWrapper).when(SPY_bbInputSetupUtils).getAAIResourceDepthOne(aaiResourceUri); + vnfc = SPY_bbInputSetup.getVnfcToConfiguration(vnfcName); + Assert.assertNotNull(vnfc); + } + } -- cgit 1.2.3-korg