summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common
diff options
context:
space:
mode:
authorLukasz Muszkieta <lukasz.muszkieta@nokia.com>2019-02-21 13:28:55 +0100
committerLukasz Muszkieta <lukasz.muszkieta@nokia.com>2019-02-21 13:55:32 +0100
commitf7bf1c998895e1599e861a4bf7a56270552245ea (patch)
tree3e55c2adfe3393831cfb93a6fa7fe3b7cdf93452 /bpmn/so-bpmn-infrastructure-common
parent860edae04456562fd7cf249968cd54b30b1f7f12 (diff)
Change interface name to be more suitable
Change-Id: Ifb4f6bc7f3e18974e9a11a17d474ad989c043673 Issue-ID: SO-1274 Signed-off-by: Lukasz Muszkieta <lukasz.muszkieta@nokia.com>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java (renamed from bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java)4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java (renamed from bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java)5
-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/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
10 files changed, 35 insertions, 37 deletions
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 8d353f134d..a8fb21540a 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
@@ -28,7 +28,7 @@ import java.io.IOException;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.bpmn.common.scripts.ExceptionUtil;
-import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -46,11 +46,11 @@ public class CheckAaiForCorrelationIdDelegate implements JavaDelegate {
private static final Logger logger = LoggerFactory.getLogger(CheckAaiForCorrelationIdDelegate.class);
- private AaiConnection aaiConnection;
+ private PnfManagement pnfManagement;
@Autowired
- public void setAaiConnection(AaiConnection aaiConnection) {
- this.aaiConnection = aaiConnection;
+ public void setPnfManagement(PnfManagement pnfManagement) {
+ this.pnfManagement = pnfManagement;
}
@Override
@@ -60,7 +60,7 @@ public class CheckAaiForCorrelationIdDelegate implements JavaDelegate {
new ExceptionUtil().buildAndThrowWorkflowException(execution, 500, CORRELATION_ID + " is not set");
}
try {
- boolean isEntry = aaiConnection.getEntryFor(correlationId).isPresent();
+ boolean isEntry = pnfManagement.getEntryFor(correlationId).isPresent();
logger.debug("AAI entry is found for pnf correlation id {}: {}", CORRELATION_ID, isEntry);
execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, isEntry);
} catch (IOException e) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java
index 2268d22bd2..c31041fbf7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java
@@ -28,7 +28,7 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableName
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -45,11 +45,11 @@ import org.springframework.stereotype.Component;
public class CreatePnfEntryInAaiDelegate implements JavaDelegate {
private static final Logger logger = LoggerFactory.getLogger(CreatePnfEntryInAaiDelegate.class);
- private AaiConnection aaiConnection;
+ private PnfManagement pnfManagement;
@Autowired
- public void setAaiConnection(AaiConnection aaiConnection) {
- this.aaiConnection = aaiConnection;
+ public void setPnfManagement(PnfManagement pnfManagement) {
+ this.pnfManagement = pnfManagement;
}
@Override
@@ -59,7 +59,7 @@ public class CreatePnfEntryInAaiDelegate implements JavaDelegate {
Pnf pnf = new Pnf();
pnf.setPnfId(pnfUuid);
pnf.setPnfName(correlationId);
- aaiConnection.createEntry(correlationId, pnf);
+ pnfManagement.createEntry(correlationId, pnf);
logger.debug("AAI entry is created for pnf correlation id: {}, pnf uuid: {}", correlationId, pnfUuid);
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java
index 21d43964f8..7b6706f820 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java
@@ -23,7 +23,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.onap.so.bpmn.common.scripts.ExceptionUtil;
-import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -34,11 +34,11 @@ public class CreateRelation implements JavaDelegate {
private static final Logger logger = LoggerFactory.getLogger(CreateRelation.class);
- private AaiConnection aaiConnectionImpl;
+ private PnfManagement pnfManagementImpl;
@Autowired
- public CreateRelation(AaiConnection aaiConnectionImpl) {
- this.aaiConnectionImpl = aaiConnectionImpl;
+ public CreateRelation(PnfManagement pnfManagementImpl) {
+ this.pnfManagementImpl = pnfManagementImpl;
}
@Override
@@ -46,7 +46,7 @@ public class CreateRelation implements JavaDelegate {
String serviceInstanceId = (String) delegateExecution.getVariable("serviceInstanceId");
String pnfName = (String) delegateExecution.getVariable("correlationId");
try {
- aaiConnectionImpl.createRelation(serviceInstanceId, pnfName);
+ pnfManagementImpl.createRelation(serviceInstanceId, pnfName);
} catch (Exception e) {
new ExceptionUtil().buildAndThrowWorkflowException(delegateExecution, 9999,
"An exception occurred when making service and pnf relation. Exception: " + e.getMessage());
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java
index eaabb2bfbb..b66bb5f61b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java
@@ -18,13 +18,13 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.pnf.implementation;
+package org.onap.so.bpmn.infrastructure.pnf.management;
import java.io.IOException;
import java.util.Optional;
import org.onap.aai.domain.yang.Pnf;
-public interface AaiConnection {
+public interface PnfManagement {
Optional<Pnf> getEntryFor(String correlationId) throws IOException;
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/management/PnfManagementImpl.java
index 1bf2a290cb..3d8da2a106 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/management/PnfManagementImpl.java
@@ -18,11 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.pnf.aai;
+package org.onap.so.bpmn.infrastructure.pnf.management;
import java.util.Optional;
import org.onap.aai.domain.yang.Pnf;
-import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.AAIRestClientImpl;
@@ -31,7 +30,7 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.springframework.stereotype.Component;
@Component
-public class AaiConnectionImpl implements AaiConnection {
+public class PnfManagementImpl implements PnfManagement {
@Override
public Optional<Pnf> getEntryFor(String correlationId) {
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/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 {