diff options
author | Keguang He <hekeguang@chinamobile.com> | 2023-04-11 09:44:24 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2023-04-11 09:44:24 +0000 |
commit | 2782fb96825e56d01e1b6b4f426fae8e1e8815fb (patch) | |
tree | 0f7e6cd8d952b3ef68fe0597cf8c80bd37a35ca9 /intentanalysis/src/test/java/org | |
parent | a893668c5c913ccb6cc3189fdce3331f866cd700 (diff) | |
parent | d126dba33d4033e9f5af5e00d3830d2e05474b26 (diff) |
Merge "Fix some issues and Add UT"
Diffstat (limited to 'intentanalysis/src/test/java/org')
-rw-r--r-- | intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/util/DmaapUtilTest.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/util/DmaapUtilTest.java b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/util/DmaapUtilTest.java new file mode 100644 index 0000000..be2a020 --- /dev/null +++ b/intentanalysis/src/test/java/org/onap/usecaseui/intentanalysis/util/DmaapUtilTest.java @@ -0,0 +1,56 @@ +package org.onap.usecaseui.intentanalysis.util; + +import java.io.IOException; +import org.apache.http.util.Asserts; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.MessageRouterPublisher; +import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.MessageRouterSubscriber; +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.usecaseui.intentanalysis.IntentAnalysisApplicationTests; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@SpringBootTest(classes = IntentAnalysisApplicationTests.class) +@RunWith(SpringRunner.class) +public class DmaapUtilTest { + + private static final String testMRURl = "http://mrhost:30607/events/unauthenticated.CCVPN_CL_DCAE_EVENT"; + + private static final String testConsumerGroup = "testGroup"; + + private static final String testConsumerId = "testUd"; + + private static final String testSubscriberName = "testName"; + + private static final String testPublisherName = "testName"; + + private static final String testTopicUrl = "http://mrhost:30607/topics/create"; + + @Test + public void testBuildSubscriberSuccess() { + MessageRouterSubscriber subscriber = DmaapUtil.buildSubscriber(); + Assert.assertNotNull(subscriber); + } + + @Test + public void testBuildSubscriberRequestSuccess() { + MessageRouterSubscribeRequest request = DmaapUtil.buildSubscriberRequest(testSubscriberName, testMRURl, + testConsumerGroup, testConsumerId); + Assert.assertNotNull(request); + } + + @Test + public void testBuildPublisherSuccess(){ + MessageRouterPublisher publisher = DmaapUtil.buildPublisher(); + Assert.assertNotNull(publisher); + } + + @Test + public void testBuildPublisherRequestSuccess(){ + MessageRouterPublishRequest publishRequest = DmaapUtil.buildPublisherRequest(testPublisherName,testTopicUrl); + Assert.assertNotNull(publishRequest); + } +} |