diff options
12 files changed, 21 insertions, 20 deletions
diff --git a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/AaiProducerReactiveHttpClient.java b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/AaiProducerReactiveHttpClient.java index 9e282cde..665d65a3 100644 --- a/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/AaiProducerReactiveHttpClient.java +++ b/prh-aai-client/src/main/java/org/onap/dcaegen2/services/prh/service/producer/AaiProducerReactiveHttpClient.java @@ -79,7 +79,7 @@ public class AaiProducerReactiveHttpClient { private Mono<ClientResponse> patchAaiRequest(ConsumerDmaapModel dmaapModel) { return webClient.patch() - .uri(getUri(dmaapModel.getSourceName())) + .uri(getUri(dmaapModel.getCorrelationId())) .header(X_ONAP_REQUEST_ID, MDC.get(REQUEST_ID)) .header(X_INVOCATION_ID, UUID.randomUUID().toString()) .body(Mono.just(createJsonBody(dmaapModel)), String.class) diff --git a/prh-aai-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/AaiProducerReactiveHttpClientTest.java b/prh-aai-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/AaiProducerReactiveHttpClientTest.java index 03f9ec64..5fd966dc 100644 --- a/prh-aai-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/AaiProducerReactiveHttpClientTest.java +++ b/prh-aai-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/AaiProducerReactiveHttpClientTest.java @@ -66,7 +66,7 @@ class AaiProducerReactiveHttpClientTest { setupHeaders(); clientResponse = mock(ClientResponse.class); clientResponseMono = Mono.just(clientResponse); - when(dmaapModel.getSourceName()).thenReturn("NOKnhfsadhff"); + when(dmaapModel.getCorrelationId()).thenReturn("NOKnhfsadhff"); when(aaiConfigurationMock.aaiHost()).thenReturn("54.45.33.2"); when(aaiConfigurationMock.aaiProtocol()).thenReturn("https"); when(aaiConfigurationMock.aaiPort()).thenReturn(1234); diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java index 4e34f6e6..1d121b38 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParser.java @@ -43,6 +43,7 @@ public class DmaapConsumerJsonParser { private static final String OAM_IPV_4_ADDRESS = "oamV4IpAddress"; private static final String OAM_IPV_6_ADDRESS = "oamV6IpAddress"; private static final String SOURCE_NAME = "sourceName"; + private static final String CORRELATION_ID = "correlationId"; /** * Extract info from string and create @see {@link org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel}. @@ -99,7 +100,7 @@ public class DmaapConsumerJsonParser { ? Mono.error(new DmaapNotFoundException("Incorrect json, consumerDmaapModel can not be created: " + printMessage(pnfSourceName, pnfOamIpv4Address, pnfOamIpv6Address))) : Mono.just(ImmutableConsumerDmaapModel.builder() - .sourceName(pnfSourceName) + .correlationId(pnfSourceName) .ipv4(pnfOamIpv4Address) .ipv6(pnfOamIpv6Address).build()); } @@ -118,7 +119,7 @@ public class DmaapConsumerJsonParser { private String printMessage(String sourceName, String oamIpv4Address, String oamIpv6Address) { return String.format("%n{" - + "\"" + SOURCE_NAME + "\": \"%s\"," + + "\"" + CORRELATION_ID + "\": \"%s\"," + "\"" + OAM_IPV_4_ADDRESS + "\": \"%s\"," + "\"" + OAM_IPV_6_ADDRESS + "\": \"%s\"" + "%n}", sourceName, oamIpv4Address, oamIpv6Address); diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParserTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParserTest.java index 2cbb6800..225d46ee 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParserTest.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/service/DmaapConsumerJsonParserTest.java @@ -76,7 +76,7 @@ class DmaapConsumerJsonParserTest { ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder().ipv4("10.16.123.234") .ipv6("0:0:0:0:0:FFFF:0A10:7BEA") - .sourceName("NOKQTFCOC540002E").build(); + .correlationId("NOKQTFCOC540002E").build(); //when DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser()); JsonElement jsonElement = new JsonParser().parse(parsed); @@ -133,7 +133,7 @@ class DmaapConsumerJsonParserTest { //then ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder().ipv4("") .ipv6("0:0:0:0:0:FFFF:0A10:7BEA") - .sourceName("NOKQTFCOC540002E").build(); + .correlationId("NOKQTFCOC540002E").build(); Assertions.assertNotNull(consumerDmaapModel); Assertions.assertEquals(expectedObject, consumerDmaapModel); } @@ -172,7 +172,7 @@ class DmaapConsumerJsonParserTest { + "}}}"; ConsumerDmaapModel expectedObject = ImmutableConsumerDmaapModel.builder().ipv4("10.16.123.234").ipv6("") - .sourceName("NOKQTFCOC540002E").build(); + .correlationId("NOKQTFCOC540002E").build(); //when DmaapConsumerJsonParser dmaapConsumerJsonParser = spy(new DmaapConsumerJsonParser()); JsonElement jsonElement = new JsonParser().parse(parsed); diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java index f5cc6b24..6a9326e1 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java @@ -81,7 +81,7 @@ class AaiProducerTaskImplTest { .build(); consumerDmaapModel = ImmutableConsumerDmaapModel.builder().ipv4("10.16.123.234") .ipv6("0:0:0:0:0:FFFF:0A10:7BEA") - .sourceName("NOKQTFCOC540002E").build(); + .correlationId("NOKQTFCOC540002E").build(); appConfig = mock(AppConfig.class); } diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java index 6bcd9b2c..c128fb95 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java @@ -67,7 +67,7 @@ class DmaapConsumerTaskImplTest { consumerDmaapModel = ImmutableConsumerDmaapModel.builder().ipv4("10.16.123.234") .ipv6("0:0:0:0:0:FFFF:0A10:7BEA") - .sourceName("NOKQTFCOC540002E").build(); + .correlationId("NOKQTFCOC540002E").build(); appConfig = mock(AppConfig.class); message = "[{\"event\": {" diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImplTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImplTest.java index c410fc35..fad7a067 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImplTest.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImplTest.java @@ -65,7 +65,7 @@ class DmaapPublisherTaskImplTest { .dmaapTopicName("unauthenticated.SEC_OTHER_OUTPUT").build(); consumerDmaapModel = ImmutableConsumerDmaapModel.builder().ipv4("10.16.123.234") .ipv6("0:0:0:0:0:FFFF:0A10:7BEA") - .sourceName("NOKQTFCOC540002E").build(); + .correlationId("NOKQTFCOC540002E").build(); appConfig = mock(AppConfig.class); } diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java index 83a078df..20820fce 100644 --- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java +++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/CommonFunctions.java @@ -40,6 +40,6 @@ public class CommonFunctions { GsonBuilder gsonBuilder = new GsonBuilder(); ServiceLoader.load(TypeAdapterFactory.class).forEach(gsonBuilder::registerTypeAdapterFactory); return gsonBuilder.create().toJson(ImmutableConsumerDmaapModel.builder().ipv4(consumerDmaapModel.getIpv4()) - .ipv6(consumerDmaapModel.getIpv6()).sourceName(consumerDmaapModel.getSourceName()).build()); + .ipv6(consumerDmaapModel.getIpv6()).correlationId(consumerDmaapModel.getCorrelationId()).build()); } }
\ No newline at end of file diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java index f34256c5..6d488c85 100644 --- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java +++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModel.java @@ -32,8 +32,8 @@ import org.immutables.value.Value; @Gson.TypeAdapters(fieldNamingStrategy = true) public interface ConsumerDmaapModel { - @SerializedName(value = "sourceName", alternate = "sourceName") - String getSourceName(); + @SerializedName(value = "correlationId", alternate = "correlationId") + String getCorrelationId(); @SerializedName(value = "ipaddress-v4-oam", alternate = "ipaddress-v4-oam") String getIpv4(); diff --git a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelForUnitTest.java b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelForUnitTest.java index 339ddb6d..8a0699c7 100644 --- a/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelForUnitTest.java +++ b/prh-commons/src/main/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelForUnitTest.java @@ -22,7 +22,7 @@ package org.onap.dcaegen2.services.prh.model; public class ConsumerDmaapModelForUnitTest implements ConsumerDmaapModel { - private final String sourceName; + private final String correlationId; private final String ipv4; private final String ipv6; @@ -30,14 +30,14 @@ public class ConsumerDmaapModelForUnitTest implements ConsumerDmaapModel { * Class for testing serialization of ConsumerDmaapModel. */ public ConsumerDmaapModelForUnitTest() { - this.sourceName = "NOKnhfsadhff"; + this.correlationId = "NOKnhfsadhff"; this.ipv4 = "256.22.33.155"; this.ipv6 = "2001:0db8:85a3:0000:0000:8a2e:0370:7334"; } - public String getSourceName() { - return sourceName; + public String getCorrelationId() { + return correlationId; } public String getIpv4() { diff --git a/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/CommonFunctionsTest.java b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/CommonFunctionsTest.java index 90b32a09..b1cc01a6 100644 --- a/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/CommonFunctionsTest.java +++ b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/CommonFunctionsTest.java @@ -28,7 +28,7 @@ class CommonFunctionsTest { @Test void createJsonBody_shouldReturnJsonInString() { - String expectedResult = "{\"sourceName\":\"NOKnhfsadhff\",\"ipaddress-v4-oam\":\"256.22.33.155\"" + String expectedResult = "{\"correlationId\":\"NOKnhfsadhff\",\"ipaddress-v4-oam\":\"256.22.33.155\"" + ",\"ipaddress-v6-oam\":\"2001:0db8:85a3:0000:0000:8a2e:0370:7334\"}"; assertEquals(expectedResult, CommonFunctions.createJsonBody(new ConsumerDmaapModelForUnitTest())); } diff --git a/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelTest.java b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelTest.java index ed8d5293..4c4c345f 100644 --- a/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelTest.java +++ b/prh-commons/src/test/java/org/onap/dcaegen2/services/prh/model/ConsumerDmaapModelTest.java @@ -34,14 +34,14 @@ class ConsumerDmaapModelTest { String ipv4 = "11.22.33.155"; String ipv6 = "2001:0db8:85a3:0000:0000:8a2e:0370:7334"; ConsumerDmaapModel consumerDmaapModel = ImmutableConsumerDmaapModel.builder() - .sourceName(sourceName) + .correlationId(sourceName) .ipv4(ipv4) .ipv6(ipv6) .build(); // Then Assertions.assertNotNull(consumerDmaapModel); - Assertions.assertEquals(sourceName, consumerDmaapModel.getSourceName()); + Assertions.assertEquals(sourceName, consumerDmaapModel.getCorrelationId()); Assertions.assertEquals(ipv4, consumerDmaapModel.getIpv4()); Assertions.assertEquals(ipv6, consumerDmaapModel.getIpv6()); } |