* Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Copyright (C) 2017 Amdocs
- * =============================================================================
+ * ================================================================================
+ * Modifications Copyright (C) 2018 IBM
+ * ================================================================================
* 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
/**
* @return An instance of MRConsumer created from our class variables.
*/
- private synchronized MRConsumer getClient(int waitMs, int limit) {
+ synchronized MRConsumer getClient(int waitMs, int limit) {
try {
props.setProperty("timeout", String.valueOf(waitMs));
props.setProperty("limit", String.valueOf(limit));
* ONAP : APPC
* ================================================================================
* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
- * =============================================================================
+ * ================================================================================
+ * Modifications Copyright (C) 2018 IBM
+ * ================================================================================
* 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
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
-
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import org.junit.Ignore;
import org.junit.Test;
+
public class TestDmaapConsumerImpl {
String[] hostList = { "192.168.1.1" };
Collection<String> hosts = new HashSet<String>(Arrays.asList(hostList));
@Test
public void testDmaapConsumerImplwithFilter() {
+ filter="";
DmaapConsumerImpl consumer = new DmaapConsumerImpl(hosts, topic, group, id, key, secret, filter);
assertNotNull(consumer);
assertEquals("secret", props.getProperty("password"));
}
- @Ignore
+
@Test
public void testFetch() {
- fail("Not yet implemented");
+ DmaapConsumerImpl consumer = new DmaapConsumerImpl(hosts, topic, group, id, key, secret);
+
+ assertNotNull(consumer);
+
+ consumer.fetch(5000,500);
}
@Ignore
assertEquals(true, consumer.isHttps());
}
-
+
+ @Test
+ public void testGetClient()
+ {
+ DmaapConsumerImpl consumer = new DmaapConsumerImpl(hosts, topic, group, id, key, secret);
+ assertNotNull(consumer);
+ consumer.getClient(1000,5);
+ Properties props= consumer.getProperties();
+ assertEquals("1000", props.getProperty("timeout"));
+ assertEquals("5", props.getProperty("limit"));
+ }
+
+ @Test
+ public void testInitMetric()
+ {
+ DmaapConsumerImpl consumer = new DmaapConsumerImpl(hosts, topic, group, id, key, secret);
+ assertNotNull(consumer);
+
+ }
}