summaryrefslogtreecommitdiffstats
path: root/prh-app-server/src/test/java
diff options
context:
space:
mode:
authorgrabinsk <maciej.grabinski@nokia.com>2019-06-27 12:25:59 +0200
committergrabinsk <maciej.grabinski@nokia.com>2019-06-28 15:15:33 +0200
commit768ab8275b35750ebf46411be54e7bd452a95578 (patch)
treefbd7c81e0dd293daa7a228c9517c6a31baf325d5 /prh-app-server/src/test/java
parent3e9dc9c5421fe2997e2e5032c6c587c389d9f483 (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/java')
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java3
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/ConsulConfigurationParserTest.java13
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImplTest.java1
3 files changed, 14 insertions, 3 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