From 206d87766f6547934bf4298de326c63c8e31481a Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Tue, 24 Dec 2019 11:04:49 +0200 Subject: Write async instantiations request-summary to DB Issue-ID: VID-724 Change-Id: I8b4bb55f6d7d59da321ef7b52802ea8bd957c1c6 Signed-off-by: Ittay Stern --- .../services/AsyncInstantiationBusinessLogicTest.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'vid-app-common/src/test') diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java index 0cfe8059a..7a6b94a1a 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java @@ -502,14 +502,22 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT } @Test(dataProvider = "dataProviderSummarizedMap") - public void getSummarizedMap(String pathInResource, Map expectedMap){ + public void summarizedChildrenMap_givenServiceInstantiation_yieldCorrectMap(String pathInResource, Map expectedMap){ ServiceInstantiation serviceInstantiation = TestUtils.readJsonResourceFileAsObject( pathInResource, ServiceInstantiation.class); - Map childrenMap = asyncInstantiationBL.getSummarizedChildrenMap(serviceInstantiation); + Map childrenMap = asyncInstantiationBL.summarizedChildrenMap(serviceInstantiation); assertEquals(childrenMap,expectedMap); - } + @Test + public void requestSummaryOrNull_givenActionWhichIsNotCreate_yieldNullRegardlessOfPayload(){ + ServiceInstantiation serviceInstantiation = mock(ServiceInstantiation.class); + + when(serviceInstantiation.getAction()).thenReturn(Action.Upgrade); + when(featureManager.isActive(Features.FLAG_2004_CREATE_ANOTHER_INSTANCE_FROM_TEMPLATE)).thenReturn(true); + + assertThat(asyncInstantiationBL.requestSummaryOrNull(serviceInstantiation), is(nullValue())); + } @Test public void whenPushBulkJob_thenJobRequestIsSaveInJobRequestDb() { @@ -755,7 +763,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT UUID.randomUUID(), UUID.randomUUID(), new Date(), - "myName", ServiceInfo.ServiceAction.INSTANTIATE); + "myName", ServiceInfo.ServiceAction.INSTANTIATE, null); assertEquals(SERVICE_MODEL_VERSION_ID, serviceInfo.getServiceModelId()); } -- cgit 1.2.3-korg