From 94cc24aa5088c9c1ad40959d783745a39b89dcd8 Mon Sep 17 00:00:00 2001 From: subhash kumar singh Date: Tue, 20 Mar 2018 06:09:34 +0000 Subject: Add test case for DmaapPublisher Add test case for DmaapPublisher. Change-Id: Ia69b174eb429a1b9e69a250eb1110334a97785aa Issue-ID: SO-369 Signed-off-by: subhash kumar singh --- .../mso/client/dmaap/DmaapPublisherTest.java | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 common/src/test/java/org/openecomp/mso/client/dmaap/DmaapPublisherTest.java (limited to 'common/src/test/java/org/openecomp/mso') diff --git a/common/src/test/java/org/openecomp/mso/client/dmaap/DmaapPublisherTest.java b/common/src/test/java/org/openecomp/mso/client/dmaap/DmaapPublisherTest.java new file mode 100644 index 0000000000..a9bf81d2ad --- /dev/null +++ b/common/src/test/java/org/openecomp/mso/client/dmaap/DmaapPublisherTest.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Intellectual Property. 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.openecomp.mso.client.dmaap; + +import org.junit.Test; + +import javax.ws.rs.ProcessingException; +import java.io.IOException; +import java.util.Optional; + +public class DmaapPublisherTest { + + DmaapPublisher dmaapPublisher = new DmaapPublisher(120) { + @Override + public String getUserName() { + return "test"; + } + + @Override + public String getPassword() { + return "test"; + } + + @Override + public String getTopic() { + return "test"; + } + + @Override + public Optional getHost() { + return Optional.of("http://localhost:8080"); + } + }; + + public DmaapPublisherTest() throws IOException { + } + + @Test(expected = ProcessingException.class) + public void sendTest() throws Exception { + dmaapPublisher.send("{'key': 'value'}"); + } + +} \ No newline at end of file -- cgit 1.2.3-korg