summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorBoslet, Cory <cory.boslet@att.com>2020-03-25 16:04:41 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-03-26 11:44:39 -0400
commitcd4e5b408603a13dabc58f832e4aae4194e81995 (patch)
treea53701a308644c0469b5242f7f8370766bd5a453 /common
parentf5420060c758308df18a0e316d6ae214ef9eb5c6 (diff)
convert openstack to external tasks
Use external tasks to communicate with openstack adapter Will be more resilient to failures Refactored all flows to use external tasks not REST calls Rollback is now an external task Ensured backwards compatibility Issue-ID: SO-2767 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I8afdb89c688d756aed0f25f7d9a7fb898142554d
Diffstat (limited to 'common')
-rw-r--r--common/src/main/java/org/onap/so/logging/tasks/AuditMDCSetup.java (renamed from common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java)3
-rw-r--r--common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java7
-rw-r--r--common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java6
-rw-r--r--common/src/test/java/org/onap/so/logging/tasks/MDCSetupTest.java (renamed from common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java)27
-rw-r--r--common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java5
5 files changed, 29 insertions, 19 deletions
diff --git a/common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java b/common/src/main/java/org/onap/so/logging/tasks/AuditMDCSetup.java
index 9f71e61e1f..8d98307a43 100644
--- a/common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java
+++ b/common/src/main/java/org/onap/so/logging/tasks/AuditMDCSetup.java
@@ -1,4 +1,4 @@
-package org.onap.so.externaltasks.logging;
+package org.onap.so.logging.tasks;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
@@ -53,4 +53,5 @@ public class AuditMDCSetup {
MDC.remove(ONAPLogConstants.MDCs.ELAPSED_TIME);
MDC.remove(ONAPLogConstants.MDCs.PARTNER_NAME);
}
+
}
diff --git a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
index 035ad1dc81..840a978a61 100644
--- a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
+++ b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
@@ -51,7 +51,12 @@ public class ExternalTaskServiceUtils {
}
public int getMaxClients() {
- return Integer.parseInt(env.getProperty("workflow.topics.maxClients", "3"));
+ return Integer.parseInt(env.getProperty("workflow.topics.maxClients", "10"));
+ }
+
+ public Long getLockDuration() {
+ Long lockDuration = Long.parseLong(env.getProperty("mso.audit.lock-time", "60000"));
+ return lockDuration;
}
@ScheduledLogging
diff --git a/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java b/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java
index 9488187003..d414135570 100644
--- a/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java
+++ b/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java
@@ -9,11 +9,11 @@ import org.springframework.stereotype.Component;
@Component
public abstract class ExternalTaskUtils {
+ private static final Logger logger = LoggerFactory.getLogger(ExternalTaskUtils.class);
+
@Autowired
Environment env;
- private static final Logger logger = LoggerFactory.getLogger(ExternalTaskUtils.class);
-
private final RetrySequenceLevel retrySequenceLevel;
public ExternalTaskUtils() {
@@ -49,7 +49,7 @@ public abstract class ExternalTaskUtils {
return seqInter;
case LONG:
String[] seqLong = {"1", "1", "2", "3", "5", "8", "13", "20"};
- if (env.getProperty("mso.workflow.topics.retrySequence") != null) {
+ if (env.getProperty("mso.workflow.topics.retrySequence.long") != null) {
seqLong = env.getProperty("mso.workflow.topics.retrySequence", String[].class);
}
return seqLong;
diff --git a/common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java b/common/src/test/java/org/onap/so/logging/tasks/MDCSetupTest.java
index c4609f0336..929db79910 100644
--- a/common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java
+++ b/common/src/test/java/org/onap/so/logging/tasks/MDCSetupTest.java
@@ -1,4 +1,4 @@
-package org.onap.so.externaltasks.logging;
+package org.onap.so.logging.tasks;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -11,28 +11,27 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Spy;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.logging.filter.base.MDCSetup;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.logger.MdcConstants;
import org.slf4j.MDC;
+import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
-public class AuditMDCSetupTest {
+public class MDCSetupTest {
@Mock
- private ExternalTask externalTask;
+ private org.onap.logging.filter.base.MDCSetup mdcSet;
@Mock
- private MDCSetup mdcSet;
-
- @Spy
- @InjectMocks
- private AuditMDCSetup mdcSetup;
+ private ExternalTask externalTask;
private String requestId = "9bb86b8d-a02f-4a0b-81a9-2eb963850009";
private String serviceName = "testServiceName";
+ @Spy
+ @InjectMocks
+ AuditMDCSetup setup = new AuditMDCSetup();
+
@After
public void tearDown() {
MDC.clear();
@@ -43,7 +42,7 @@ public class AuditMDCSetupTest {
doReturn(requestId).when(externalTask).getVariable("mso-request-id");
doReturn(serviceName).when(externalTask).getTopicName();
- mdcSetup.setupMDC(externalTask);
+ setup.setupMDC(externalTask);
assertNotNull(MDC.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertEquals(requestId, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
@@ -57,14 +56,14 @@ public class AuditMDCSetupTest {
public void setElapsedTimeTest() {
MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP, "2019-06-18T02:09:06.024Z");
- mdcSetup.setElapsedTime();
+ setup.setElapsedTime();
assertNotNull(MDC.get(ONAPLogConstants.MDCs.ELAPSED_TIME));
}
@Test
public void setResponseCodeTest() {
- mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
+ setup.setResponseCode(ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
assertEquals(ONAPLogConstants.ResponseStatus.INPROGRESS.toString(),
MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
@@ -80,7 +79,7 @@ public class AuditMDCSetupTest {
MDC.put(ONAPLogConstants.MDCs.ELAPSED_TIME, "318");
MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, "SO.OPENSTACK_ADAPTER");
- mdcSetup.clearClientMDCs();
+ setup.clearClientMDCs();
assertNull(MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
assertNull(MDC.get(MdcConstants.OPENSTACK_STATUS_CODE));
diff --git a/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java b/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java
index e27caa6458..6c2dbb666c 100644
--- a/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java
+++ b/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java
@@ -1,11 +1,13 @@
package org.onap.so.utils;
import static org.junit.Assert.assertEquals;
+import org.camunda.bpm.client.task.ExternalTask;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
+import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.springframework.core.env.Environment;
@@ -13,6 +15,9 @@ import org.springframework.core.env.Environment;
public class ExternalTaskUtilsTest {
@Mock
+ private ExternalTask externalTask;
+
+ @Mock
private Environment mockenv;
@InjectMocks