2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
22 package org.onap.dmaap.mr.cambria.metrics.publisher.impl;
24 import static org.junit.Assert.*;
26 import java.io.IOException;
27 import java.util.ArrayList;
28 import java.util.Collection;
29 import java.util.List;
31 import org.junit.After;
32 import org.junit.Before;
33 import org.junit.Test;
35 import org.onap.dmaap.dmf.mr.metrics.publisher.impl.DMaaPCambriaConsumerImpl;
37 public class DMaaPCambriaConsumerImplTest {
39 private DMaaPCambriaConsumerImpl consumer = null;
41 public void setUp() throws Exception {
43 Collection<String> hosts = new ArrayList<String>();
45 for (int i = 0; i < 5; i++) {
46 hosts.add("host"+(i+1));
48 consumer = new DMaaPCambriaConsumerImpl(hosts, "testTopic", "consumerGroup1", "1", 2000, 200, "hi",
49 "9AMFFNIZpusO54oG","6BY86UQcio2LJdgyU7Cwg5oQ");
53 public void tearDown() throws Exception {
57 public void testStringToList() {
59 List<String> response = DMaaPCambriaConsumerImpl.stringToList("Hello world, this is a test string");
60 assertNotNull(response);
66 public void testFetch() {
68 Iterable<String> response = null;
71 response = consumer.fetch(200, 20);
72 } catch (IOException e) {
74 // TODO Auto-generated catch block
78 assertNotNull(response);
87 public void testCreateUrlPath() {
89 String response = consumer.createUrlPath(200, 20);
90 assertNotNull(response);