diff options
author | Ittay Stern <ittay.stern@att.com> | 2019-11-10 12:26:44 +0200 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2019-11-10 12:28:09 +0200 |
commit | 002ed9c356ce2352e7c6ac90e3c6fd061897b91b (patch) | |
tree | b862295492765490605f15be3418092ba1eb8615 /vid-app-common/src/test | |
parent | 28389331a544dcf8d74584c215467b149b959ecf (diff) |
Mock Logging.withMDC while AAIServiceTreeIntegrativeTest::getServiceInstanceTreeTestHappyFlow
Issue-ID: VID-253
Change-Id: I86275ff1a5951b6e86b7380cdf9d4238cfae45db
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-app-common/src/test')
-rw-r--r-- | vid-app-common/src/test/java/org/onap/vid/services/AAIServiceTreeIntegrativeTest.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AAIServiceTreeIntegrativeTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AAIServiceTreeIntegrativeTest.java index 0f9d6b489..d6ee62ce4 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/AAIServiceTreeIntegrativeTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/AAIServiceTreeIntegrativeTest.java @@ -37,8 +37,10 @@ import java.io.IOException; import java.net.URI; import java.util.Arrays; import java.util.List; +import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import java.util.function.Function; import javax.ws.rs.core.Response; import org.mockito.Mock; import org.onap.vid.aai.AaiClientInterface; @@ -76,10 +78,12 @@ public class AAIServiceTreeIntegrativeTest { @Mock ServiceModelInflator serviceModelInflator; + @Mock + Logging logging; + private AAITreeNodeBuilder aaiTreeNodeBuilder; private AAITreeConverter aaiTreeConverter = new AAITreeConverter(); - private Logging logging = new Logging(); private ExecutorService executorService = Executors.newFixedThreadPool(10); @@ -89,7 +93,6 @@ public class AAIServiceTreeIntegrativeTest { private String serviceType = "vWINIFRED"; private String serviceInstanceId = "62888f15-6d24-4f7b-92a7-c3f35beeb215"; - //TODO Amichai: if in the future it is neede, add here the SUFFIX to the URL: "?format=simple" private String serviceInstanceRequestUri = "business/customers/customer/" + globalCustomerID + "/service-subscriptions/service-subscription/" + @@ -294,9 +297,15 @@ public class AAIServiceTreeIntegrativeTest { @BeforeMethod public void initMocks() { TestUtils.initMockitoMocks(this); + reboundLoggingWithMdcMock(); aaiTreeNodeBuilder = new AAITreeNodeBuilder(aaiClient, logging); } + private void reboundLoggingWithMdcMock() { + when(logging.withMDC(any(), any(Callable.class))).thenAnswer(invocation -> invocation.getArgument(1)); + when(logging.withMDC(any(), any(Function.class))).thenAnswer(invocation -> invocation.getArgument(1)); + } + public void getServiceInstanceTreeAndAssert(boolean isDuplicatedKeysInTenantRelation) throws IOException, AsdcCatalogException { when(aaiClient.typedAaiRest(URI.create(serviceInstanceRequestUri), JsonNode.class, null, HttpMethod.GET, false)).thenReturn(mapper.readTree(ServiceInstanceResponseString)); when(aaiClient.typedAaiRest(URI.create(genericVnfRequestUri), JsonNode.class, null, HttpMethod.GET, false)). |