diff options
author | Joanna Jeremicz <joanna.jeremicz@nokia.com> | 2019-02-25 09:11:16 +0100 |
---|---|---|
committer | Michal Kabaj <michal.kabaj@nokia.com> | 2019-02-28 11:22:04 +0100 |
commit | fee6611fa805b6bb5f06f07b45396a71ad72c564 (patch) | |
tree | d55aea0fd3cdfc53d96fe11489828c015fdb8dfc /bpmn/so-bpmn-infrastructure-common/src/test/java/org | |
parent | ade5e9910524146f2257183909842263136698cc (diff) |
CorrelationId cleanup
Remove old correlationId field and references from ServiceInstancesRequest and rename correlationId to pnfCorrelationId
Change-Id: I5d8861aebe14c68574b6c54bc8d4eadf2967478b
Issue-ID: SO-1274
Signed-off-by: Michal Kabaj <michal.kabaj@nokia.com>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/test/java/org')
11 files changed, 73 insertions, 73 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java index 8507d9c092..b0ff82e3aa 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java @@ -37,9 +37,9 @@ public class CancelDmaapSubscriptionTest { DmaapClientTestImpl dmaapClientTest = new DmaapClientTestImpl(); delegate.setDmaapClient(dmaapClientTest); DelegateExecution delegateExecution = mock(DelegateExecution.class); - when(delegateExecution.getVariable(eq(ExecutionVariableNames.CORRELATION_ID))).thenReturn("testCorrelationId"); + when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID))).thenReturn("testPnfCorrelationId"); when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey"); - dmaapClientTest.registerForUpdate("testCorrelationId", () -> { + dmaapClientTest.registerForUpdate("testPnfCorrelationId", () -> { }); // when delegate.execute(delegateExecution); 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/CheckAaiForPnfCorrelationIdDelegateTest.java index 4b47ed6407..6a0aaf776e 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/CheckAaiForPnfCorrelationIdDelegateTest.java @@ -28,7 +28,7 @@ import static org.mockito.Mockito.when; 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; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -41,26 +41,26 @@ import org.junit.runner.RunWith; import org.onap.so.bpmn.core.WorkflowException; @RunWith(Enclosed.class) -public class CheckAaiForCorrelationIdDelegateTest { +public class CheckAaiForPnfCorrelationIdDelegateTest { public static class ConnectionOkTests { - private CheckAaiForCorrelationIdDelegate delegate; + private CheckAaiForPnfCorrelationIdDelegate delegate; @Rule public ExpectedException expectedException = ExpectedException.none(); @Before public void setUp() { - delegate = new CheckAaiForCorrelationIdDelegate(); + delegate = new CheckAaiForPnfCorrelationIdDelegate(); delegate.setPnfManagement(new PnfManagementTestImpl()); } @Test - public void shouldThrowExceptionWhenCorrelationIdIsNotSet() throws Exception { + public void shouldThrowExceptionWhenPnfCorrelationIdIsNotSet() throws Exception { // given DelegateExecution execution = mock(DelegateExecution.class); - when(execution.getVariable(CORRELATION_ID)).thenReturn(null); + when(execution.getVariable(PNF_CORRELATION_ID)).thenReturn(null); when(execution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue"); // when, then expectedException.expect(BpmnError.class); @@ -72,7 +72,7 @@ public class CheckAaiForCorrelationIdDelegateTest { public void shouldSetCorrectVariablesWhenAaiDoesNotContainInfoAboutPnf() throws Exception { // given DelegateExecution execution = mock(DelegateExecution.class); - when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITHOUT_ENTRY); + when(execution.getVariable(PNF_CORRELATION_ID)).thenReturn(ID_WITHOUT_ENTRY); // when delegate.execute(execution); // then @@ -83,7 +83,7 @@ public class CheckAaiForCorrelationIdDelegateTest { public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithoutIp() throws Exception { // given DelegateExecution execution = mock(DelegateExecution.class); - when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY); + when(execution.getVariable(PNF_CORRELATION_ID)).thenReturn(ID_WITH_ENTRY); // when delegate.execute(execution); // then @@ -93,14 +93,14 @@ public class CheckAaiForCorrelationIdDelegateTest { public static class NoConnectionTests { - private CheckAaiForCorrelationIdDelegate delegate; + private CheckAaiForPnfCorrelationIdDelegate delegate; @Rule public ExpectedException expectedException = ExpectedException.none(); @Before public void setUp() { - delegate = new CheckAaiForCorrelationIdDelegate(); + delegate = new CheckAaiForPnfCorrelationIdDelegate(); delegate.setPnfManagement(new PnfManagementThrowingException()); } @@ -108,7 +108,7 @@ public class CheckAaiForCorrelationIdDelegateTest { public void shouldThrowExceptionWhenIoExceptionOnConnectionToAai() throws Exception { // given DelegateExecution execution = mock(DelegateExecution.class); - when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY); + when(execution.getVariable(PNF_CORRELATION_ID)).thenReturn(ID_WITH_ENTRY); when(execution.getVariable("testProcessKey")).thenReturn("testProcessKey"); // when, then expectedException.expect(BpmnError.class); 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 9c5f8f3fc4..986edfeecf 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 @@ -25,7 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.BDDMockito.given; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; -import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import java.util.UUID; @@ -43,14 +43,14 @@ public class CreatePnfEntryInAaiDelegateTest { 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_CORRELATION_ID))).willReturn("testPnfCorrelationId"); given(execution.getVariable(eq(PNF_UUID))).willReturn(pnfUuid); // when delegate.execute(execution); // then - Pnf createdEntry = pnfManagementTest.getCreated().get("testCorrelationId"); + Pnf createdEntry = pnfManagementTest.getCreated().get("testPnfCorrelationId"); assertThat(createdEntry.getPnfId()).isEqualTo(pnfUuid); - assertThat(createdEntry.getPnfName()).isEqualTo("testCorrelationId"); + assertThat(createdEntry.getPnfName()).isEqualTo("testPnfCorrelationId"); 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 2a78337e34..c743ee7018 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 @@ -42,7 +42,7 @@ public class CreateRelationTest { public void setUp() { executionFake = new DelegateExecutionFake(); executionFake.setVariable("serviceInstanceId", SERVICE_INSTANCE_ID); - executionFake.setVariable("correlationId", PNF_NAME); + executionFake.setVariable("pnfCorrelationId", PNF_NAME); } @Test diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java index f2a4205ebd..19ba18f6de 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java @@ -25,19 +25,19 @@ import java.util.Objects; public class DmaapClientTestImpl implements DmaapClient { - private String correlationId; + private String pnfCorrelationId; private Runnable informConsumer; @Override - public void registerForUpdate(String correlationId, Runnable informConsumer) { - this.correlationId = correlationId; + public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer) { + this.pnfCorrelationId = pnfCorrelationId; this.informConsumer = informConsumer; } @Override - public Runnable unregister(String correlationId) { - if (Objects.equals(this.correlationId, correlationId)) { - this.correlationId = null; + public Runnable unregister(String pnfCorrelationId) { + if (Objects.equals(this.pnfCorrelationId, pnfCorrelationId)) { + this.pnfCorrelationId = null; Runnable informConsumer = this.informConsumer; this.informConsumer = null; return informConsumer; @@ -45,8 +45,8 @@ public class DmaapClientTestImpl implements DmaapClient { return null; } - public String getCorrelationId() { - return correlationId; + public String getPnfCorrelationId() { + return pnfCorrelationId; } public Runnable getInformConsumer() { @@ -58,6 +58,6 @@ public class DmaapClientTestImpl implements DmaapClient { } public boolean haveRegisteredConsumer() { - return correlationId != null; + return pnfCorrelationId != null; } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java index 23c82229fe..eb9f657d4f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java @@ -55,7 +55,7 @@ public class InformDmaapClientTest { // when informDmaapClient.execute(delegateExecution); // then - assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId"); + assertThat(dmaapClientTest.getPnfCorrelationId()).isEqualTo("testPnfCorrelationId"); assertThat(dmaapClientTest.getInformConsumer()).isNotNull(); verifyZeroInteractions(messageCorrelationBuilder); } @@ -66,7 +66,7 @@ public class InformDmaapClientTest { informDmaapClient.execute(delegateExecution); dmaapClientTest.getInformConsumer().run(); // then - assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId"); + assertThat(dmaapClientTest.getPnfCorrelationId()).isEqualTo("testPnfCorrelationId"); InOrder inOrder = inOrder(messageCorrelationBuilder); inOrder.verify(messageCorrelationBuilder).processInstanceBusinessKey("testBusinessKey"); inOrder.verify(messageCorrelationBuilder).correlateWithResult(); @@ -74,7 +74,7 @@ public class InformDmaapClientTest { private DelegateExecution mockDelegateExecution() { DelegateExecution delegateExecution = mock(DelegateExecution.class); - when(delegateExecution.getVariable(eq(ExecutionVariableNames.CORRELATION_ID))).thenReturn("testCorrelationId"); + when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID))).thenReturn("testPnfCorrelationId"); when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey"); ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class); when(delegateExecution.getProcessEngineServices()).thenReturn(processEngineServices); 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 80693d7ce6..001815b206 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 @@ -21,7 +21,7 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; 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_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; @@ -39,7 +39,7 @@ public class PnfCheckInputsTest { 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"; - private static final String DEFAULT_CORRELATION_ID = "testCorrelationId"; + private static final String DEFAULT_PNF_CORRELATION_ID = "testPnfCorrelationId"; private DelegateExecutionBuilder delegateExecutionBuilder; @@ -49,9 +49,9 @@ public class PnfCheckInputsTest { } @Test - public void shouldThrowException_whenCorrelationIdNotSet() { + public void shouldThrowException_whenPnfCorrelationIdNotSet() { PnfCheckInputs testedObject = new PnfCheckInputs(PNF_ENTRY_NOTIFICATION_TIMEOUT); - DelegateExecution execution = delegateExecutionBuilder.setCorrelationId(null).setPnfUuid(VALID_UUID).build(); + DelegateExecution execution = delegateExecutionBuilder.setPnfCorrelationId(null).setPnfUuid(VALID_UUID).build(); assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(BpmnError.class); } @@ -98,12 +98,12 @@ public class PnfCheckInputsTest { } private static class DelegateExecutionBuilder { - private String correlationId = DEFAULT_CORRELATION_ID; + private String pnfCorrelationId = DEFAULT_PNF_CORRELATION_ID; private String pnfUuid = VALID_UUID; private String serviceInstanceId = DEFAULT_SERVICE_INSTANCE_ID; - public DelegateExecutionBuilder setCorrelationId(String correlationId) { - this.correlationId = correlationId; + public DelegateExecutionBuilder setPnfCorrelationId(String pnfCorrelationId) { + this.pnfCorrelationId = pnfCorrelationId; return this; } @@ -120,7 +120,7 @@ public class PnfCheckInputsTest { public DelegateExecution build() { DelegateExecution execution = new DelegateExecutionFake(); execution.setVariable("testProcessKey", "testProcessKeyValue"); - execution.setVariable(CORRELATION_ID, this.correlationId); + execution.setVariable(PNF_CORRELATION_ID, this.pnfCorrelationId); execution.setVariable(PNF_UUID, this.pnfUuid); execution.setVariable(SERVICE_INSTANCE_ID, this.serviceInstanceId); return execution; diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java index 1377c8295f..3a9d6d0055 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java @@ -37,8 +37,8 @@ public class PnfManagementTestImpl implements PnfManagement { private Map<String, Pnf> created = new HashMap<>(); @Override - public Optional<Pnf> getEntryFor(String correlationId) { - if (Objects.equals(correlationId, ID_WITH_ENTRY)) { + public Optional<Pnf> getEntryFor(String pnfCorrelationId) { + if (Objects.equals(pnfCorrelationId, ID_WITH_ENTRY)) { return Optional.of(new Pnf()); } else { return Optional.empty(); @@ -46,8 +46,8 @@ public class PnfManagementTestImpl implements PnfManagement { } @Override - public void createEntry(String correlationId, Pnf entry) throws IOException { - created.put(correlationId, entry); + public void createEntry(String pnfCorrelationId, Pnf entry) throws IOException { + created.put(pnfCorrelationId, entry); } @Override diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java index 43315d3803..f9b467c650 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementThrowingException.java @@ -28,12 +28,12 @@ import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement; public class PnfManagementThrowingException implements PnfManagement { @Override - public Optional<Pnf> getEntryFor(String correlationId) throws IOException { + public Optional<Pnf> getEntryFor(String pnfCorrelationId) throws IOException { throw new IOException(); } @Override - public void createEntry(String correlationId, Pnf entry) throws IOException { + public void createEntry(String pnfCorrelationId, Pnf entry) throws IOException { throw new IOException(); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java index fde112b009..02a6f20992 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForCorrelationIdTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java @@ -27,40 +27,40 @@ import static org.assertj.core.api.Assertions.assertThat; import java.util.List; import org.junit.Test; -public class JsonUtilForCorrelationIdTest { +public class JsonUtilForPnfCorrelationIdTest { - private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[{\"correlationId\": \"corrTest1\"," - + "\"key1\":\"value1\"},{\"correlationId\": \"corrTest2\",\"key2\":\"value2\"}]"; + private static final String JSON_EXAMPLE_WITH_PNF_CORRELATION_ID = "[{\"pnfCorrelationId\": \"corrTest1\"," + + "\"key1\":\"value1\"},{\"pnfCorrelationId\": \"corrTest2\",\"key2\":\"value2\"}]"; - private static final String JSON_WITH_ONE_CORRELATION_ID = "[{\"correlationId\":\"corrTest3\"}]"; + private static final String JSON_WITH_ONE_PNF_CORRELATION_ID = "[{\"pnfCorrelationId\":\"corrTest3\"}]"; - private static final String JSON_WITH_TWO_CORRELATION_ID_AND_ESCAPED_CHARACTERS = - "[\"{\\\"correlationId\\\":\\\"corrTest4\\\"}\", \"{\\\"correlationId\\\":\\\"corrTest5\\\"}\"]"; + private static final String JSON_WITH_TWO_PNF_CORRELATION_ID_AND_ESCAPED_CHARACTERS = + "[\"{\\\"pnfCorrelationId\\\":\\\"corrTest4\\\"}\", \"{\\\"pnfCorrelationId\\\":\\\"corrTest5\\\"}\"]"; - private static final String JSON_WITH_NO_CORRELATION_ID = "[{\"key1\":\"value1\"}]"; + private static final String JSON_WITH_NO_PNF_CORRELATION_ID = "[{\"key1\":\"value1\"}]"; @Test public void parseJsonSuccessful() { - List<String> expectedResult = JsonUtilForCorrelationId - .parseJsonToGelAllCorrelationId(JSON_EXAMPLE_WITH_CORRELATION_ID); + List<String> expectedResult = JsonUtilForPnfCorrelationId + .parseJsonToGelAllPnfCorrelationId(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID); assertThat(expectedResult).containsExactly("corrTest1", "corrTest2"); - List<String> expectedResult2 = JsonUtilForCorrelationId - .parseJsonToGelAllCorrelationId(JSON_WITH_ONE_CORRELATION_ID); + List<String> expectedResult2 = JsonUtilForPnfCorrelationId + .parseJsonToGelAllPnfCorrelationId(JSON_WITH_ONE_PNF_CORRELATION_ID); assertThat(expectedResult2).containsExactly("corrTest3"); } @Test public void parseJsonWithEscapeCharacters_Successful() { - List<String> expectedResult = JsonUtilForCorrelationId - .parseJsonToGelAllCorrelationId(JSON_WITH_TWO_CORRELATION_ID_AND_ESCAPED_CHARACTERS); + List<String> expectedResult = JsonUtilForPnfCorrelationId + .parseJsonToGelAllPnfCorrelationId(JSON_WITH_TWO_PNF_CORRELATION_ID_AND_ESCAPED_CHARACTERS); assertThat(expectedResult).containsExactly("corrTest4", "corrTest5"); } @Test public void parseJson_emptyListReturnedWhenNothingFound() { - List<String> expectedResult = JsonUtilForCorrelationId - .parseJsonToGelAllCorrelationId(JSON_WITH_NO_CORRELATION_ID); + List<String> expectedResult = JsonUtilForPnfCorrelationId + .parseJsonToGelAllPnfCorrelationId(JSON_WITH_NO_PNF_CORRELATION_ID); assertThat(expectedResult).isEmpty(); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java index b30239d9c0..078c2f7784 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java @@ -56,12 +56,12 @@ import org.springframework.core.env.Environment; @RunWith(MockitoJUnitRunner.class) public class PnfEventReadyDmaapClientTest { - private static final String CORRELATION_ID = "corrTestId"; - private static final String CORRELATION_ID_NOT_FOUND_IN_MAP = "otherCorrId"; - private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[{\"correlationId\": \"%s\"," - + "\"value\":\"value1\"},{\"correlationId\": \"corr\",\"value\":\"value2\"}]"; + private static final String PNF_CORRELATION_ID = "corrTestId"; + private static final String PNF_CORRELATION_ID_NOT_FOUND_IN_MAP = "otherCorrId"; + private static final String JSON_EXAMPLE_WITH_PNF_CORRELATION_ID = "[{\"pnfCorrelationId\": \"%s\"," + + "\"value\":\"value1\"},{\"pnfCorrelationId\": \"corr\",\"value\":\"value2\"}]"; - private static final String JSON_EXAMPLE_WITH_NO_CORRELATION_ID = "[{\"key1\":\"value1\"}]"; + private static final String JSON_EXAMPLE_WITH_NO_PNF_CORRELATION_ID = "[{\"key1\":\"value1\"}]"; private static final String HOST = "hostTest"; private static final int PORT = 1234; @@ -108,10 +108,10 @@ public class PnfEventReadyDmaapClientTest { * empty) and shutdown the executor because of empty map */ @Test - public void correlationIdIsFoundInHttpResponse_notifyAboutPnfReady() + public void pnfCorrelationIdIsFoundInHttpResponse_notifyAboutPnfReady() throws IOException { when(httpClientMock.execute(any(HttpGet.class))). - thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID))); + thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID, PNF_CORRELATION_ID))); testedObjectInnerClassThread.run(); ArgumentCaptor<HttpGet> captor1 = ArgumentCaptor.forClass(HttpGet.class); verify(httpClientMock).execute(captor1.capture()); @@ -128,16 +128,16 @@ public class PnfEventReadyDmaapClientTest { /** * Test run method, where the are following conditions: * <p> - DmaapThreadListener is running, flag is set to true - * <p> - map is filled with one entry with the correlationId that does not match to correlationId + * <p> - map is filled with one entry with the pnfCorrelationId that does not match to pnfCorrelationId * taken from http response. run method should not do anything with the map not run any thread to notify camunda * process */ @Test - public void correlationIdIsFoundInHttpResponse_NotFoundInMap() + public void pnfCorrelationIdIsFoundInHttpResponse_NotFoundInMap() throws IOException { when(httpClientMock.execute(any(HttpGet.class))). thenReturn(createResponse( - String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID_NOT_FOUND_IN_MAP))); + String.format(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID, PNF_CORRELATION_ID_NOT_FOUND_IN_MAP))); testedObjectInnerClassThread.run(); verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock); } @@ -145,13 +145,13 @@ public class PnfEventReadyDmaapClientTest { /** * Test run method, where the are following conditions: * <p> - DmaapThreadListener is running, flag is set to true - * <p> - map is filled with one entry with the correlationId but no correlation id is taken from HttpResponse + * <p> - map is filled with one entry with the pnfCorrelationId but no correlation id is taken from HttpResponse * run method should not do anything with the map and not run any thread to notify camunda process */ @Test - public void correlationIdIsNotFoundInHttpResponse() throws IOException { + public void pnfCorrelationIdIsNotFoundInHttpResponse() throws IOException { when(httpClientMock.execute(any(HttpGet.class))). - thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_CORRELATION_ID)); + thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_PNF_CORRELATION_ID)); testedObjectInnerClassThread.run(); verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock); } @@ -171,7 +171,7 @@ public class PnfEventReadyDmaapClientTest { .getDeclaredField("pnfCorrelationIdToThreadMap"); pnfCorrelationToThreadMapField.setAccessible(true); Map<String, Runnable> pnfCorrelationToThreadMap = new ConcurrentHashMap<>(); - pnfCorrelationToThreadMap.put(CORRELATION_ID, threadMockToNotifyCamundaFlow); + pnfCorrelationToThreadMap.put(PNF_CORRELATION_ID, threadMockToNotifyCamundaFlow); pnfCorrelationToThreadMapField.set(testedObject, pnfCorrelationToThreadMap); Field threadRunFlag = testedObject.getClass().getDeclaredField("dmaapThreadListenerIsRunning"); |