aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-03-28 18:00:39 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-28 18:00:39 +0000
commit21241fb1244e2554a55b4fad999e55ecf2e8e38c (patch)
tree7fc155f0cdcc7ced86c3d46ed91a0f074da76a3b /bpmn
parent8f394febaf7423e6ea66007565f8aeebe23991e6 (diff)
parent5c788af30b182a75979ea30c76eb83511f5c944d (diff)
Merge "Added subworkflow for Pnf pnp"
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/policy/CommonObjectMapperProviderTest.java44
-rw-r--r--bpmn/MSOInfrastructureBPMN/pom.xml14
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java45
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java78
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java54
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java30
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiConnection.java32
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiResponse.java51
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java51
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateAndActivatePnfResource.bpmn264
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml9
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java71
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java39
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java129
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java141
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/applicationContext_forPnfTesting.xml59
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/log4j.properties8
17 files changed, 1118 insertions, 1 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/policy/CommonObjectMapperProviderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/policy/CommonObjectMapperProviderTest.java
new file mode 100644
index 0000000000..e1b1770180
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/policy/CommonObjectMapperProviderTest.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.client.policy;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.MapperFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import org.junit.Test;
+
+public class CommonObjectMapperProviderTest {
+
+ @Test
+ public void shouldSetCorrectMapperProperties() throws Exception {
+ // given
+ CommonObjectMapperProvider provider = new CommonObjectMapperProvider();
+ // when
+ ObjectMapper context = provider.getContext(Object.class);
+ // then
+ assertThat(context.isEnabled(MapperFeature.USE_ANNOTATIONS)).isTrue();
+ assertThat(context.isEnabled(SerializationFeature.WRAP_ROOT_VALUE)).isFalse();
+ assertThat(context.isEnabled(DeserializationFeature.UNWRAP_ROOT_VALUE)).isFalse();
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/pom.xml b/bpmn/MSOInfrastructureBPMN/pom.xml
index e6434092e1..be2a1dacbe 100644
--- a/bpmn/MSOInfrastructureBPMN/pom.xml
+++ b/bpmn/MSOInfrastructureBPMN/pom.xml
@@ -209,7 +209,7 @@
<!-- AssertJ Testing Library -->
<groupId>org.camunda.bpm.extension</groupId>
<artifactId>camunda-bpm-assert</artifactId>
- <version>1.2</version>
+ <version>2.0-alpha2</version>
<scope>test</scope>
</dependency>
@@ -366,6 +366,18 @@
<artifactId>libphonenumber</artifactId>
<version>8.9.1</version>
</dependency>
+ <dependency>
+ <groupId>org.assertj</groupId>
+ <artifactId>assertj-core</artifactId>
+ <version>2.4.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-test</artifactId>
+ <version>1.4.2.RELEASE</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java
new file mode 100644
index 0000000000..2be5ebdc5d
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.infrastructure.pnf.aai;
+
+import java.io.IOException;
+import java.util.Optional;
+import java.util.UUID;
+import org.apache.commons.lang.NotImplementedException;
+import org.onap.aai.domain.yang.Pnf;
+import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.AaiConnection;
+import org.openecomp.mso.client.aai.AAIRestClientImpl;
+import org.springframework.stereotype.Component;
+
+public class AaiConnectionImpl implements AaiConnection {
+
+ @Override
+ public Optional<Pnf> getEntryFor(String correlationId) throws IOException {
+ AAIRestClientImpl restClient = new AAIRestClientImpl();
+ return restClient.getPnfByName(correlationId, UUID.randomUUID().toString());
+ }
+
+ @Override
+ public void createEntry(String correlationId, Pnf entry) throws IOException {
+ AAIRestClientImpl restClient = new AAIRestClientImpl();
+ restClient.createPnf(correlationId, UUID.randomUUID().toString(), entry);
+ }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java
new file mode 100644
index 0000000000..f4483f5923
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.infrastructure.pnf.delegate;
+
+import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_IP;
+import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF;
+import static org.openecomp.mso.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.openecomp.mso.bpmn.infrastructure.pnf.implementation.AaiConnection;
+import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.AaiResponse;
+import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.CheckAaiForCorrelationIdImplementation;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * Implementation of "Check AAI for correlation_id" task in CreateAndActivatePnfResource.bpmn
+ *
+ * Inputs:
+ * - correlationId - String
+ *
+ * Outputs:
+ * - AAI_CONTAINS_INFO_ABOUT_PNF - local Boolean
+ * - aaiContainsInfoAboutIp - local Boolean (only present if AAI_CONTAINS_INFO_ABOUT_PNF is true)
+ */
+
+public class CheckAaiForCorrelationIdDelegate implements JavaDelegate {
+
+ private CheckAaiForCorrelationIdImplementation implementation = new CheckAaiForCorrelationIdImplementation();
+ private AaiConnection aaiConnection;
+
+ @Autowired
+ public void setAaiConnection(AaiConnection aaiConnection) {
+ this.aaiConnection = aaiConnection;
+ }
+
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+ String correlationId = (String) execution.getVariable(CORRELATION_ID);
+ if (correlationId == null) {
+ //todo: fix Execution -> DelegateExecution in ALL groovy scripts
+// new ExceptionUtil().buildAndThrowWorkflowException(execution, 500, CORRELATION_ID + " is not set");
+ throw new BpmnError("MSOWorkflowException");
+ }
+
+ try {
+ AaiResponse aaiResponse = implementation.check(correlationId, aaiConnection);
+
+ execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, aaiResponse.getContainsInfoAboutPnf());
+ aaiResponse.getContainsInfoAboutIp().ifPresent(
+ isIp -> execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, isIp)
+ );
+ } catch (IOException e) {
+ //todo: log this
+ throw new BpmnError("MSOWorkflowException");
+ }
+ }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java
new file mode 100644
index 0000000000..bc424fd347
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegate.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.infrastructure.pnf.delegate;
+
+import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.onap.aai.domain.yang.Pnf;
+import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.AaiConnection;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * Implementation of "Create AAI entry with pnf-id = correlation_id" task in CreateAndActivatePnfResource.bpmn
+ *
+ * Inputs:
+ * - correlationId - String
+ */
+public class CreateAaiEntryWithPnfIdDelegate implements JavaDelegate {
+
+ private AaiConnection aaiConnection;
+
+ @Autowired
+ public void setAaiConnection(AaiConnection aaiConnection) {
+ this.aaiConnection = aaiConnection;
+ }
+
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+ String correlationId = (String) execution.getVariable(CORRELATION_ID);
+ Pnf pnf = new Pnf();
+ pnf.setInMaint(true);
+ pnf.setPnfId(correlationId);
+ aaiConnection.createEntry(correlationId, pnf);
+ }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java
new file mode 100644
index 0000000000..6b49908a0f
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.infrastructure.pnf.delegate;
+
+@SuppressWarnings("ALL")
+public class ExecutionVariableNames {
+
+ public final static String CORRELATION_ID = "correlationId";
+ public final static String AAI_CONTAINS_INFO_ABOUT_PNF = "aaiContainsInfoAboutPnf";
+ public final static String AAI_CONTAINS_INFO_ABOUT_IP = "aaiContainsInfoAboutIp";
+ public final static String DMAAP_MESSAGE = "dmaapMessage";
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiConnection.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiConnection.java
new file mode 100644
index 0000000000..0bb63d5e68
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiConnection.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.infrastructure.pnf.implementation;
+
+import java.io.IOException;
+import java.util.Optional;
+import org.onap.aai.domain.yang.Pnf;
+
+public interface AaiConnection {
+
+ Optional<Pnf> getEntryFor(String correlationId) throws IOException;
+
+ void createEntry(String correlationId, Pnf entry) throws IOException;
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiResponse.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiResponse.java
new file mode 100644
index 0000000000..bbb7adc143
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiResponse.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.infrastructure.pnf.implementation;
+
+import java.util.Optional;
+import javax.annotation.Nullable;
+import javax.validation.constraints.NotNull;
+
+public class AaiResponse {
+
+ private Boolean containsInfoAboutPnf;
+ private Boolean containsInfoAboutIp;
+ private String ipAddress;
+
+ public AaiResponse(@NotNull Boolean containsInfoAboutPnf, @Nullable Boolean containsInfoAboutIp,
+ @Nullable String ipAddress) {
+ this.containsInfoAboutPnf = containsInfoAboutPnf;
+ this.containsInfoAboutIp = containsInfoAboutIp;
+ this.ipAddress = ipAddress;
+ }
+
+ public Boolean getContainsInfoAboutPnf() {
+ return containsInfoAboutPnf;
+ }
+
+ public Optional<Boolean> getContainsInfoAboutIp() {
+ return Optional.ofNullable(containsInfoAboutIp);
+ }
+
+ public Optional<String> getIpAddress() {
+ return Optional.ofNullable(ipAddress);
+ }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java
new file mode 100644
index 0000000000..353a3bd5d3
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.infrastructure.pnf.implementation;
+
+import java.io.IOException;
+import java.util.Optional;
+import org.onap.aai.domain.yang.Pnf;
+
+public class CheckAaiForCorrelationIdImplementation {
+
+ public AaiResponse check(String correlationId, AaiConnection aaiConnection) throws IOException {
+ Optional<Pnf> pnf = aaiConnection.getEntryFor(correlationId);
+ if (!pnf.isPresent()) {
+ return new AaiResponse(false, null, null);
+ }
+
+ Optional<String> ip = extractIp(pnf.get());
+ return ip.map(
+ s -> new AaiResponse(true, true, s)
+ ).orElseGet(
+ () -> new AaiResponse(true, false, null)
+ );
+ }
+
+ private Optional<String> extractIp(Pnf pnf) {
+ if (pnf.getIpaddressV4Oam() != null) {
+ return Optional.of(pnf.getIpaddressV4Oam());
+ } else {
+ return Optional.ofNullable(pnf.getIpaddressV6Oam());
+ }
+ }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateAndActivatePnfResource.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateAndActivatePnfResource.bpmn
new file mode 100644
index 0000000000..262e08689d
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateAndActivatePnfResource.bpmn
@@ -0,0 +1,264 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3">
+ <bpmn:collaboration id="Collaboration_1d0w8lf">
+ <bpmn:participant id="Participant_1egg397" name="SO&#10;Create and Activate Pnf Resource" processRef="CreateAndActivatePnfResource" />
+ <bpmn:participant id="Participant_0atuyq0" name="AAI" />
+ <bpmn:participant id="Participant_19w87ws" name="Workflow Message Service&#10;(communication with DMAAP)&#10;" />
+ <bpmn:messageFlow id="MessageFlow_1h3xu88" sourceRef="CreateAndActivatePnf_CreateAaiEntry" targetRef="Participant_0atuyq0" />
+ <bpmn:messageFlow id="MessageFlow_09ibv5a" sourceRef="CheckAiiForCorrelationId" targetRef="Participant_0atuyq0" />
+ <bpmn:messageFlow id="MessageFlow_0vjul4t" sourceRef="Participant_0atuyq0" targetRef="CheckAiiForCorrelationId" />
+ <bpmn:messageFlow id="MessageFlow_1vrcp2d" sourceRef="Participant_19w87ws" targetRef="WaitForDmaapPnfReadyNotification" />
+ </bpmn:collaboration>
+ <bpmn:process id="CreateAndActivatePnfResource" name="CreateAndActivatePnfResource" isExecutable="true">
+ <bpmn:sequenceFlow id="SequenceFlow_1ls8pua" name="No" sourceRef="DoesAaiContainInfoAboutIp" targetRef="AaiEntryExists">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{!aaiContainsInfoAboutIp}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1qr6cmf" sourceRef="CreateAndActivatePnf_CreateAaiEntry" targetRef="AaiEntryExists" />
+ <bpmn:sequenceFlow id="SequenceFlow_1l1t6ak" name="Yes" sourceRef="DoesAaiContainInfoAboutPnf" targetRef="DoesAaiContainInfoAboutIp">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{aaiContainsInfoAboutPnf}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_0v5ffpe" name="No" sourceRef="DoesAaiContainInfoAboutPnf" targetRef="CreateAndActivatePnf_CreateAaiEntry">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{!aaiContainsInfoAboutPnf}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1j4r3zt" sourceRef="CheckAiiForCorrelationId" targetRef="DoesAaiContainInfoAboutPnf" />
+ <bpmn:sequenceFlow id="SequenceFlow_1h6yz62" name="Yes" sourceRef="DoesAaiContainInfoAboutIp" targetRef="AaiEntryAlreadyUpToDate">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{aaiContainsInfoAboutIp}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_0j5ksz1" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="CheckAiiForCorrelationId" />
+ <bpmn:endEvent id="AaiEntryAlreadyUpToDate" name="AAI entry already up-to-date">
+ <bpmn:incoming>SequenceFlow_1h6yz62</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:endEvent id="AaiEntryUpdated" name="AAI entry updated">
+ <bpmn:incoming>SequenceFlow_0p09qgm</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:startEvent id="CreateAndActivatePnf_StartEvent">
+ <bpmn:outgoing>SequenceFlow_0j5ksz1</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_17s9025" sourceRef="AaiEntryExists" targetRef="WaitForDmaapPnfReadyNotification" />
+ <bpmn:sequenceFlow id="SequenceFlow_1kc34bc" sourceRef="WaitForDmaapTimeout" targetRef="ThrowTimeoutException" />
+ <bpmn:sequenceFlow id="SequenceFlow_0p09qgm" sourceRef="WaitForDmaapPnfReadyNotification" targetRef="AaiEntryUpdated" />
+ <bpmn:serviceTask id="CheckAiiForCorrelationId" name="Check AAI for correlation_id" camunda:delegateExpression="${checkAaiForCorrelationIdDelegate}">
+ <bpmn:incoming>SequenceFlow_0j5ksz1</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1j4r3zt</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:exclusiveGateway id="DoesAaiContainInfoAboutPnf" name="Does AAI contain info about pnf?">
+ <bpmn:incoming>SequenceFlow_1j4r3zt</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1l1t6ak</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0v5ffpe</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <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>
+ <bpmn:exclusiveGateway id="DoesAaiContainInfoAboutIp" name="Does AAI contain info about IPv4 or IPv6?">
+ <bpmn:incoming>SequenceFlow_1l1t6ak</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1h6yz62</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1ls8pua</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:intermediateThrowEvent id="AaiEntryExists" name="AAI entry exists, lacking IP">
+ <bpmn:incoming>SequenceFlow_1qr6cmf</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1ls8pua</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_17s9025</bpmn:outgoing>
+ </bpmn:intermediateThrowEvent>
+ <bpmn:receiveTask id="WaitForDmaapPnfReadyNotification" name="Wait for DMAAP pnf-ready notification" messageRef="Message_13h1tlo">
+ <bpmn:incoming>SequenceFlow_17s9025</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0p09qgm</bpmn:outgoing>
+ </bpmn:receiveTask>
+ <bpmn:boundaryEvent id="WaitForDmaapTimeout" name="Timeout" attachedToRef="WaitForDmaapPnfReadyNotification">
+ <bpmn:outgoing>SequenceFlow_1kc34bc</bpmn:outgoing>
+ <bpmn:timerEventDefinition>
+ <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">#{timeoutForPnfEntryNotification}</bpmn:timeDuration>
+ </bpmn:timerEventDefinition>
+ </bpmn:boundaryEvent>
+ <bpmn:endEvent id="ThrowTimeoutException" name="Throw timeout exception">
+ <bpmn:incoming>SequenceFlow_1kc34bc</bpmn:incoming>
+ <bpmn:errorEventDefinition errorRef="Error_1" />
+ </bpmn:endEvent>
+ <bpmn:association id="Association_0d7oxnz" sourceRef="CreateAndActivatePnf_StartEvent" targetRef="TextAnnotation_1eyzes8" />
+ <bpmn:textAnnotation id="TextAnnotation_1eyzes8">
+ <bpmn:text><![CDATA[Inputs:
+ - timeoutForPnfEntryNotification - String
+ - correlationId - String
+]]></bpmn:text>
+ </bpmn:textAnnotation>
+ </bpmn:process>
+ <bpmn:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
+ <bpmn:message id="Message_13h1tlo" name="WorkflowMessage" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1d0w8lf">
+ <bpmndi:BPMNShape id="Participant_1egg397_di" bpmnElement="Participant_1egg397">
+ <dc:Bounds x="0" y="0" width="1482" height="353" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1cttgdo_di" bpmnElement="DoesAaiContainInfoAboutPnf" isMarkerVisible="true">
+ <dc:Bounds x="408" y="230" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="388" y="283" width="85" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0yamdfm_di" bpmnElement="DoesAaiContainInfoAboutIp" isMarkerVisible="true">
+ <dc:Bounds x="786" y="41" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="767" y="5" width="87" height="30" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0k52gr7_di" bpmnElement="AaiEntryUpdated">
+ <dc:Bounds x="1312" y="237" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1286" y="278" width="89" height="10" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_0j5ok9h_di" bpmnElement="CreateAndActivatePnf_StartEvent">
+ <dc:Bounds x="49" y="237" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="23" y="276" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0a5uk9o_di" bpmnElement="CheckAiiForCorrelationId">
+ <dc:Bounds x="194" y="215" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0iimk5v_di" bpmnElement="CreateAndActivatePnf_CreateAaiEntry">
+ <dc:Bounds x="572" y="215" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1j4r3zt_di" bpmnElement="SequenceFlow_1j4r3zt">
+ <di:waypoint xsi:type="dc:Point" x="294" y="255" />
+ <di:waypoint xsi:type="dc:Point" x="408" y="255" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="306" y="235" width="90" height="10" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1l1t6ak_di" bpmnElement="SequenceFlow_1l1t6ak">
+ <di:waypoint xsi:type="dc:Point" x="433" y="230" />
+ <di:waypoint xsi:type="dc:Point" x="433" y="66" />
+ <di:waypoint xsi:type="dc:Point" x="786" y="66" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="438" y="206" width="19" height="10" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0v5ffpe_di" bpmnElement="SequenceFlow_0v5ffpe">
+ <di:waypoint xsi:type="dc:Point" x="458" y="255" />
+ <di:waypoint xsi:type="dc:Point" x="572" y="255" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="471.6714285714286" y="237" width="15" height="10" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1h6yz62_di" bpmnElement="SequenceFlow_1h6yz62">
+ <di:waypoint xsi:type="dc:Point" x="836" y="66" />
+ <di:waypoint xsi:type="dc:Point" x="1312" y="66" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="842.76953125" y="51" width="19" height="10" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ls8pua_di" bpmnElement="SequenceFlow_1ls8pua">
+ <di:waypoint xsi:type="dc:Point" x="811" y="91" />
+ <di:waypoint xsi:type="dc:Point" x="811" y="237" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="821" y="119.69863013698631" width="15" height="10" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1qr6cmf_di" bpmnElement="SequenceFlow_1qr6cmf">
+ <di:waypoint xsi:type="dc:Point" x="672" y="255" />
+ <di:waypoint xsi:type="dc:Point" x="793" y="255" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="687.5" y="235" width="90" height="10" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0j5ksz1_di" bpmnElement="SequenceFlow_0j5ksz1">
+ <di:waypoint xsi:type="dc:Point" x="85" y="255" />
+ <di:waypoint xsi:type="dc:Point" x="194" y="255" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="94.5" y="235" width="90" height="10" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="Participant_0i9ban2_di" bpmnElement="Participant_0atuyq0">
+ <dc:Bounds x="123" y="538" width="1222" height="60" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="MessageFlow_1h3xu88_di" bpmnElement="MessageFlow_1h3xu88">
+ <di:waypoint xsi:type="dc:Point" x="622" y="295" />
+ <di:waypoint xsi:type="dc:Point" x="622" y="538" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="592" y="411.5" width="90" height="10" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="MessageFlow_09ibv5a_di" bpmnElement="MessageFlow_09ibv5a">
+ <di:waypoint xsi:type="dc:Point" x="225" y="295" />
+ <di:waypoint xsi:type="dc:Point" x="225" y="538" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="195" y="411.5" width="90" height="10" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="MessageFlow_0vjul4t_di" bpmnElement="MessageFlow_0vjul4t">
+ <di:waypoint xsi:type="dc:Point" x="264" y="538" />
+ <di:waypoint xsi:type="dc:Point" x="264" y="295" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="234" y="411.5" width="90" height="10" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="Participant_0vmrrhf_di" bpmnElement="Participant_19w87ws">
+ <dc:Bounds x="767" y="414" width="300" height="62" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0wbx6tt_di" bpmnElement="ThrowTimeoutException">
+ <dc:Bounds x="1164" y="135" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1157" y="172" width="70" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_00cy7r0_di" bpmnElement="AaiEntryAlreadyUpToDate">
+ <dc:Bounds x="1312" y="48" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1288" y="89" width="85" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="IntermediateThrowEvent_0fjcdy4_di" bpmnElement="AaiEntryExists">
+ <dc:Bounds x="793" y="237" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="771" y="283" width="80" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="TextAnnotation_1eyzes8_di" bpmnElement="TextAnnotation_1eyzes8">
+ <dc:Bounds x="66" y="70" width="243" height="54" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="Association_0d7oxnz_di" bpmnElement="Association_0d7oxnz">
+ <di:waypoint xsi:type="dc:Point" x="67" y="237" />
+ <di:waypoint xsi:type="dc:Point" x="67" y="124" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="MessageFlow_1vrcp2d_di" bpmnElement="MessageFlow_1vrcp2d">
+ <di:waypoint xsi:type="dc:Point" x="1002" y="414" />
+ <di:waypoint xsi:type="dc:Point" x="1002" y="295" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="972" y="349.5" width="90" height="10" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_17s9025_di" bpmnElement="SequenceFlow_17s9025">
+ <di:waypoint xsi:type="dc:Point" x="829" y="255" />
+ <di:waypoint xsi:type="dc:Point" x="950" y="255" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="844.5" y="235" width="90" height="10" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="BoundaryEvent_15eo1k9_di" bpmnElement="WaitForDmaapTimeout">
+ <dc:Bounds x="1004" y="197" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1035" y="192" width="40" height="10" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1kc34bc_di" bpmnElement="SequenceFlow_1kc34bc">
+ <di:waypoint xsi:type="dc:Point" x="1022" y="197" />
+ <di:waypoint xsi:type="dc:Point" x="1022" y="153" />
+ <di:waypoint xsi:type="dc:Point" x="1164" y="153" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="992" y="170" width="90" height="10" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ReceiveTask_1sfysua_di" bpmnElement="WaitForDmaapPnfReadyNotification">
+ <dc:Bounds x="950" y="215" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0p09qgm_di" bpmnElement="SequenceFlow_0p09qgm">
+ <di:waypoint xsi:type="dc:Point" x="1050" y="255" />
+ <di:waypoint xsi:type="dc:Point" x="1312" y="255" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1181" y="235" width="0" height="10" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml
index 6f61c8fbf4..46cea5da63 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml
@@ -4,5 +4,14 @@
http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- Spring bean to be invoked through the ApplicationContextElResolver -->
+ <bean id="aaiConnection" class="org.openecomp.mso.bpmn.infrastructure.pnf.aai.AaiConnectionImpl"/>
+
+ <bean id="checkAaiForCorrelationIdDelegate" class="org.openecomp.mso.bpmn.infrastructure.pnf.delegate.CheckAaiForCorrelationIdDelegate">
+ <property name="aaiConnection" ref="aaiConnection"/>
+ </bean>
+
+ <bean id="createAaiEntryWithPnfIdDelegate" class="org.openecomp.mso.bpmn.infrastructure.pnf.delegate.CreateAaiEntryWithPnfIdDelegate">
+ <property name="aaiConnection" ref="aaiConnection"/>
+ </bean>
</beans>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
new file mode 100644
index 0000000000..1ad1f9e5a4
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
@@ -0,0 +1,71 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.infrastructure.pnf.delegate;
+
+import java.io.IOException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Objects;
+import java.util.Optional;
+import org.onap.aai.domain.yang.Pnf;
+import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.AaiConnection;
+
+public class AaiConnectionTestImpl implements AaiConnection {
+
+ public static final String ID_WITH_ENTRY_AND_IP = "idWithEntryAndIp";
+ public static final String ID_WITH_IP_V6 = "idWithIpV6";
+ public static final String ID_WITHOUT_ENTRY = "IdWithoutEntry";
+ public static final String ID_WITH_ENTRY_NO_IP = "idWithEntryNoIp";
+ public static final String DEFAULT_IP = "1.2.3.4";
+ public static final String DEFAULT_IP_V6 = "2001:db8::ff00:42:8329";
+
+ private List<String> created = new LinkedList<>();
+
+ @Override
+ public Optional<Pnf> getEntryFor(String correlationId) throws IOException {
+ if (Objects.equals(correlationId, ID_WITH_ENTRY_AND_IP)) {
+ Pnf pnf = new Pnf();
+ pnf.setIpaddressV4Oam(DEFAULT_IP);
+ return Optional.of(pnf);
+ } else if (Objects.equals(correlationId, ID_WITH_IP_V6)) {
+ Pnf pnf = new Pnf();
+ pnf.setIpaddressV6Oam(DEFAULT_IP_V6);
+ return Optional.of(pnf);
+ } else if (Objects.equals(correlationId, ID_WITH_ENTRY_NO_IP)) {
+ return Optional.of(new Pnf());
+ } else {
+ return Optional.empty();
+ }
+ }
+
+ @Override
+ public void createEntry(String correlationId, Pnf entry) throws IOException {
+ created.add(correlationId);
+ }
+
+ public List<String> getCreated() {
+ return created;
+ }
+
+ public void reset() {
+ created.clear();
+ }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java
new file mode 100644
index 0000000000..9a8dd5df24
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.infrastructure.pnf.delegate;
+
+import java.io.IOException;
+import java.util.Optional;
+import org.onap.aai.domain.yang.Pnf;
+import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.AaiConnection;
+
+public class AaiConnectionThrowingException implements AaiConnection {
+
+ @Override
+ public Optional<Pnf> getEntryFor(String correlationId) throws IOException {
+ throw new IOException();
+ }
+
+ @Override
+ public void createEntry(String correlationId, Pnf entry) throws IOException {
+ throw new IOException();
+ }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java
new file mode 100644
index 0000000000..d98a395838
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java
@@ -0,0 +1,129 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.infrastructure.pnf.delegate;
+
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.DEFAULT_IP;
+import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITHOUT_ENTRY;
+import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_AND_IP;
+import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_NO_IP;
+import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_IP_V6;
+import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_IP;
+import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF;
+import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.junit.Test;
+import org.junit.experimental.runners.Enclosed;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(Enclosed.class)
+public class CheckAaiForCorrelationIdDelegateTest {
+
+ @RunWith(SpringRunner.class)
+ @SpringBootTest(classes = {CheckAaiForCorrelationIdDelegate.class, AaiConnectionTestImpl.class})
+ public static class ConnectionOkTests {
+
+ @Autowired
+ private CheckAaiForCorrelationIdDelegate delegate;
+
+ @Test
+ public void shouldThrowExceptionWhenCorrelationIdIsNotSet() throws Exception {
+ // given
+ DelegateExecution execution = mock(DelegateExecution.class);
+ when(execution.getVariable(CORRELATION_ID)).thenReturn(null);
+ when(execution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue");
+ // when, then
+ assertThatThrownBy(() -> delegate.execute(execution)).isInstanceOf(BpmnError.class);
+ // todo: uncomment line below after fixing Execution -> DelecateExecution in groovy scripts
+// verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class));
+ }
+
+ @Test
+ public void shouldSetCorrectVariablesWhenAaiDoesNotContainInfoAboutPnf() throws Exception {
+ // given
+ DelegateExecution execution = mock(DelegateExecution.class);
+ when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITHOUT_ENTRY);
+ // when
+ delegate.execute(execution);
+ // then
+ verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, false);
+ }
+
+ @Test
+ public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf() throws Exception {
+ shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(ID_WITH_ENTRY_AND_IP);
+ }
+
+ @Test
+ public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithIpV6() throws Exception {
+ shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(ID_WITH_IP_V6);
+ }
+
+ private void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(String id) throws Exception {
+ // given
+ DelegateExecution execution = mock(DelegateExecution.class);
+ when(execution.getVariable(CORRELATION_ID)).thenReturn(id);
+ // when
+ delegate.execute(execution);
+ // then
+ verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, true);
+ verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, true);
+ }
+
+ @Test
+ public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithoutIp() throws Exception {
+ // given
+ DelegateExecution execution = mock(DelegateExecution.class);
+ when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY_NO_IP);
+ // when
+ delegate.execute(execution);
+ // then
+ verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, true);
+ verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, false);
+ }
+ }
+
+
+ @RunWith(SpringRunner.class)
+ @SpringBootTest(classes = {CheckAaiForCorrelationIdDelegate.class, AaiConnectionThrowingException.class})
+ public static class NoConnectionTests {
+
+ @Autowired
+ private CheckAaiForCorrelationIdDelegate delegate;
+
+ @Test
+ public void shouldThrowExceptionWhenSSADFDSADSFDS() throws Exception {
+ // given
+ DelegateExecution execution = mock(DelegateExecution.class);
+ when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY_NO_IP);
+ // when, then
+ assertThatThrownBy(() -> delegate.execute(execution)).isInstanceOf(BpmnError.class);
+ }
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java
new file mode 100644
index 0000000000..88e7d2f4b3
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java
@@ -0,0 +1,141 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.infrastructure.pnf.delegate.bpmn;
+
+import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat;
+import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITHOUT_ENTRY;
+import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_AND_IP;
+import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_NO_IP;
+import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.history.HistoricVariableInstance;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.test.Deployment;
+import org.camunda.bpm.engine.test.ProcessEngineRule;
+import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@ContextConfiguration(locations = "/applicationContext_forPnfTesting.xml")
+public class CreateAndActivatePnfResourceTest {
+
+ private static final String TIMEOUT_10_S = "PT10S";
+ @Autowired
+ private RuntimeService runtimeService;
+
+ @Autowired
+ @Rule
+ public ProcessEngineRule processEngineRule;
+
+ @Autowired
+ private AaiConnectionTestImpl aaiConnection;
+
+ @Test
+ @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"})
+ public void shouldSaveCurrentIpToVariableIfItAlreadyExistsInAai() throws Exception {
+ // given
+ aaiConnection.reset();
+ BpmnAwareTests.init(processEngineRule.getProcessEngine());
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S);
+ variables.put(CORRELATION_ID, ID_WITH_ENTRY_AND_IP);
+ // when
+ ProcessInstance instance = runtimeService
+ .startProcessInstanceByKey("CreateAndActivatePnfResource", variables);
+ // then
+ assertThat(instance).isEnded().hasPassedInOrder(
+ "CreateAndActivatePnf_StartEvent",
+ "CheckAiiForCorrelationId",
+ "DoesAaiContainInfoAboutPnf",
+ "DoesAaiContainInfoAboutIp"
+ );
+ }
+
+ @Test
+ @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"})
+ public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenIpIsMissingInAaiEntry() throws Exception {
+ // given
+ aaiConnection.reset();
+ BpmnAwareTests.init(processEngineRule.getProcessEngine());
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S);
+ variables.put(CORRELATION_ID, ID_WITH_ENTRY_NO_IP);
+ // when
+ ProcessInstance instance = runtimeService
+ .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
+ assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage");
+ runtimeService.createMessageCorrelation("WorkflowMessage")
+ .processInstanceBusinessKey("businessKey")
+ .correlateWithResult();
+ // then
+ assertThat(instance).isEnded().hasPassedInOrder(
+ "CreateAndActivatePnf_StartEvent",
+ "CheckAiiForCorrelationId",
+ "DoesAaiContainInfoAboutPnf",
+ "DoesAaiContainInfoAboutIp",
+ "AaiEntryExists",
+ "WaitForDmaapPnfReadyNotification"
+ );
+ }
+
+ @Test
+ @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"})
+ public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntry() throws Exception {
+ // given
+ aaiConnection.reset();
+ BpmnAwareTests.init(processEngineRule.getProcessEngine());
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S);
+ variables.put(CORRELATION_ID, ID_WITHOUT_ENTRY);
+ // when
+ ProcessInstance instance = runtimeService
+ .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
+ assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage");
+ runtimeService.createMessageCorrelation("WorkflowMessage")
+ .processInstanceBusinessKey("businessKey")
+ .correlateWithResult();
+ // then
+ assertThat(instance).isEnded().hasPassedInOrder(
+ "CreateAndActivatePnf_StartEvent",
+ "CheckAiiForCorrelationId",
+ "DoesAaiContainInfoAboutPnf",
+ "CreateAndActivatePnf_CreateAaiEntry",
+ "AaiEntryExists",
+ "WaitForDmaapPnfReadyNotification"
+ );
+ assertThat(aaiConnection.getCreated()).containsExactly(ID_WITHOUT_ENTRY);
+ }
+
+ private List<HistoricVariableInstance> getVariables(ProcessInstance instance) {
+ return processEngineRule.getHistoryService().createHistoricVariableInstanceQuery()
+ .processInstanceId(instance.getProcessInstanceId()).taskIdIn().list();
+ }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/applicationContext_forPnfTesting.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/applicationContext_forPnfTesting.xml
new file mode 100644
index 0000000000..b222383c82
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/applicationContext_forPnfTesting.xml
@@ -0,0 +1,59 @@
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-2.5.xsd" >
+
+ <bean id="dataSource" class="org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy">
+ <property name="targetDataSource">
+ <bean class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
+ <property name="driverClass" value="org.h2.Driver" />
+ <property name="url"
+ value="jdbc:h2:mem:process-engine;DB_CLOSE_DELAY=1000" />
+ <property name="username" value="sa" />
+ <property name="password" value="" />
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
+ <property name="dataSource" ref="dataSource" />
+ </bean>
+
+ <bean id="processEngineConfiguration" class="org.camunda.bpm.engine.spring.SpringProcessEngineConfiguration">
+ <property name="processEngineName" value="engine" />
+ <property name="dataSource" ref="dataSource" />
+ <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">
+ <property name="processEngineConfiguration" ref="processEngineConfiguration" />
+ </bean>
+
+ <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
+ <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" />
+ <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
+ <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
+ <bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" />
+
+ <context:annotation-config />
+
+ <bean id="processEngineRule" class="org.camunda.bpm.engine.test.ProcessEngineRule">
+ <property name="processEngine" ref="processEngine" />
+ </bean>
+
+ <bean id="aaiConnection" class="org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl"/>
+
+ <bean id="checkAaiForCorrelationIdDelegate" class="org.openecomp.mso.bpmn.infrastructure.pnf.delegate.CheckAaiForCorrelationIdDelegate">
+ <property name="aaiConnection" ref="aaiConnection"/>
+ </bean>
+
+ <bean id="createAaiEntryWithPnfIdDelegate" class="org.openecomp.mso.bpmn.infrastructure.pnf.delegate.CreateAaiEntryWithPnfIdDelegate">
+ <property name="aaiConnection" ref="aaiConnection"/>
+ </bean>
+</beans>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/log4j.properties b/bpmn/MSOInfrastructureBPMN/src/test/resources/log4j.properties
new file mode 100644
index 0000000000..393e0877ec
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/log4j.properties
@@ -0,0 +1,8 @@
+# Root logger option
+log4j.rootLogger=INFO, stdout
+
+# Direct log messages to stdout
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n \ No newline at end of file