aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/test')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java11
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java37
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java (renamed from bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java)4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java (renamed from bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java)4
6 files changed, 30 insertions, 40 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java
index eeda355f80..4b47ed6407 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java
@@ -25,8 +25,8 @@ import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITHOUT_ENTRY;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.PnfManagementTestImpl.ID_WITHOUT_ENTRY;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.PnfManagementTestImpl.ID_WITH_ENTRY;
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;
@@ -53,7 +53,7 @@ public class CheckAaiForCorrelationIdDelegateTest {
@Before
public void setUp() {
delegate = new CheckAaiForCorrelationIdDelegate();
- delegate.setAaiConnection(new AaiConnectionTestImpl());
+ delegate.setPnfManagement(new PnfManagementTestImpl());
}
@Test
@@ -101,7 +101,7 @@ public class CheckAaiForCorrelationIdDelegateTest {
@Before
public void setUp() {
delegate = new CheckAaiForCorrelationIdDelegate();
- delegate.setAaiConnection(new AaiConnectionThrowingException());
+ delegate.setPnfManagement(new PnfManagementThrowingException());
}
@Test
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java
index c487125ea6..9c5f8f3fc4 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java
@@ -40,15 +40,15 @@ public class CreatePnfEntryInAaiDelegateTest {
// given
String pnfUuid = UUID.nameUUIDFromBytes("testUuid".getBytes()).toString();
CreatePnfEntryInAaiDelegate delegate = new CreatePnfEntryInAaiDelegate();
- AaiConnectionTestImpl aaiConnection = new AaiConnectionTestImpl();
- delegate.setAaiConnection(aaiConnection);
+ PnfManagementTestImpl pnfManagementTest = new PnfManagementTestImpl();
+ delegate.setPnfManagement(pnfManagementTest);
DelegateExecution execution = mock(DelegateExecution.class);
given(execution.getVariable(eq(CORRELATION_ID))).willReturn("testCorrelationId");
given(execution.getVariable(eq(PNF_UUID))).willReturn(pnfUuid);
// when
delegate.execute(execution);
// then
- Pnf createdEntry = aaiConnection.getCreated().get("testCorrelationId");
+ Pnf createdEntry = pnfManagementTest.getCreated().get("testCorrelationId");
assertThat(createdEntry.getPnfId()).isEqualTo(pnfUuid);
assertThat(createdEntry.getPnfName()).isEqualTo("testCorrelationId");
assertThat(createdEntry.isInMaint()).isNull();
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java
index 2dd3e23828..2a78337e34 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java
@@ -29,8 +29,7 @@ import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Before;
import org.junit.Test;
-import org.onap.so.bpmn.infrastructure.pnf.aai.AaiConnectionImpl;
-import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
public class CreateRelationTest {
@@ -49,17 +48,17 @@ public class CreateRelationTest {
@Test
public void createRelationSuccessful() throws IOException {
// given
- AaiConnection aaiConnectionMock = mock(AaiConnectionImpl.class);
- CreateRelation testedObject = new CreateRelation(aaiConnectionMock);
+ PnfManagement pnfManagementMock = mock(PnfManagement.class);
+ CreateRelation testedObject = new CreateRelation(pnfManagementMock);
// when
testedObject.execute(executionFake);
// then
- verify(aaiConnectionMock).createRelation(SERVICE_INSTANCE_ID, PNF_NAME);
+ verify(pnfManagementMock).createRelation(SERVICE_INSTANCE_ID, PNF_NAME);
}
@Test
public void shouldThrowBpmnErrorWhenExceptionOccurred() {
- CreateRelation testedObject = new CreateRelation(new AaiConnectionThrowingException());
+ CreateRelation testedObject = new CreateRelation(new PnfManagementThrowingException());
executionFake.setVariable("testProcessKey", "testProcessKeyValue");
assertThatThrownBy(() -> testedObject.execute(executionFake)).isInstanceOf(BpmnError.class);
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 1637b1a97f..80693d7ce6 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
@@ -20,14 +20,13 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
-import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION;
import java.util.UUID;
+import org.apache.commons.lang3.StringUtils;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
@@ -36,7 +35,7 @@ import org.junit.Test;
public class PnfCheckInputsTest {
- private static final String DEFAULT_TIMEOUT = "P1D";
+ private static final String PNF_ENTRY_NOTIFICATION_TIMEOUT = "P1D";
private static final String VALID_UUID = UUID.nameUUIDFromBytes("testUuid".getBytes()).toString();
private static final String RESERVED_UUID = new UUID(0, 0).toString();
private static final String DEFAULT_SERVICE_INSTANCE_ID = "da7d07d9-b71c-4128-809d-2ec01c807169";
@@ -51,50 +50,49 @@ public class PnfCheckInputsTest {
@Test
public void shouldThrowException_whenCorrelationIdNotSet() {
- PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT);
+ PnfCheckInputs testedObject = new PnfCheckInputs(PNF_ENTRY_NOTIFICATION_TIMEOUT);
DelegateExecution execution = delegateExecutionBuilder.setCorrelationId(null).setPnfUuid(VALID_UUID).build();
assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class);
}
@Test
- public void shouldThrowException_whenTimeoutIsEmptyStringAndDefaultIsNotDefined() {
+ public void shouldThrowException_whenPnfEntryNotificationTimeoutIsNull() {
PnfCheckInputs testedObject = new PnfCheckInputs(null);
- DelegateExecution execution = delegateExecutionBuilder.setTimeoutForNotification("").build();
+ DelegateExecution execution = delegateExecutionBuilder.build();
assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class);
}
@Test
- public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() {
- PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT);
- DelegateExecution execution = delegateExecutionBuilder.setTimeoutForNotification(null).build();
- testedObject.execute(execution);
- assertThat(execution.getVariable(TIMEOUT_FOR_NOTIFICATION)).isEqualTo(DEFAULT_TIMEOUT);
+ public void shouldThrowException_whenPnfEntryNotificationTimeoutIsEmpty() {
+ PnfCheckInputs testedObject = new PnfCheckInputs(StringUtils.EMPTY);
+ DelegateExecution execution = delegateExecutionBuilder.build();
+ assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class);
}
@Test
public void shouldThrowException_whenPnfUuidIsNotSet() {
- PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT);
+ PnfCheckInputs testedObject = new PnfCheckInputs(PNF_ENTRY_NOTIFICATION_TIMEOUT);
DelegateExecution execution = delegateExecutionBuilder.setPnfUuid(null).build();
assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class);
}
@Test
public void shouldThrowException_whenPnfUuidIsEmptyString() {
- PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT);
- DelegateExecution execution = delegateExecutionBuilder.setPnfUuid("").build();
+ PnfCheckInputs testedObject = new PnfCheckInputs(PNF_ENTRY_NOTIFICATION_TIMEOUT);
+ DelegateExecution execution = delegateExecutionBuilder.setPnfUuid(StringUtils.EMPTY).build();
assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class);
}
@Test
public void shouldThrowException_whenPnfUuidIsReservedUuid() {
- PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT);
+ PnfCheckInputs testedObject = new PnfCheckInputs(PNF_ENTRY_NOTIFICATION_TIMEOUT);
DelegateExecution execution = delegateExecutionBuilder.setPnfUuid(RESERVED_UUID).build();
assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class);
}
@Test
public void shouldThrowException_whenServiceInstanceIdIsNotSet() {
- PnfCheckInputs testedObject = new PnfCheckInputs(DEFAULT_TIMEOUT);
+ PnfCheckInputs testedObject = new PnfCheckInputs(PNF_ENTRY_NOTIFICATION_TIMEOUT);
DelegateExecution execution = delegateExecutionBuilder.setServiceInstanceId(null).build();
assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class);
}
@@ -103,7 +101,6 @@ public class PnfCheckInputsTest {
private String correlationId = DEFAULT_CORRELATION_ID;
private String pnfUuid = VALID_UUID;
private String serviceInstanceId = DEFAULT_SERVICE_INSTANCE_ID;
- private String timeoutForNotification;
public DelegateExecutionBuilder setCorrelationId(String correlationId) {
this.correlationId = correlationId;
@@ -120,18 +117,12 @@ public class PnfCheckInputsTest {
return this;
}
- public DelegateExecutionBuilder setTimeoutForNotification(String timeoutForNotification) {
- this.timeoutForNotification = timeoutForNotification;
- return this;
- }
-
public DelegateExecution build() {
DelegateExecution execution = new DelegateExecutionFake();
execution.setVariable("testProcessKey", "testProcessKeyValue");
execution.setVariable(CORRELATION_ID, this.correlationId);
execution.setVariable(PNF_UUID, this.pnfUuid);
execution.setVariable(SERVICE_INSTANCE_ID, this.serviceInstanceId);
- execution.setVariable(TIMEOUT_FOR_NOTIFICATION, this.timeoutForNotification);
return execution;
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java
index 76b62a9cea..1377c8295f 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java
@@ -21,7 +21,7 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
import org.onap.aai.domain.yang.Pnf;
-import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
import java.io.IOException;
import java.util.HashMap;
@@ -29,7 +29,7 @@ import java.util.Map;
import java.util.Objects;
import java.util.Optional;
-public class AaiConnectionTestImpl implements AaiConnection {
+public class PnfManagementTestImpl implements PnfManagement {
public static final String ID_WITHOUT_ENTRY = "IdWithoutEntry";
public static final String ID_WITH_ENTRY = "idWithEntryNoIp";
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java
index 300d1e4c9b..43315d3803 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java
@@ -23,9 +23,9 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate;
import java.io.IOException;
import java.util.Optional;
import org.onap.aai.domain.yang.Pnf;
-import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
-public class AaiConnectionThrowingException implements AaiConnection {
+public class PnfManagementThrowingException implements PnfManagement {
@Override
public Optional<Pnf> getEntryFor(String correlationId) throws IOException {