diff options
author | Ittay Stern <ittay.stern@att.com> | 2019-11-06 14:27:53 +0200 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2019-11-07 14:19:47 +0000 |
commit | 97d42f7035ade2c171c349d01cfcd9b61b71dd52 (patch) | |
tree | 1a1b6d7c52545fcf78a0eb94eb12ec6d225c5d58 /vid-automation/src | |
parent | ebef5249cb9d282ace976feac8517a7b44add450 (diff) |
fix - when retrieve topology we are using threadPool and the MDC values are not updated
This time for homing-by-vnf-id parallel requests.
Issue-ID: VID-253
Change-Id: Ic0be1470445c6fef0e18f9b9d8f1604df508265b
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-automation/src')
-rw-r--r-- | vid-automation/src/main/java/org/onap/vid/api/AsyncInstantiationBase.java | 55 | ||||
-rw-r--r-- | vid-automation/src/test/java/org/onap/vid/api/ServiceTreeApiTest.java | 6 |
2 files changed, 33 insertions, 28 deletions
diff --git a/vid-automation/src/main/java/org/onap/vid/api/AsyncInstantiationBase.java b/vid-automation/src/main/java/org/onap/vid/api/AsyncInstantiationBase.java index 66bde727e..5e1310535 100644 --- a/vid-automation/src/main/java/org/onap/vid/api/AsyncInstantiationBase.java +++ b/vid-automation/src/main/java/org/onap/vid/api/AsyncInstantiationBase.java @@ -1,8 +1,34 @@ package org.onap.vid.api; +import static java.lang.Boolean.FALSE; +import static java.lang.Boolean.TRUE; +import static java.util.Collections.emptyList; +import static java.util.stream.Collectors.joining; +import static java.util.stream.Collectors.toMap; +import static org.hamcrest.CoreMatchers.hasItem; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.hasSize; +import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys; +import static org.testng.Assert.assertNotNull; +import static org.testng.AssertJUnit.assertEquals; +import static org.testng.AssertJUnit.assertTrue; +import static vid.automation.test.utils.ExtendedHamcrestMatcher.hasItemsFromCollection; + import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; import com.google.common.util.concurrent.Uninterruptibles; +import java.time.Instant; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Predicate; +import java.util.stream.Collectors; +import java.util.stream.IntStream; +import java.util.stream.Stream; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.builder.ReflectionToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -38,33 +64,6 @@ import vid.automation.test.model.ServiceAction; import vid.automation.test.services.AsyncJobsService; import vid.automation.test.services.SimulatorApi; -import java.time.Instant; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicReference; -import java.util.function.Predicate; -import java.util.stream.Collectors; -import java.util.stream.IntStream; -import java.util.stream.Stream; - -import static java.lang.Boolean.FALSE; -import static java.lang.Boolean.TRUE; -import static java.util.Collections.emptyList; -import static java.util.stream.Collectors.joining; -import static java.util.stream.Collectors.toMap; -import static org.hamcrest.CoreMatchers.hasItem; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.containsInAnyOrder; -import static org.hamcrest.Matchers.hasSize; -import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys; -import static org.testng.Assert.assertNotNull; -import static org.testng.AssertJUnit.assertEquals; -import static org.testng.AssertJUnit.assertTrue; -import static vid.automation.test.utils.ExtendedHamcrestMatcher.hasItemsFromCollection; - public class AsyncInstantiationBase extends BaseMsoApiTest { public static final String CREATE_BULK_OF_ALACARTE_REQUEST_WITH_VNF = "asyncInstantiation/vidRequestCreateALaCarteWithVnf.json"; @@ -507,7 +506,7 @@ public class AsyncInstantiationBase extends BaseMsoApiTest { .filter(serviceInfo -> serviceInfo.jobId.equals(jobId)) .findFirst().orElse(null); Assert.assertNotNull(serviceInfoFromDB); - Assert.assertEquals(serviceInfoDataReflected(expectedServiceInfo), serviceInfoDataReflected(serviceInfoFromDB)); + Assert.assertEquals(serviceInfoDataReflected(serviceInfoFromDB), serviceInfoDataReflected(expectedServiceInfo)); assertTrue("actual service instance doesn't contain template service name:" + expectedServiceInfo.serviceInstanceName, serviceInfoFromDB.serviceInstanceName.contains(expectedServiceInfo.serviceInstanceName)); diff --git a/vid-automation/src/test/java/org/onap/vid/api/ServiceTreeApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/ServiceTreeApiTest.java index f8bdc97e2..5d07a4ee8 100644 --- a/vid-automation/src/test/java/org/onap/vid/api/ServiceTreeApiTest.java +++ b/vid-automation/src/test/java/org/onap/vid/api/ServiceTreeApiTest.java @@ -39,6 +39,7 @@ import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.testng.util.RetryAnalyzerCount; import vid.automation.test.services.SimulatorApi; +import vid.automation.test.services.SimulatorApi.RegistrationStrategy; public class ServiceTreeApiTest extends BaseApiTest { @@ -179,7 +180,12 @@ public class ServiceTreeApiTest extends BaseApiTest { .replace("VNF4_INSTANCE_TYPE", vnfPreset4.getInstanceType()); assertJsonEquals(response, expected); + + SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(), RegistrationStrategy.APPEND); LoggerFormatTest.assertHeadersAndMetricLogs(restTemplate, uri, echoedRequestId(responseEntity), "/network/generic-vnfs/generic-vnf/", 5); + // org.onap.vid.aai.AaiClient.getCloudRegionAndTenantByVnfId for presets PresetAAIGetCloudRegionFromVnf is + // PUTing to AAI, so path is just /aai/v../query + LoggerFormatTest.assertHeadersAndMetricLogs(restTemplate, uri, echoedRequestId(responseEntity), "/query", 4); } @Test |