From 9a2efbdf1463f7bf0f2a0af8b8d7447ccd624269 Mon Sep 17 00:00:00 2001 From: "Brittany Plummer (bp896r)" Date: Thu, 14 May 2020 18:39:43 -0400 Subject: Added primary annotation to asyncExecutor so that executor is used Issue-ID: SO-2913 Change-Id: I7418f1279ff105cd2a47593dea0d26c0fed69cc9 Signed-off-by: Brittany Plummer (bp896r) --- adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java | 2 ++ .../java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java | 3 --- .../onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java | 2 ++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java index ecdd052b73..515c7f9a8e 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java @@ -32,6 +32,7 @@ import java.io.IOException; import javax.ws.rs.core.MediaType; import org.apache.http.HttpHeaders; import org.apache.http.HttpStatus; +import org.slf4j.MDC; import org.junit.After; import org.junit.Before; import org.junit.runner.RunWith; @@ -62,6 +63,7 @@ public abstract class BaseTest extends TestDataSetup { @After public void after() { wireMockServer.resetAll(); + MDC.clear(); } protected static String getBody(String body, int port, String urlPath) throws IOException { diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java index acd42dd8da..c6111a16cb 100644 --- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java +++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsWithUpdateTest.java @@ -95,7 +95,6 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup { StackInfo expectedStackInfo = new StackInfo("stackName", HeatStatus.UPDATED, "stackStatusReason", null); expectedStackInfo.setCanonicalName("stackName/id"); - doReturn(Optional.of(cloudSite)).when(cloudConfig).getCloudSite(isA(String.class)); doReturn(heatClient).when(heatUtils).getHeatClient(isA(String.class), isA(String.class)); doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(isA(OpenStackRequest.class)); doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class)); @@ -120,7 +119,6 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup { StackInfo expectedStackInfo = new StackInfo("stackName", HeatStatus.UPDATED, "stackStatusReason", null); expectedStackInfo.setCanonicalName("stackName/id"); - doReturn(Optional.of(cloudSite)).when(cloudConfig).getCloudSite(isA(String.class)); doReturn(heatClient).when(heatUtils).getHeatClient(isA(String.class), isA(String.class)); doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(isA(OpenStackRequest.class)); @@ -147,7 +145,6 @@ public class MsoHeatUtilsWithUpdateTest extends TestDataSetup { StackInfo expectedStackInfo = new StackInfo("stackName", HeatStatus.UPDATED, "stackStatusReason", null); expectedStackInfo.setCanonicalName("stackName/id"); - doReturn(Optional.of(cloudSite)).when(cloudConfig).getCloudSite(isA(String.class)); doReturn(heatClient).when(heatUtils).getHeatClient(isA(String.class), isA(String.class)); doReturn(null).when(heatUtils).executeAndRecordOpenstackRequest(isA(OpenStackRequest.class)); doReturn("0").when(environment).getProperty(isA(String.class), isA(String.class)); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java index d9a83e6a9a..8e10e72fe7 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java @@ -27,6 +27,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Primary; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; @@ -63,6 +64,7 @@ public class MsoOpenstackAdaptersApplication { } @Bean + @Primary public Executor asyncExecutor() { ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); executor.setTaskDecorator(new MDCTaskDecorator()); -- cgit 1.2.3-korg