diff options
author | 2019-06-27 12:25:59 +0200 | |
---|---|---|
committer | 2019-06-28 15:15:33 +0200 | |
commit | 768ab8275b35750ebf46411be54e7bd452a95578 (patch) | |
tree | fbd7c81e0dd293daa7a228c9517c6a31baf325d5 /prh-app-server/src/test | |
parent | 3e9dc9c5421fe2997e2e5032c6c587c389d9f483 (diff) |
fix PRH dmaap content type configuration after breaking changes introduced to SDK
and mix of minor code cleanups
Change-Id: I568f49b8b6635f23b2089a4355eb78451102c2b1
Issue-ID: DCAEGEN2-1647
Signed-off-by: grabinsk <maciej.grabinski@nokia.com>
Diffstat (limited to 'prh-app-server/src/test')
4 files changed, 14 insertions, 6 deletions
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java index b398c501..c11fe492 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java @@ -23,6 +23,7 @@ package org.onap.dcaegen2.services.prh; import org.onap.dcaegen2.services.sdk.model.streams.dmaap.ImmutableMessageRouterSink; import org.onap.dcaegen2.services.sdk.model.streams.dmaap.ImmutableMessageRouterSource; import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.ImmutableAaiClientConfiguration; +import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.ContentType; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.ImmutableMessageRouterPublishRequest; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.ImmutableMessageRouterSubscribeRequest; @@ -44,7 +45,7 @@ public class TestAppConfiguration { public static ImmutableMessageRouterPublishRequest createDefaultMessageRouterPublishRequest() { return ImmutableMessageRouterPublishRequest.builder() - .contentType("application/json") + .contentType(ContentType.APPLICATION_JSON) .sinkDefinition(ImmutableMessageRouterSink.builder() .name("the topic") .topicUrl(String.format("http://%s:%d/events/TOPIC", "www", 1234)) diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/ConsulConfigurationParserTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/ConsulConfigurationParserTest.java index 79a3873a..3a4db1dd 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/ConsulConfigurationParserTest.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/ConsulConfigurationParserTest.java @@ -27,6 +27,7 @@ import org.junit.jupiter.api.Test; import org.onap.dcaegen2.services.prh.TestAppConfiguration; import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.AaiClientConfiguration; import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.ImmutableAaiClientConfiguration; +import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.ContentType; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.MessageRouterPublishRequest; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.MessageRouterSubscribeRequest; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.config.MessageRouterPublisherConfig; @@ -84,11 +85,21 @@ class ConsulConfigurationParserTest { MessageRouterPublishRequest messageRouterPublishRequest = consulConfigurationParser.getMessageRouterPublishRequest(); // then - assertThat(messageRouterPublishRequest.contentType()).isEqualTo("application/json"); + assertThat(messageRouterPublishRequest.contentType()).isEqualTo(ContentType.APPLICATION_JSON); assertThat(messageRouterPublishRequest.sinkDefinition().topicUrl()).isEqualTo("http://dmaap-mr:2222/events/unauthenticated.PNF_READY"); } @Test + void shouldCreateMessageRouterUpdatePublishConfigurationCorrectly() { + // when + MessageRouterPublishRequest messageRouterPublishRequest = consulConfigurationParser.getMessageRouterUpdatePublishRequest(); + + // then + assertThat(messageRouterPublishRequest.contentType()).isEqualTo(ContentType.APPLICATION_JSON); + assertThat(messageRouterPublishRequest.sinkDefinition().topicUrl()).isEqualTo("http://dmaap-mr:2222/events/unauthenticated.PNF_UPDATE"); + } + + @Test void whenDmaapCertAuthIsDisabled_MessageRouterPublisherConfigSecurityKeysShouldBeIgnored() { assumeFalse(correctConfig.getAsJsonObject("config").get("security.enableDmaapCertAuth").getAsBoolean()); 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 a5405069..7e00a441 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 @@ -108,7 +108,6 @@ class DmaapPublisherTaskImplTest { return ImmutableMessageRouterPublishRequest.builder() .sinkDefinition(sinkDefinition) - .contentType("application/json") .build(); } }
\ No newline at end of file diff --git a/prh-app-server/src/test/resources/configurationFromCbs.json b/prh-app-server/src/test/resources/configurationFromCbs.json index 85dd4de2..d76aab4f 100644 --- a/prh-app-server/src/test/resources/configurationFromCbs.json +++ b/prh-app-server/src/test/resources/configurationFromCbs.json @@ -2,17 +2,14 @@ "config":{ "dmaap.dmaapConsumerConfiguration.dmaapUserName":"admin", "dmaap.dmaapConsumerConfiguration.dmaapUserPassword":"admin", - "dmaap.dmaapConsumerConfiguration.dmaapContentType":"application/json", "dmaap.dmaapConsumerConfiguration.consumerId":"c12", "dmaap.dmaapConsumerConfiguration.consumerGroup":"OpenDCAE-c12", "dmaap.dmaapConsumerConfiguration.timeoutMs":-1, "dmaap.dmaapProducerConfiguration.dmaapUserName":"admin", "dmaap.dmaapProducerConfiguration.dmaapUserPassword":"admin", - "dmaap.dmaapProducerConfiguration.dmaapContentType":"application/json", "dmaap.dmaapUpdateProducerConfiguration.dmaapUserName":"admin", "dmaap.dmaapUpdateProducerConfiguration.dmaapUserPassword":"admin", - "dmaap.dmaapUpdateProducerConfiguration.dmaapContentType":"application/json", "aai.aaiClientConfiguration.pnfUrl": "https://aai.onap.svc.cluster.local:8443/aai/v12/network/pnfs/pnf", "aai.aaiClientConfiguration.aaiUserName":"AAI", "aai.aaiClientConfiguration.aaiUserPassword":"AAI", |