Change interface name to be more suitable 20/78920/1
authorLukasz Muszkieta <lukasz.muszkieta@nokia.com>
Thu, 21 Feb 2019 12:28:55 +0000 (13:28 +0100)
committerLukasz Muszkieta <lukasz.muszkieta@nokia.com>
Thu, 21 Feb 2019 12:55:32 +0000 (13:55 +0100)
Change-Id: Ifb4f6bc7f3e18974e9a11a17d474ad989c043673
Issue-ID: SO-1274
Signed-off-by: Lukasz Muszkieta <lukasz.muszkieta@nokia.com>
12 files changed:
bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java
bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java [moved from bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java with 94% similarity]
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegate.java
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelation.java
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagement.java [moved from bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/implementation/AaiConnection.java with 93% similarity]
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/management/PnfManagementImpl.java [moved from bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/aai/AaiConnectionImpl.java with 92% similarity]
bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java
bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java
bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java
bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java [moved from bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java with 93% similarity]
bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java [moved from bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java with 91% similarity]

index db6cbe0..13fe61f 100644 (file)
@@ -46,14 +46,14 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
     private Map<String, Object> variables;
 
     @Autowired
-    private AaiConnectionTestImpl aaiConnection;
+    private PnfManagementTestImpl pnfManagementTest;
 
     @Autowired
     private DmaapClientTestImpl dmaapClientTestImpl;
 
     @Before
     public void setup() {
-        aaiConnection.reset();
+        pnfManagementTest.reset();
         variables = new HashMap<>();
         variables.put("serviceInstanceId", SERVICE_INSTANCE_ID);
         variables.put(PNF_UUID, VALID_UUID);
@@ -62,7 +62,7 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
     @Test
     public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenAaiEntryExists() {
         // given
-        variables.put(CORRELATION_ID, AaiConnectionTestImpl.ID_WITH_ENTRY);
+        variables.put(CORRELATION_ID, PnfManagementTestImpl.ID_WITH_ENTRY);
         // when
         ProcessInstance instance = runtimeService
                 .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
@@ -81,14 +81,14 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
                 "CreateRelationId",
                 "AaiEntryUpdated"
         );
-        Assertions.assertThat(aaiConnection.getServiceAndPnfRelationMap()).
-                containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID,AaiConnectionTestImpl.ID_WITH_ENTRY));
+        Assertions.assertThat(pnfManagementTest.getServiceAndPnfRelationMap()).
+                containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID, PnfManagementTestImpl.ID_WITH_ENTRY));
     }
 
     @Test
     public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntryExists() {
         // given
-        variables.put(CORRELATION_ID, AaiConnectionTestImpl.ID_WITHOUT_ENTRY);
+        variables.put(CORRELATION_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY);
         // when
         ProcessInstance instance = runtimeService
                 .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
@@ -108,8 +108,8 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest {
                 "CreateRelationId",
                 "AaiEntryUpdated"
         );
-        Assertions.assertThat(aaiConnection.getCreated()).containsOnlyKeys(AaiConnectionTestImpl.ID_WITHOUT_ENTRY);
-        Assertions.assertThat(aaiConnection.getServiceAndPnfRelationMap()).
-                containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID,AaiConnectionTestImpl.ID_WITHOUT_ENTRY));
+        Assertions.assertThat(pnfManagementTest.getCreated()).containsOnlyKeys(PnfManagementTestImpl.ID_WITHOUT_ENTRY);
+        Assertions.assertThat(pnfManagementTest.getServiceAndPnfRelationMap()).
+                containsOnly(MapEntry.entry(SERVICE_INSTANCE_ID, PnfManagementTestImpl.ID_WITHOUT_ENTRY));
     }
 }
@@ -25,13 +25,13 @@ import java.util.Map;
 import java.util.Objects;
 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;
 import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Component;
 
 @Component
 @Primary
-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";
index 8d353f1..a8fb215 100644 (file)
@@ -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) {
index 2268d22..c31041f 100644 (file)
@@ -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);
     }
 }
index 21d4396..7b6706f 100644 (file)
@@ -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());
  * ============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;
 
  * ============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) {
index eeda355..4b47ed6 100644 (file)
@@ -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
index c487125..9c5f8f3 100644 (file)
@@ -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();
index 2dd3e23..2a78337 100644 (file)
@@ -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);
@@ -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";
@@ -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 {