1 /*******************************************************************************
2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Modifications Copyright © 2021 Orange.
8 * ================================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 *******************************************************************************/
25 package org.onap.dmaap.mr.client.impl;
27 import com.att.nsa.apiClient.http.HttpException;
28 import com.att.nsa.apiClient.http.HttpObjectNotFoundException;
29 import org.junit.Test;
30 import org.onap.dmaap.mr.client.MRTopicManager.TopicInfo;
32 import java.io.IOException;
33 import java.util.Collection;
34 import java.util.LinkedList;
37 import static org.junit.Assert.assertNotNull;
38 import static org.junit.Assert.assertTrue;
41 public class MRMetaClientTest {
44 public void getTopicsTest() {
45 final Collection<String> hosts = new LinkedList<String>();
46 hosts.add("localhost:" + 3904);
50 c = new MRMetaClient(hosts);
51 Set<String> setString = c.getTopics();
52 } catch (IOException e) {
58 //assertEquals ("http://localhost:8080/events/" + "topic/cg/cid", url );
63 public void getTopicMetadataTest() {
64 final Collection<String> hosts = new LinkedList<String>();
65 hosts.add("localhost:" + 3904);
67 final String topic = "topic1";
71 c = new MRMetaClient(hosts);
72 TopicInfo topicInfo = c.getTopicMetadata(topic);
73 } catch (IOException | HttpObjectNotFoundException e) {
81 public void testcreateTopic() {
82 final Collection<String> hosts = new LinkedList<String>();
83 hosts.add("localhost:" + 3904);
87 c = new MRMetaClient(hosts);
88 c.createTopic("topic1", "testTopic", 1, 1);
89 } catch (IOException | HttpException e) {
96 public void testupdateApiKey() {
97 final Collection<String> hosts = new LinkedList<String>();
98 hosts.add("localhost:" + 3904);
102 c = new MRMetaClient(hosts);
103 c.updateCurrentApiKey("test@onap.com", "test email");
104 } catch (HttpException e) {
106 } catch (IOException e) {
107 // TODO Auto-generated catch block
109 } catch (NullPointerException e) {