Pnf Spring Environment correction
Change-Id: Ifd33f4ba0f62b15605ea21eb3d9256c3e70a1d2f
Issue-ID: SO-1102
Signed-off-by: Lukasz Muszkieta <lukasz.muszkieta@nokia.com>
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml
index 0959173..9f6d276 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml
@@ -4,6 +4,7 @@
timeout: '30000'
endpoint: http://localhost:8443
workflowAaiDistributionDelay: PT30S
+ pnfEntryNotificationTimeout: P14D
camunda:
bpm:
admin-user:
@@ -15,7 +16,16 @@
core-pool-size: 3
entitymanager:
packagesToScan: com
-
+pnf:
+ dmaap:
+ host: message-router
+ port: 3904
+ protocol: http
+ uriPathPrefix: events
+ topicName: pnfReady
+ consumerGroup: consumerGroup
+ consumerId: consumerId
+ topicListenerDelayInSeconds: 5
mso:
correlation:
timeout: 60
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/resources/applicationContext_forPnfTesting.xml b/bpmn/mso-infrastructure-bpmn/src/test/resources/applicationContext_forPnfTesting.xml
index 72462bd..3a41801 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/resources/applicationContext_forPnfTesting.xml
+++ b/bpmn/mso-infrastructure-bpmn/src/test/resources/applicationContext_forPnfTesting.xml
@@ -28,7 +28,6 @@
<property name="transactionManager" ref="transactionManager" />
<property name="databaseSchemaUpdate" value="true" />
<property name="jobExecutorActivate" value="false" />
- <!--<property name="deploymentResources" value="classpath*:*.bpmn" />-->
</bean>
<bean id="processEngine" class="org.camunda.bpm.engine.spring.ProcessEngineFactoryBean">
@@ -49,22 +48,21 @@
<bean id="aaiConnection" class="org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl"/>
- <bean id="checkAaiForCorrelationIdDelegate" class="org.onap.so.bpmn.infrastructure.pnf.delegate.CheckAaiForCorrelationIdDelegate">
+ <bean id="CheckAaiForCorrelationIdDelegate" class="org.onap.so.bpmn.infrastructure.pnf.delegate.CheckAaiForCorrelationIdDelegate">
<property name="aaiConnection" ref="aaiConnection"/>
</bean>
- <bean id="createAaiEntryWithPnfIdDelegate" class="org.onap.so.bpmn.infrastructure.pnf.delegate.CreateAaiEntryWithPnfIdDelegate">
+ <bean id="CreateAaiEntryWithPnfIdDelegate" class="org.onap.so.bpmn.infrastructure.pnf.delegate.CreateAaiEntryWithPnfIdDelegate">
<property name="aaiConnection" ref="aaiConnection"/>
</bean>
- <bean id="informDmaapClient" class="org.onap.so.bpmn.infrastructure.pnf.delegate.InformDmaapClient">
- <property name="dmaapClient" ref="dmaapClient"/>
+ <bean id="InformDmaapClient" class="org.onap.so.bpmn.infrastructure.pnf.delegate.InformDmaapClient">
+ <property name="dmaapClient" ref="DmaapClient"/>
</bean>
- <bean id="dmaapClient" class="org.onap.so.bpmn.infrastructure.pnf.delegate.DmaapClientTestImpl"/>
+ <bean id="DmaapClient" class="org.onap.so.bpmn.infrastructure.pnf.delegate.DmaapClientTestImpl"/>
-
- <bean id="pnfCheckInputs" class="org.onap.so.bpmn.infrastructure.pnf.delegate.PnfCheckInputs">
- <property name="defaultTimeout" value="PT1S"/>
+ <bean id="PnfCheckInputs" class="org.onap.so.bpmn.infrastructure.pnf.delegate.PnfCheckInputs">
+ <constructor-arg value="PT1S"></constructor-arg>
</bean>
</beans>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java
index a92fad2..8bba435 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java
@@ -25,7 +25,9 @@
import org.onap.aai.domain.yang.Pnf;
import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
import org.onap.so.client.aai.AAIRestClientImpl;
+import org.springframework.stereotype.Component;
+@Component
public class AaiConnectionImpl implements AaiConnection {
@Override
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java
index a10267e..05109ab 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscription.java
@@ -24,7 +24,9 @@
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+@Component
public class CancelDmaapSubscription implements JavaDelegate {
private DmaapClient dmaapClient;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java
index 12ddf84..b49c421 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java
@@ -20,12 +20,10 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_IP;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
import java.io.IOException;
-import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.bpmn.common.scripts.ExceptionUtil;
@@ -34,6 +32,7 @@
import org.onap.so.bpmn.infrastructure.pnf.implementation.CheckAaiForCorrelationIdImplementation;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
/**
* Implementation of "Check AAI for correlation_id" task in CreateAndActivatePnfResource.bpmn
@@ -46,6 +45,7 @@
* - aaiContainsInfoAboutIp - local Boolean
*/
+@Component
public class CheckAaiForCorrelationIdDelegate implements JavaDelegate {
private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, CheckAaiForCorrelationIdDelegate.class);
private CheckAaiForCorrelationIdImplementation implementation = new CheckAaiForCorrelationIdImplementation();
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java
index ec1ef21..a8754cd 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java
@@ -27,6 +27,7 @@
import org.onap.aai.domain.yang.Pnf;
import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
/**
* Implementation of "Create AAI entry with pnf-id = correlation_id" task in CreateAndActivatePnfResource.bpmn
@@ -34,6 +35,7 @@
* Inputs:
* - correlationId - String
*/
+@Component
public class CreateAaiEntryWithPnfIdDelegate implements JavaDelegate {
private AaiConnection aaiConnection;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
index 61b1ca4..1a75b09 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
@@ -25,7 +25,9 @@
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+@Component
public class InformDmaapClient implements JavaDelegate {
private DmaapClient dmaapClient;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
index d210e5e..164f51f 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
@@ -27,13 +27,22 @@
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.bpmn.common.scripts.ExceptionUtil;
import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+@Component
public class PnfCheckInputs implements JavaDelegate {
private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, PnfCheckInputs.class);
private String defaultTimeout;
+ @Autowired
+ public PnfCheckInputs(@Value("${aai.pnfEntryNotificationTimeout}") String defaultTimeout) {
+ this.defaultTimeout = defaultTimeout;
+ }
+
@Override
public void execute(DelegateExecution execution) {
String correlationId = (String) execution.getVariable(CORRELATION_ID);
@@ -51,7 +60,4 @@
}
}
- public void setDefaultTimeout(String defaultTimeout) {
- this.defaultTimeout = defaultTimeout;
- }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
index 70323b7..518d7ff 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
@@ -21,16 +21,13 @@
package org.onap.so.bpmn.infrastructure.pnf.dmaap;
import java.io.IOException;
-import java.net.URI;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
-
import javax.ws.rs.core.UriBuilder;
-
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
@@ -38,43 +35,35 @@
import org.apache.http.util.EntityUtils;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
-@Scope("prototype")
public class PnfEventReadyDmaapClient implements DmaapClient {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, PnfEventReadyDmaapClient.class);
+ private static final MsoLogger LOGGER = MsoLogger
+ .getMsoLogger(MsoLogger.Catalog.RA, PnfEventReadyDmaapClient.class);
- private final Environment env;
private HttpClient httpClient;
- private String dmaapHost;
- private int dmaapPort;
- private String dmaapProtocol;
- private String dmaapUriPathPrefix;
- private String dmaapTopicName;
- private String consumerId;
- private String consumerGroup;
private Map<String, Runnable> pnfCorrelationIdToThreadMap;
private HttpGet getRequest;
- private int dmaapClientDelayInSeconds;
+ private int topicListenerDelayInSeconds;
private volatile ScheduledThreadPoolExecutor executor;
private volatile boolean dmaapThreadListenerIsRunning;
@Autowired
public PnfEventReadyDmaapClient(Environment env) {
- this.env = env;
- }
-
- public void init() {
httpClient = HttpClientBuilder.create().build();
pnfCorrelationIdToThreadMap = new ConcurrentHashMap<>();
- dmaapHost = env.getProperty("pnf.dmaap.host");
- dmaapPort = env.getProperty("pnf.dmaap.port", Integer.class);
+ topicListenerDelayInSeconds = env.getProperty("pnf.dmaap.topicListenerDelayInSeconds", Integer.class);
executor = null;
- getRequest = new HttpGet(buildURI());
+ getRequest = new HttpGet(UriBuilder.fromUri(env.getProperty("pnf.dmaap.uriPathPrefix"))
+ .scheme(env.getProperty("pnf.dmaap.protocol"))
+ .host(env.getProperty("pnf.dmaap.host"))
+ .port(env.getProperty("pnf.dmaap.port", Integer.class))
+ .path(env.getProperty("pnf.dmaap.topicName"))
+ .path(env.getProperty("pnf.dmaap.consumerGroup"))
+ .path(env.getProperty("pnf.dmaap.consumerId")).build());
}
@Override
@@ -102,7 +91,7 @@
executor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
executor.scheduleWithFixedDelay(new DmaapTopicListenerThread(), 0,
- dmaapClientDelayInSeconds, TimeUnit.SECONDS);
+ topicListenerDelayInSeconds, TimeUnit.SECONDS);
dmaapThreadListenerIsRunning = true;
}
}
@@ -115,38 +104,6 @@
}
}
- private URI buildURI() {
- return UriBuilder.fromUri(dmaapUriPathPrefix)
- .scheme(dmaapProtocol)
- .host(dmaapHost)
- .port(dmaapPort).path(dmaapTopicName)
- .path(consumerGroup).path(consumerId).build();
- }
-
- public void setDmaapProtocol(String dmaapProtocol) {
- this.dmaapProtocol = dmaapProtocol;
- }
-
- public void setDmaapUriPathPrefix(String dmaapUriPathPrefix) {
- this.dmaapUriPathPrefix = dmaapUriPathPrefix;
- }
-
- public void setDmaapTopicName(String dmaapTopicName) {
- this.dmaapTopicName = dmaapTopicName;
- }
-
- public void setConsumerId(String consumerId) {
- this.consumerId = consumerId;
- }
-
- public void setConsumerGroup(String consumerGroup) {
- this.consumerGroup = consumerGroup;
- }
-
- public void setDmaapClientDelayInSeconds(int dmaapClientDelayInSeconds) {
- this.dmaapClientDelayInSeconds = dmaapClientDelayInSeconds;
- }
-
class DmaapTopicListenerThread implements Runnable {
@Override
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
index aab289f..2e8fb4b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
@@ -30,55 +30,52 @@
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.junit.Before;
import org.junit.Test;
public class PnfCheckInputsTest {
- private PnfCheckInputs delegate;
-
- @Before
- public void setUp() throws Exception {
- delegate = new PnfCheckInputs();
- }
+ private static final String DEFAULT_TIMEOUT = "P1D";
private DelegateExecution mockDelegateExecution() {
+ new PnfCheckInputs(DEFAULT_TIMEOUT);
DelegateExecution delegateExecution = mock(DelegateExecution.class);
when(delegateExecution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue");
return delegateExecution;
}
@Test
- public void shouldThrowException_whenPnfIdNotSet() throws Exception {
+ public void shouldThrowException_whenPnfIdNotSet() {
// given
+ PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT);
DelegateExecution delegateExecution = mockDelegateExecution();
// when, then
- assertThatThrownBy(() -> delegate.execute(delegateExecution)).isInstanceOf(BpmnError.class);
+ assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class);
}
private DelegateExecution mockDelegateExecutionWithCorrelationId() {
+ new PnfCheckInputs(DEFAULT_TIMEOUT);
DelegateExecution delegateExecution = mockDelegateExecution();
when(delegateExecution.getVariable(CORRELATION_ID)).thenReturn("testCorrelationId");
return delegateExecution;
}
@Test
- public void shouldThrowException_whenTimeoutIsNotSetAndDefaultIsNotDefined() throws Exception {
+ public void shouldThrowException_whenTimeoutIsNotSetAndDefaultIsNotDefined() {
// given
+ PnfCheckInputs testedObject = new PnfCheckInputs(null);
DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId();
// when, then
- assertThatThrownBy(() -> delegate.execute(delegateExecution)).isInstanceOf(BpmnError.class);
+ assertThatThrownBy(() -> testedObject.execute(delegateExecution)).isInstanceOf(BpmnError.class);
}
@Test
- public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() throws Exception {
+ public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() {
// given
- String defaultTimeout = "T1D";
- delegate.setDefaultTimeout(defaultTimeout);
+ PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT);
DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId();
// when
- delegate.execute(delegateExecution);
+ testedObject.execute(delegateExecution);
// then
- verify(delegateExecution).setVariable(eq(TIMEOUT_FOR_NOTIFICATION), eq(defaultTimeout));
+ verify(delegateExecution).setVariable(eq(TIMEOUT_FOR_NOTIFICATION), eq(DEFAULT_TIMEOUT));
}
}
\ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
index 9ae7ad9..aab01c0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
@@ -33,7 +33,6 @@
import java.lang.reflect.Field;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import org.apache.http.HttpEntity;
@@ -47,7 +46,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
-import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.onap.so.bpmn.infrastructure.pnf.dmaap.PnfEventReadyDmaapClient.DmaapTopicListenerThread;
@@ -81,6 +79,8 @@
private static final String EVENT_TOPIC_TEST = "eventTopicTest";
private static final String CONSUMER_ID = "consumerTestId";
private static final String CONSUMER_GROUP = "consumerGroupTest";
+ private static final int TOPIC_LISTENER_DELAY_IN_SECONDS = 5;
+
@Mock
private Environment env;
private PnfEventReadyDmaapClient testedObject;
@@ -92,16 +92,16 @@
@Before
public void init() throws NoSuchFieldException, IllegalAccessException {
- testedObject = new PnfEventReadyDmaapClient(env);
when(env.getProperty(eq("pnf.dmaap.port"), eq(Integer.class))).thenReturn(PORT);
when(env.getProperty(eq("pnf.dmaap.host"))).thenReturn(HOST);
- testedObject.setDmaapProtocol(PROTOCOL);
- testedObject.setDmaapUriPathPrefix(URI_PATH_PREFIX);
- testedObject.setDmaapTopicName(EVENT_TOPIC_TEST);
- testedObject.setConsumerId(CONSUMER_ID);
- testedObject.setConsumerGroup(CONSUMER_GROUP);
- testedObject.setDmaapClientDelayInSeconds(1);
- testedObject.init();
+ when(env.getProperty(eq("pnf.dmaap.protocol"))).thenReturn(PROTOCOL);
+ when(env.getProperty(eq("pnf.dmaap.uriPathPrefix"))).thenReturn(URI_PATH_PREFIX);
+ when(env.getProperty(eq("pnf.dmaap.topicName"))).thenReturn(EVENT_TOPIC_TEST);
+ when(env.getProperty(eq("pnf.dmaap.consumerId"))).thenReturn(CONSUMER_ID);
+ when(env.getProperty(eq("pnf.dmaap.consumerGroup"))).thenReturn(CONSUMER_GROUP);
+ when(env.getProperty(eq("pnf.dmaap.topicListenerDelayInSeconds"), eq(Integer.class)))
+ .thenReturn(TOPIC_LISTENER_DELAY_IN_SECONDS);
+ testedObject = new PnfEventReadyDmaapClient(env);
testedObjectInnerClassThread = testedObject.new DmaapTopicListenerThread();
httpClientMock = mock(HttpClient.class);
threadMockToNotifyCamundaFlow = mock(Runnable.class);
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn
index 89d66bf..e0b14ab 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateAndActivatePnfResource.bpmn
@@ -27,15 +27,15 @@
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{aaiContainsInfoAboutPnf}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_0967g8p" sourceRef="CheckInputs" targetRef="CheckAiiForCorrelationId" />
- <bpmn:serviceTask id="CheckInputs" name="Check inputs" camunda:delegateExpression="${pnfCheckInputs}">
+ <bpmn:serviceTask id="CheckInputs" name="Check inputs" camunda:delegateExpression="${PnfCheckInputs}">
<bpmn:incoming>SequenceFlow_0j5ksz1</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0967g8p</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:serviceTask id="CancelDmaapClientSubscription" name="Cancel DmaapClient subscription" camunda:delegateExpression="${cancelDmaapSubscription}">
+ <bpmn:serviceTask id="CancelDmaapClientSubscription" name="Cancel DmaapClient subscription" camunda:delegateExpression="${CancelDmaapSubscription}">
<bpmn:incoming>SequenceFlow_1kc34bc</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1miyzfe</bpmn:outgoing>
</bpmn:serviceTask>
- <bpmn:serviceTask id="InformDmaapClient" name="Inform DmaapClient about business key and corresponding pnf-id" camunda:delegateExpression="${informDmaapClient}">
+ <bpmn:serviceTask id="InformDmaapClient" name="Inform DmaapClient about business key and corresponding pnf-id" camunda:delegateExpression="${InformDmaapClient}">
<bpmn:incoming>SequenceFlow_17s9025</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1o8od8e</bpmn:outgoing>
</bpmn:serviceTask>
@@ -44,7 +44,7 @@
<bpmn:incoming>SequenceFlow_1l1t6ak</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_17s9025</bpmn:outgoing>
</bpmn:intermediateThrowEvent>
- <bpmn:serviceTask id="CreateAndActivatePnf_CreateAaiEntry" name="Create AAI entry with pnf-id = correlation_id" camunda:delegateExpression="${createAaiEntryWithPnfIdDelegate}">
+ <bpmn:serviceTask id="CreateAndActivatePnf_CreateAaiEntry" name="Create AAI entry with pnf-id = correlation_id" camunda:delegateExpression="${CreateAaiEntryWithPnfIdDelegate}">
<bpmn:incoming>SequenceFlow_0v5ffpe</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1qr6cmf</bpmn:outgoing>
</bpmn:serviceTask>
@@ -53,7 +53,7 @@
<bpmn:outgoing>SequenceFlow_1l1t6ak</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_0v5ffpe</bpmn:outgoing>
</bpmn:exclusiveGateway>
- <bpmn:serviceTask id="CheckAiiForCorrelationId" name="Check AAI for correlation_id" camunda:delegateExpression="${checkAaiForCorrelationIdDelegate}">
+ <bpmn:serviceTask id="CheckAiiForCorrelationId" name="Check AAI for correlation_id" camunda:delegateExpression="${CheckAaiForCorrelationIdDelegate}">
<bpmn:incoming>SequenceFlow_0967g8p</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1j4r3zt</bpmn:outgoing>
</bpmn:serviceTask>
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml
index 6f67a9c..d9ad136 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml
+++ b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml
@@ -1,6 +1,7 @@
aai:
auth: 26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764
endpoint: http://localhost:${wiremock.server.port}
+ pnfEntryNotificationTimeout: P14D
appc:
client:
key: iaEMAfjsVsZnraBP
@@ -29,6 +30,16 @@
sdncAdapter: 'true'
vnfAdapterCreateV1: 'true'
vnfAdapterRestV1: 'true'
+pnf:
+ dmaap:
+ host: hostTest
+ port: 1234
+ protocol: http
+ uriPathPrefix: events
+ topicName: pnfReady
+ consumerGroup: consumerGroup
+ consumerId: consumerId
+ topicListenerDelayInSeconds: 5
mso:
adapters:
requestDb: