aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/test/java/org/onap/vid/services
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common/src/test/java/org/onap/vid/services')
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AAIServiceIntegrativeTest.java6
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AAIServiceTreeIntegrativeTest.java4
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AAIServiceTreeTest.java3
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AAITreeNodeBuilderTest.java53
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java5
5 files changed, 40 insertions, 31 deletions
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AAIServiceIntegrativeTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AAIServiceIntegrativeTest.java
index a159efd30..3a05a841b 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AAIServiceIntegrativeTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AAIServiceIntegrativeTest.java
@@ -47,6 +47,7 @@ import org.onap.vid.aai.util.TestWithAaiClient;
import org.onap.vid.model.aaiTree.Network;
import org.onap.vid.model.aaiTree.VpnBinding;
import org.onap.vid.testUtils.TestUtils;
+import org.onap.vid.utils.Logging;
import org.springframework.http.HttpMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
@@ -56,19 +57,20 @@ public class AAIServiceIntegrativeTest extends TestWithAaiClient {
private AAIRestInterface aaiRestInterface;
private AaiServiceImpl aaiServiceWithoutMocks;
+ private Logging logging = new Logging();
private AaiServiceImpl createAaiServiceWithoutMocks(AAIRestInterface aaiRestInterface, CacheProvider cacheProvider) {
AaiClient aaiClient = new AaiClient(aaiRestInterface, null, cacheProvider);
ExecutorService executorService = MoreExecutors.newDirectExecutorService();
AAIServiceTree aaiServiceTree = new AAIServiceTree(
aaiClient,
- new AAITreeNodeBuilder(aaiClient),
+ new AAITreeNodeBuilder(aaiClient, logging),
new AAITreeConverter(),
null,
null,
executorService
);
- return new AaiServiceImpl(aaiClient, null, aaiServiceTree, executorService);
+ return new AaiServiceImpl(aaiClient, null, aaiServiceTree, executorService, logging);
}
@BeforeMethod
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 a956468f3..0f9d6b489 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
@@ -54,6 +54,7 @@ import org.onap.vid.model.aaiTree.FailureAAITreeNode;
import org.onap.vid.model.aaiTree.ServiceInstance;
import org.onap.vid.model.aaiTree.Vnf;
import org.onap.vid.testUtils.TestUtils;
+import org.onap.vid.utils.Logging;
import org.springframework.http.HttpMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -78,6 +79,7 @@ public class AAIServiceTreeIntegrativeTest {
private AAITreeNodeBuilder aaiTreeNodeBuilder;
private AAITreeConverter aaiTreeConverter = new AAITreeConverter();
+ private Logging logging = new Logging();
private ExecutorService executorService = Executors.newFixedThreadPool(10);
@@ -292,7 +294,7 @@ public class AAIServiceTreeIntegrativeTest {
@BeforeMethod
public void initMocks() {
TestUtils.initMockitoMocks(this);
- aaiTreeNodeBuilder = new AAITreeNodeBuilder(aaiClient);
+ aaiTreeNodeBuilder = new AAITreeNodeBuilder(aaiClient, logging);
}
public void getServiceInstanceTreeAndAssert(boolean isDuplicatedKeysInTenantRelation) throws IOException, AsdcCatalogException {
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AAIServiceTreeTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AAIServiceTreeTest.java
index ada1f857e..7457e480e 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AAIServiceTreeTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AAIServiceTreeTest.java
@@ -55,6 +55,7 @@ import org.onap.vid.model.aaiTree.AAITreeNode;
import org.onap.vid.model.aaiTree.NodeType;
import org.onap.vid.mso.model.CloudConfiguration;
import org.onap.vid.testUtils.TestUtils;
+import org.onap.vid.utils.Logging;
import org.onap.vid.utils.Unchecked;
import org.springframework.http.HttpMethod;
import org.testng.annotations.BeforeTest;
@@ -199,7 +200,7 @@ public class AAIServiceTreeTest {
ExecutorService executorService = MoreExecutors.newDirectExecutorService();
AAIServiceTree aaiServiceTree = new AAIServiceTree(
aaiClientMock,
- new AAITreeNodeBuilder(aaiClientMock),
+ new AAITreeNodeBuilder(aaiClientMock, new Logging()),
new AAITreeConverter(),
null,
null,
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AAITreeNodeBuilderTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AAITreeNodeBuilderTest.java
index c2a3f5d61..2c954b297 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AAITreeNodeBuilderTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AAITreeNodeBuilderTest.java
@@ -20,7 +20,20 @@
package org.onap.vid.services;
-import com.fasterxml.jackson.core.JsonProcessingException;
+import static java.util.Comparator.comparing;
+import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals;
+import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER;
+import static net.javacrumbs.jsonunit.core.Option.IGNORING_EXTRA_FIELDS;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.when;
+import static org.onap.vid.services.AAIServiceTree.AAI_TREE_PATHS;
+import static org.onap.vid.utils.KotlinUtilsKt.JACKSON_OBJECT_MAPPER;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
@@ -28,7 +41,14 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.util.concurrent.MoreExecutors;
-
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ConcurrentSkipListSet;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.NotNull;
import org.mockito.Mock;
@@ -41,37 +61,15 @@ import org.onap.vid.exceptions.GenericUncheckedException;
import org.onap.vid.model.aaiTree.AAITreeNode;
import org.onap.vid.model.aaiTree.NodeType;
import org.onap.vid.mso.model.CloudConfiguration;
+import org.onap.vid.testUtils.TestUtils;
+import org.onap.vid.utils.Logging;
import org.onap.vid.utils.Tree;
import org.onap.vid.utils.Unchecked;
-import org.onap.vid.testUtils.TestUtils;
import org.springframework.http.HttpMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.concurrent.ConcurrentSkipListSet;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import static java.util.Comparator.comparing;
-import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals;
-import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER;
-import static net.javacrumbs.jsonunit.core.Option.IGNORING_EXTRA_FIELDS;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.empty;
-import static org.hamcrest.core.Is.is;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.when;
-import static org.onap.vid.services.AAIServiceTree.AAI_TREE_PATHS;
-import static org.onap.vid.utils.KotlinUtilsKt.JACKSON_OBJECT_MAPPER;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
public class AAITreeNodeBuilderTest {
private AAITreeNodeBuilder aaiTreeNodeBuilder;
@@ -80,13 +78,14 @@ public class AAITreeNodeBuilderTest {
private AaiClientInterface aaiClientMock;
private ExecutorService executorService;
+ private Logging logging = new Logging();
private static final ObjectMapper mapper = new ObjectMapper();
@BeforeClass
public void initMocks() {
MockitoAnnotations.initMocks(this);
- aaiTreeNodeBuilder = new AAITreeNodeBuilder(aaiClientMock);
+ aaiTreeNodeBuilder = new AAITreeNodeBuilder(aaiClientMock, logging);
executorService = MoreExecutors.newDirectExecutorService();
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java
index 9df99faa6..d3b2a48b1 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java
@@ -42,6 +42,7 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import java.util.function.Function;
import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.jetbrains.annotations.NotNull;
@@ -88,6 +89,7 @@ import org.onap.vid.model.aaiTree.AAITreeNode;
import org.onap.vid.model.aaiTree.RelatedVnf;
import org.onap.vid.model.aaiTree.ServiceInstance;
import org.onap.vid.roles.RoleValidator;
+import org.onap.vid.utils.Logging;
import org.springframework.http.HttpMethod;
@RunWith(MockitoJUnitRunner.class)
@@ -131,6 +133,8 @@ public class AaiServiceImplTest {
@Mock
private AaiResponseTranslator aaiResponseTranslator;
@Mock
+ private Logging logging;
+ @Mock
private AAIServiceTree aaiServiceTree;
@Spy
private ExecutorService executorService = Executors.newFixedThreadPool(1);
@@ -504,6 +508,7 @@ public class AaiServiceImplTest {
when(aaiServiceTree.buildAAITree(anyString(), isNull(), eq(HttpMethod.GET), any(), anyBoolean()))
.thenReturn(Collections.singletonList(testedTree));
when(aaiClient.getCloudRegionAndTenantByVnfId(anyString())).thenReturn(regionsAndTenants);
+ when(logging.withMDC(any(), any(Function.class))).thenAnswer(invocation -> invocation.getArgument(1));
List<RelatedVnf> actualGroupMembers = aaiService.searchGroupMembers(GLOBAL_CUSTOMER_ID, SERVICE_TYPE,
INVARIANT_ID, GROUP_TYPE_FAILING, GROUP_ROLE_FAILING);