aboutsummaryrefslogtreecommitdiffstats
path: root/rest-services/dmaap-client/src/test
diff options
context:
space:
mode:
authorPiotr Jaszczyk <piotr.jaszczyk@nokia.com>2019-03-26 11:40:29 +0100
committerPiotr Jaszczyk <piotr.jaszczyk@nokia.com>2019-03-26 14:22:50 +0100
commit918d24a717d057054ec3a9fe4962e51a54723ce4 (patch)
treeb3c9ce36d7c0bead37a377860dd2d64d1900e2b8 /rest-services/dmaap-client/src/test
parent015668f4a24fcc497151c6142a0bf70717c55f8e (diff)
Proposal of enhanced DMaaP API
Change-Id: Ia941489aaa3ee34c42cedd719a957ec2a2ea7181 Issue-ID: DCAEGEN2-1368 Signed-off-by: Piotr Jaszczyk <piotr.jaszczyk@nokia.com>
Diffstat (limited to 'rest-services/dmaap-client/src/test')
-rw-r--r--rest-services/dmaap-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/api/MessageRouterPublisherTest.java57
-rw-r--r--rest-services/dmaap-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/api/MessageRouterSubscriberTest.java65
2 files changed, 122 insertions, 0 deletions
diff --git a/rest-services/dmaap-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/api/MessageRouterPublisherTest.java b/rest-services/dmaap-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/api/MessageRouterPublisherTest.java
new file mode 100644
index 00000000..9656ae86
--- /dev/null
+++ b/rest-services/dmaap-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/api/MessageRouterPublisherTest.java
@@ -0,0 +1,57 @@
+/*
+ * ============LICENSE_START====================================
+ * DCAEGEN2-SERVICES-SDK
+ * =========================================================
+ * Copyright (C) 2019 Nokia. 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.dcaegen2.services.sdk.rest.services.dmaap.client.api;
+
+import static org.mockito.Mockito.mock;
+
+import com.google.gson.JsonPrimitive;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.Disabled;
+import org.onap.dcaegen2.services.sdk.model.streams.dmaap.MessageRouterSink;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.ImmutableMessageRouterPublishRequest;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.MessageRouterPublishRequest;
+import reactor.core.publisher.Flux;
+
+/**
+ * @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a>
+ * @since March 2019
+ */
+@Disabled
+class MessageRouterPublisherTest {
+
+ private final MessageRouterPublisher cut = mock(MessageRouterPublisher.class);
+ private final MessageRouterSink sinkDefinition = mock(MessageRouterSink.class);
+ private final MessageRouterPublishRequest request = ImmutableMessageRouterPublishRequest.builder()
+ .sinkDefinition(sinkDefinition).build();
+
+ @Test
+ void apiShouldBeUsableWithTransform() {
+ Flux.just(1, 2, 3)
+ .map(JsonPrimitive::new)
+ .transform(input -> cut.put(request, input));
+ }
+
+ @Test
+ void apiShouldBeUsableWithSingleCall() {
+ final Flux<JsonPrimitive> input = Flux.just(1, 2, 3).map(JsonPrimitive::new);
+ cut.put(request, input);
+ }
+} \ No newline at end of file
diff --git a/rest-services/dmaap-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/api/MessageRouterSubscriberTest.java b/rest-services/dmaap-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/api/MessageRouterSubscriberTest.java
new file mode 100644
index 00000000..b8bcde92
--- /dev/null
+++ b/rest-services/dmaap-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/api/MessageRouterSubscriberTest.java
@@ -0,0 +1,65 @@
+/*
+ * ============LICENSE_START====================================
+ * DCAEGEN2-SERVICES-SDK
+ * =========================================================
+ * Copyright (C) 2019 Nokia. 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.dcaegen2.services.sdk.rest.services.dmaap.client.api;
+
+import static org.mockito.Mockito.mock;
+
+import com.google.gson.JsonPrimitive;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.onap.dcaegen2.services.sdk.model.streams.dmaap.MessageRouterSink;
+import org.onap.dcaegen2.services.sdk.model.streams.dmaap.MessageRouterSource;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.DmaapResponse;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.ImmutableMessageRouterPublishRequest;
+import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.ImmutableMessageRouterSubscribeRequest;
+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.MessageRouterSubscribeResponse;
+import reactor.core.publisher.Flux;
+
+/**
+ * @author <a href="mailto:piotr.jaszczyk@nokia.com">Piotr Jaszczyk</a>
+ * @since March 2019
+ */
+@Disabled
+class MessageRouterSubscriberTest {
+
+ private final MessageRouterSubscriber cut = mock(MessageRouterSubscriber.class);
+ private final MessageRouterSource sinkDefinition = mock(MessageRouterSource.class);
+ private final MessageRouterSubscribeRequest request = ImmutableMessageRouterSubscribeRequest.builder()
+ .sourceDefinition(sinkDefinition)
+ .build();
+
+ @Test
+ void getShouldBeUsable() {
+ cut.get(request)
+ .filter(DmaapResponse::successful)
+ .map(MessageRouterSubscribeResponse::items)
+ .subscribe(System.out::println);
+ }
+
+ @Test
+ void getElementsShouldBeUsable() {
+ cut.getElements(request)
+ .collectList()
+ .subscribe(System.out::println);
+ }
+} \ No newline at end of file