From a2a7baa022b98919f4c008e29ba8a12b879e746c Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Mon, 2 Dec 2019 09:22:42 +0200 Subject: API to get template-topology by job id ..../vid/asyncInstantiation/templateTopology/{jobId} Issue-ID: VID-724 Change-Id: I5704951a595293d10ed6ae09c0113e1cac5b5788 Signed-off-by: Ittay Stern --- .../AsyncInstantiationBusinessLogicTest.java | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'vid-app-common/src/test/java/org/onap') 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 54015d4b3..56aaf1e83 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 @@ -35,15 +35,16 @@ import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.matchesPattern; import static org.hamcrest.Matchers.not; import static org.hamcrest.Matchers.nullValue; +import static org.hamcrest.Matchers.sameInstance; import static org.hamcrest.core.Every.everyItem; import static org.hamcrest.core.IsEqual.equalTo; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.anyInt; -import static org.mockito.Mockito.anyString; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.spy; @@ -199,6 +200,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT Mockito.reset(aaiClient); Mockito.reset(jobAdapterMock); Mockito.reset(jobsBrokerServiceMock); + Mockito.reset(asyncInstantiationRepository); mockAaiClientAnyNameFree(); enableAddCloudOwnerOnMsoRequest(); } @@ -1366,4 +1368,16 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT assertThat(path, equalTo("/serviceInstantiation/v7/serviceInstances/myService/vnfs/myVNF/vfModules/myVFModule/replace")); } + + @Test + public void getJobRequestAsTemplate_whenIsCalled_asyncInstantiationRepositoryGetJobRequestIsDelegated() { + UUID jobId = UUID.randomUUID(); + ServiceInstantiation expected = mock(ServiceInstantiation.class); + doReturn(expected).when(asyncInstantiationRepository).getJobRequest(jobId); + + ServiceInstantiation jobRequestAsTemplate = asyncInstantiationBL.getJobRequestAsTemplate(jobId); + + assertThat(jobRequestAsTemplate, is(sameInstance(expected))); + + } } -- cgit 1.2.3-korg