From f7bf1c998895e1599e861a4bf7a56270552245ea Mon Sep 17 00:00:00 2001 From: Lukasz Muszkieta Date: Thu, 21 Feb 2019 13:28:55 +0100 Subject: Change interface name to be more suitable Change-Id: Ifb4f6bc7f3e18974e9a11a17d474ad989c043673 Issue-ID: SO-1274 Signed-off-by: Lukasz Muszkieta --- .../pnf/delegate/AaiConnectionTestImpl.java | 73 ---------------------- .../delegate/CreateAndActivatePnfResourceTest.java | 18 +++--- .../pnf/delegate/PnfManagementTestImpl.java | 73 ++++++++++++++++++++++ 3 files changed, 82 insertions(+), 82 deletions(-) delete mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java create mode 100644 bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java (limited to 'bpmn/mso-infrastructure-bpmn/src/test/java/org') diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java deleted file mode 100644 index 4e0bf02685..0000000000 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ============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.onap.so.bpmn.infrastructure.pnf.delegate; - -import java.util.HashMap; -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.springframework.context.annotation.Primary; -import org.springframework.stereotype.Component; - -@Component -@Primary -public class AaiConnectionTestImpl implements AaiConnection { - - public static final String ID_WITHOUT_ENTRY = "IdWithoutEntry"; - public static final String ID_WITH_ENTRY = "idWithEntryNoIp"; - - private Map created = new HashMap<>(); - private Map serviceAndPnfRelationMap = new HashMap<>(); - - @Override - public Optional getEntryFor(String correlationId) { - if (Objects.equals(correlationId, ID_WITH_ENTRY)) { - return Optional.of(new Pnf()); - } else { - return Optional.empty(); - } - } - - @Override - public void createEntry(String correlationId, Pnf entry) { - created.put(correlationId, entry); - } - - @Override - public void createRelation(String serviceInstanceId, String pnfName) { - serviceAndPnfRelationMap.put(serviceInstanceId, pnfName); - } - - public Map getCreated() { - return created; - } - - public Map getServiceAndPnfRelationMap() { - return serviceAndPnfRelationMap; - } - - public void reset() { - created.clear(); - serviceAndPnfRelationMap.clear(); - } -} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java index db6cbe06ae..13fe61f704 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAndActivatePnfResourceTest.java @@ -46,14 +46,14 @@ public class CreateAndActivatePnfResourceTest extends BaseIntegrationTest { private Map 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)); } } diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java new file mode 100644 index 0000000000..84c983619b --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java @@ -0,0 +1,73 @@ +/*- + * ============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.onap.so.bpmn.infrastructure.pnf.delegate; + +import java.util.HashMap; +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.management.PnfManagement; +import org.springframework.context.annotation.Primary; +import org.springframework.stereotype.Component; + +@Component +@Primary +public class PnfManagementTestImpl implements PnfManagement { + + public static final String ID_WITHOUT_ENTRY = "IdWithoutEntry"; + public static final String ID_WITH_ENTRY = "idWithEntryNoIp"; + + private Map created = new HashMap<>(); + private Map serviceAndPnfRelationMap = new HashMap<>(); + + @Override + public Optional getEntryFor(String correlationId) { + if (Objects.equals(correlationId, ID_WITH_ENTRY)) { + return Optional.of(new Pnf()); + } else { + return Optional.empty(); + } + } + + @Override + public void createEntry(String correlationId, Pnf entry) { + created.put(correlationId, entry); + } + + @Override + public void createRelation(String serviceInstanceId, String pnfName) { + serviceAndPnfRelationMap.put(serviceInstanceId, pnfName); + } + + public Map getCreated() { + return created; + } + + public Map getServiceAndPnfRelationMap() { + return serviceAndPnfRelationMap; + } + + public void reset() { + created.clear(); + serviceAndPnfRelationMap.clear(); + } +} -- cgit 1.2.3-korg