aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org
diff options
context:
space:
mode:
authorsunil.unnava <sunil.unnava@att.com>2019-04-03 16:31:03 -0400
committersunil.unnava <sunil.unnava@att.com>2019-04-03 16:31:20 -0400
commite709bb9923625f1f36cd5890d86b8cfa01d05739 (patch)
treeff97b222986c3b77f46f75013b575ece4d906311 /src/test/java/org
parente3da91b4013e3c4fea1d2a2c6f0e4a1677fb3ba4 (diff)
add testcases
Issue-ID: DMAAP-1147 Change-Id: I2e8f5fdf3aba2b3667b6bd505cd56e48798a465b Signed-off-by: sunil.unnava <sunil.unnava@att.com>
Diffstat (limited to 'src/test/java/org')
-rw-r--r--src/test/java/org/onap/dmaap/mr/client/impl/MRConsumerImplTest.java155
-rw-r--r--src/test/java/org/onap/dmaap/mr/client/impl/MRSimplerBatchPublisherTest.java291
2 files changed, 357 insertions, 89 deletions
diff --git a/src/test/java/org/onap/dmaap/mr/client/impl/MRConsumerImplTest.java b/src/test/java/org/onap/dmaap/mr/client/impl/MRConsumerImplTest.java
index 153ed29..8765845 100644
--- a/src/test/java/org/onap/dmaap/mr/client/impl/MRConsumerImplTest.java
+++ b/src/test/java/org/onap/dmaap/mr/client/impl/MRConsumerImplTest.java
@@ -21,6 +21,8 @@
*******************************************************************************/
package org.onap.dmaap.mr.client.impl;
+import java.io.File;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.util.LinkedList;
import java.util.Properties;
@@ -28,84 +30,127 @@ import java.util.Properties;
import junit.framework.TestCase;
import org.junit.Test;
-
+import org.onap.dmaap.mr.client.MRClientFactory;
import org.onap.dmaap.mr.client.impl.MRConstants;
import org.onap.dmaap.mr.client.impl.MRConsumerImpl;
+import org.onap.dmaap.mr.test.clients.ProtocolTypeConstants;
-public class MRConsumerImplTest extends TestCase
-{
+public class MRConsumerImplTest extends TestCase {
@Test
- public void testNullFilter () throws IOException
- {
- final LinkedList<String> hosts = new LinkedList<String> ();
- hosts.add ( "localhost:8080" );
- final MRConsumerImpl c = new MRConsumerImpl ( hosts, "topic", "cg", "cid", -1, -1, null, null, null );
- final String url = c.createUrlPath (MRConstants.makeConsumerUrl ( "localhost:8080", "topic", "cg", "cid","http" ), -1, -1 );
- assertEquals ("http://localhost:8080/events/" + "topic/cg/cid", url );
+ public void testNullFilter() throws IOException {
+ final LinkedList<String> hosts = new LinkedList<String>();
+ hosts.add("localhost:8080");
+ final MRConsumerImpl c = new MRConsumerImpl(hosts, "topic", "cg", "cid", -1, -1, null, null, null);
+ final String url = c.createUrlPath(MRConstants.makeConsumerUrl("localhost:8080", "topic", "cg", "cid", "http"),
+ -1, -1);
+ assertEquals("http://localhost:8080/events/" + "topic/cg/cid", url);
}
@Test
- public void testFilterWithNoTimeoutOrLimit () throws IOException
- {
- final LinkedList<String> hosts = new LinkedList<String> ();
- hosts.add ( "localhost:8080" );
- final MRConsumerImpl c = new MRConsumerImpl ( hosts, "topic", "cg", "cid", -1, -1, "filter", null, null );
- final String url = c.createUrlPath ( MRConstants.makeConsumerUrl ( "localhost:8080", "topic", "cg", "cid" ,"http"),-1, -1 );
- assertEquals ("http://localhost:8080/events/" + "topic/cg/cid?filter=filter", url );
+ public void testFilterWithNoTimeoutOrLimit() throws IOException {
+ final LinkedList<String> hosts = new LinkedList<String>();
+ hosts.add("localhost:8080");
+ final MRConsumerImpl c = new MRConsumerImpl(hosts, "topic", "cg", "cid", -1, -1, "filter", null, null);
+ final String url = c.createUrlPath(MRConstants.makeConsumerUrl("localhost:8080", "topic", "cg", "cid", "http"),
+ -1, -1);
+ assertEquals("http://localhost:8080/events/" + "topic/cg/cid?filter=filter", url);
}
@Test
- public void testTimeoutNoLimitNoFilter () throws IOException
- {
- final LinkedList<String> hosts = new LinkedList<String> ();
- hosts.add ( "localhost:8080" );
- final MRConsumerImpl c = new MRConsumerImpl ( hosts, "topic", "cg", "cid", 30000, -1, null, null, null );
- final String url = c.createUrlPath (MRConstants.makeConsumerUrl ( "localhost:8080", "topic", "cg", "cid","http" ), 30000, -1 );
- assertEquals ( "http://localhost:8080/events/" + "topic/cg/cid?timeout=30000", url );
+ public void testTimeoutNoLimitNoFilter() throws IOException {
+ final LinkedList<String> hosts = new LinkedList<String>();
+ hosts.add("localhost:8080");
+ final MRConsumerImpl c = new MRConsumerImpl(hosts, "topic", "cg", "cid", 30000, -1, null, null, null);
+ final String url = c.createUrlPath(MRConstants.makeConsumerUrl("localhost:8080", "topic", "cg", "cid", "http"),
+ 30000, -1);
+ assertEquals("http://localhost:8080/events/" + "topic/cg/cid?timeout=30000", url);
}
@Test
- public void testNoTimeoutWithLimitNoFilter () throws IOException
- {
- final LinkedList<String> hosts = new LinkedList<String> ();
- hosts.add ( "localhost:8080" );
- final MRConsumerImpl c = new MRConsumerImpl ( hosts, "topic", "cg", "cid", -1, 100, null, null, null );
- final String url = c.createUrlPath (MRConstants.makeConsumerUrl ( "localhost:8080", "topic", "cg", "cid","http" ), -1, 100 );
- assertEquals ( "http://localhost:8080/events/" + "topic/cg/cid?limit=100", url );
+ public void testNoTimeoutWithLimitNoFilter() throws IOException {
+ final LinkedList<String> hosts = new LinkedList<String>();
+ hosts.add("localhost:8080");
+ final MRConsumerImpl c = new MRConsumerImpl(hosts, "topic", "cg", "cid", -1, 100, null, null, null);
+ final String url = c.createUrlPath(MRConstants.makeConsumerUrl("localhost:8080", "topic", "cg", "cid", "http"),
+ -1, 100);
+ assertEquals("http://localhost:8080/events/" + "topic/cg/cid?limit=100", url);
}
@Test
- public void testWithTimeoutWithLimitWithFilter () throws IOException
- {
- final LinkedList<String> hosts = new LinkedList<String> ();
- hosts.add ( "localhost:8080" );
- final MRConsumerImpl c = new MRConsumerImpl ( hosts, "topic", "cg", "cid", 1000, 400, "f", null, null );
- final String url = c.createUrlPath (MRConstants.makeConsumerUrl ( "localhost:8080", "topic", "cg", "cid" ,"http"), 1000, 400 );
- assertEquals ("http://localhost:8080/events/" + "topic/cg/cid?timeout=1000&limit=400&filter=f", url );
+ public void testWithTimeoutWithLimitWithFilter() throws IOException {
+ final LinkedList<String> hosts = new LinkedList<String>();
+ hosts.add("localhost:8080");
+ final MRConsumerImpl c = new MRConsumerImpl(hosts, "topic", "cg", "cid", 1000, 400, "f", null, null);
+ final String url = c.createUrlPath(MRConstants.makeConsumerUrl("localhost:8080", "topic", "cg", "cid", "http"),
+ 1000, 400);
+ assertEquals("http://localhost:8080/events/" + "topic/cg/cid?timeout=1000&limit=400&filter=f", url);
}
@Test
- public void testFilterEncoding () throws IOException
- {
- final LinkedList<String> hosts = new LinkedList<String> ();
- hosts.add ( "localhost:8080" );
- final MRConsumerImpl c = new MRConsumerImpl ( hosts, "topic", "cg", "cid", -1, -1, "{ \"foo\"=\"bar\"bar\" }", null, null );
- final String url = c.createUrlPath (MRConstants.makeConsumerUrl ( "localhost:8080", "topic", "cg", "cid","http" ), -1, -1 );
- assertEquals ( "http://localhost:8080/events/" + "topic/cg/cid?filter=%7B+%22foo%22%3D%22bar%22bar%22+%7D", url );
+ public void testFilterEncoding() throws IOException {
+ final LinkedList<String> hosts = new LinkedList<String>();
+ hosts.add("localhost:8080");
+ final MRConsumerImpl c = new MRConsumerImpl(hosts, "topic", "cg", "cid", -1, -1, "{ \"foo\"=\"bar\"bar\" }",
+ null, null);
+ final String url = c.createUrlPath(MRConstants.makeConsumerUrl("localhost:8080", "topic", "cg", "cid", "http"),
+ -1, -1);
+ assertEquals("http://localhost:8080/events/" + "topic/cg/cid?filter=%7B+%22foo%22%3D%22bar%22bar%22+%7D", url);
}
-
+
@Test
- public void testFetchWithReturnConsumerResponse () throws IOException
- {
- final LinkedList<String> hosts = new LinkedList<String> ();
- hosts.add ( "localhost:8080" );
+ public void testFetchWithReturnConsumerResponse() throws IOException {
+ final LinkedList<String> hosts = new LinkedList<String>();
+ hosts.add("localhost:8080");
Properties properties = new Properties();
- properties.load(MRSimplerBatchConsumerTest.class.getClassLoader().getResourceAsStream("dme2/consumer.properties"));
+ properties.load(
+ MRSimplerBatchConsumerTest.class.getClassLoader().getResourceAsStream("dme2/consumer.properties"));
+
+ final MRConsumerImpl c = new MRConsumerImpl(hosts, "topic", "cg", "cid", -1, -1, "{ \"foo\"=\"bar\"bar\" }",
+ null, null);
+ assertNotNull(c.fetchWithReturnConsumerResponse());
+ c.setProtocolFlag(ProtocolTypeConstants.AAF_AUTH.getValue());
+ assertNotNull(c.fetchWithReturnConsumerResponse());
+ c.setProtocolFlag(ProtocolTypeConstants.HTTPNOAUTH.getValue());
+ assertNotNull(c.fetchWithReturnConsumerResponse());
+ c.setProtocolFlag(ProtocolTypeConstants.AUTH_KEY.getValue());
+ assertNotNull(c.fetchWithReturnConsumerResponse());
+ assertTrue(true);
+ }
+
+ @Test
+ public void testFetch() throws Exception {
+ final LinkedList<String> hosts = new LinkedList<String>();
+ hosts.add("localhost:8080");
- final MRConsumerImpl c = new MRConsumerImpl ( hosts, "topic", "cg", "cid", -1, -1, "{ \"foo\"=\"bar\"bar\" }", null, null );
- c.fetchWithReturnConsumerResponse();
- c.setProtocolFlag("HTTPAAF");
- c.fetchWithReturnConsumerResponse();
+
+ Properties properties = new Properties();
+ properties.load(
+ MRSimplerBatchPublisherTest.class.getClassLoader().getResourceAsStream("dme2/consumer.properties"));
+
+ String routeFilePath = "dme2/preferredRoute.txt";
+
+ File file = new File(MRSimplerBatchPublisherTest.class.getClassLoader().getResource(routeFilePath).getFile());
+ properties.put("routeFilePath",
+ MRSimplerBatchPublisherTest.class.getClassLoader().getResource(routeFilePath).getFile());
+
+ File outFile = new File(file.getParent() + "/consumer_tmp.properties");
+ properties.store(new FileOutputStream(outFile), "");
+
+ MRClientFactory.prop=properties;
+ final MRConsumerImpl c = new MRConsumerImpl(hosts, "topic", "cg", "cid", -1, -1, "{ \"foo\"=\"bar\"bar\" }",
+ null, null);
+ c.setProps(properties);
+ try {
+ c.fetch();
+ } catch (Exception e) {
+ assertTrue(true);
+ }
+ c.setProtocolFlag(ProtocolTypeConstants.AAF_AUTH.getValue());
+ assertNotNull(c.fetchWithReturnConsumerResponse());
+ c.setProtocolFlag(ProtocolTypeConstants.HTTPNOAUTH.getValue());
+ assertNotNull(c.fetchWithReturnConsumerResponse());
+ c.setProtocolFlag(ProtocolTypeConstants.AUTH_KEY.getValue());
+ assertNotNull(c.fetchWithReturnConsumerResponse());
assertTrue(true);
}
}
diff --git a/src/test/java/org/onap/dmaap/mr/client/impl/MRSimplerBatchPublisherTest.java b/src/test/java/org/onap/dmaap/mr/client/impl/MRSimplerBatchPublisherTest.java
index aeda891..b2f8817 100644
--- a/src/test/java/org/onap/dmaap/mr/client/impl/MRSimplerBatchPublisherTest.java
+++ b/src/test/java/org/onap/dmaap/mr/client/impl/MRSimplerBatchPublisherTest.java
@@ -22,7 +22,10 @@
package org.onap.dmaap.mr.client.impl;
+import static org.junit.Assert.assertEquals;
+
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
@@ -37,58 +40,278 @@ import org.junit.Test;
import org.onap.dmaap.mr.client.MRClientFactory;
import org.onap.dmaap.mr.client.MRPublisher.message;
import org.onap.dmaap.mr.client.response.MRPublisherResponse;
+import org.onap.dmaap.mr.test.clients.ProtocolTypeConstants;
public class MRSimplerBatchPublisherTest {
-
+
File outFile;
- @Before
- public void setUp() throws Exception {
+
+ public void setUp(String contentType) throws Exception {
Properties properties = new Properties();
- properties.load(MRSimplerBatchPublisherTest.class.getClassLoader().getResourceAsStream("dme2/producer.properties"));
-
- String routeFilePath="dme2/preferredRoute.txt";
-
+ properties.load(
+ MRSimplerBatchPublisherTest.class.getClassLoader().getResourceAsStream("dme2/producer.properties"));
+
+ String routeFilePath = "dme2/preferredRoute.txt";
+
File file = new File(MRSimplerBatchPublisherTest.class.getClassLoader().getResource(routeFilePath).getFile());
- properties.put("DME2preferredRouterFilePath", MRSimplerBatchPublisherTest.class.getClassLoader().getResource(routeFilePath).getFile());
-
+ properties.put("DME2preferredRouterFilePath",
+ MRSimplerBatchPublisherTest.class.getClassLoader().getResource(routeFilePath).getFile());
+ if (contentType != null) {
+ properties.put("contenttype", contentType);
+ }
outFile = new File(file.getParent() + "/producer_tmp.properties");
properties.store(new FileOutputStream(outFile), "");
}
@Test
- public void testSend() throws IOException, InterruptedException {
-
- final MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher)MRClientFactory.createBatchingPublisher(outFile.getPath());
-
- //publish some messages
- final JSONObject msg1 = new JSONObject ();
- pub.send ( "MyPartitionKey", msg1.toString () );
+ public void testSend() throws Exception {
+
+ setUp(null);
+
+ final MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher) MRClientFactory
+ .createBatchingPublisher(outFile.getPath());
+
+ // publish some messages
+ final JSONObject msg1 = new JSONObject();
+ pub.send("MyPartitionKey", msg1.toString());
+
+ final List<message> stuck = pub.close(1, TimeUnit.SECONDS);
+ Assert.assertEquals(1, stuck.size());
- final List<message> stuck = pub.close ( 1, TimeUnit.SECONDS );
- if ( stuck.size () > 0 ) {
- System.out.println( stuck.size() + " messages unsent" );
- }
- else
- {
- System.out.println ( "Clean exit; all messages sent." );
- }
-
-
}
@Test
- public void testSendBatchWithResponse() throws IOException, InterruptedException {
-
- final MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher)MRClientFactory.createBatchingPublisher(outFile.getPath(), true);
-
- //publish some messages
- final JSONObject msg1 = new JSONObject ();
- pub.send ( "MyPartitionKey", msg1.toString () );
+ public void testSendBatchWithResponse() throws Exception {
+
+ setUp(null);
+
+ final MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher) MRClientFactory
+ .createBatchingPublisher(outFile.getPath(), true);
+
+ // publish some messages
+ final JSONObject msg1 = new JSONObject();
+ pub.send("MyPartitionKey", msg1.toString());
MRPublisherResponse pubResponse = new MRPublisherResponse();
pub.setPubResponse(pubResponse);
-
+
MRPublisherResponse mrPublisherResponse = pub.sendBatchWithResponse();
Assert.assertEquals(1, mrPublisherResponse.getPendingMsgs());
+
+ }
+
+ @Test
+ public void testSendBatchWithResponseConText() throws Exception {
+
+ setUp("text/plain");
+
+ final MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher) MRClientFactory
+ .createBatchingPublisher(outFile.getPath());
+
+ // publish some messages
+ final JSONObject msg1 = new JSONObject();
+ pub.send("MyPartitionKey", msg1.toString());
+
+ final List<message> stuck = pub.close(1, TimeUnit.SECONDS);
+ Assert.assertEquals(1, stuck.size());
+
+ }
+
+ @Test
+ public void testSendBatchWithResponseContCambria() throws Exception {
+
+ setUp("application/cambria-zip");
+
+ final MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher) MRClientFactory
+ .createBatchingPublisher(outFile.getPath());
+
+ // publish some messages
+ final JSONObject msg1 = new JSONObject();
+ pub.send("MyPartitionKey", msg1.toString());
+
+ final List<message> stuck = pub.close(1, TimeUnit.SECONDS);
+ Assert.assertEquals(1, stuck.size());
+
+ }
+
+ @Test
+ public void testSendBatchWithResponseProtKey() throws Exception {
+
+ setUp(null);
+
+ final MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher) MRClientFactory
+ .createBatchingPublisher(outFile.getPath());
+ pub.setProtocolFlag(ProtocolTypeConstants.AUTH_KEY.getValue());
+ // publish some messages
+ final JSONObject msg1 = new JSONObject();
+ pub.send("MyPartitionKey", msg1.toString());
+
+ final List<message> stuck = pub.close(1, TimeUnit.SECONDS);
+ Assert.assertEquals(1, stuck.size());
+
+ }
+
+ @Test
+ public void testSendBatchWithResponseProtAaf() throws Exception {
+
+ setUp(null);
+
+ final MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher) MRClientFactory
+ .createBatchingPublisher(outFile.getPath());
+ pub.setProtocolFlag(ProtocolTypeConstants.AAF_AUTH.getValue());
+ // publish some messages
+ final JSONObject msg1 = new JSONObject();
+ pub.send("MyPartitionKey", msg1.toString());
+
+ final List<message> stuck = pub.close(1, TimeUnit.SECONDS);
+ Assert.assertEquals(1, stuck.size());
+
+ }
+
+ @Test
+ public void testSendBatchWithResponseProtNoAuth() throws Exception {
+
+ setUp(null);
+
+ final MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher) MRClientFactory
+ .createBatchingPublisher(outFile.getPath());
+ pub.setProtocolFlag(ProtocolTypeConstants.HTTPNOAUTH.getValue());
+ // publish some messages
+ final JSONObject msg1 = new JSONObject();
+ pub.send("MyPartitionKey", msg1.toString());
+
+ final List<message> stuck = pub.close(1, TimeUnit.SECONDS);
+ Assert.assertEquals(1, stuck.size());
+
+ }
+
+ @Test
+ public void testSendBatchWithResponsecontypeText() throws Exception {
+
+ setUp("text/plain");
+
+ final MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher) MRClientFactory
+ .createBatchingPublisher(outFile.getPath(), true);
+
+ // publish some messages
+ final JSONObject msg1 = new JSONObject();
+ pub.send("MyPartitionKey", "payload");
+ MRPublisherResponse pubResponse = new MRPublisherResponse();
+ pub.setPubResponse(pubResponse);
+
+ MRPublisherResponse mrPublisherResponse = pub.sendBatchWithResponse();
+ Assert.assertEquals(1, mrPublisherResponse.getPendingMsgs());
+
+ }
+
+ @Test
+ public void testSendBatchWithResponsecontypeCambria() throws Exception {
+
+ setUp("application/cambria-zip");
+
+ final MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher) MRClientFactory
+ .createBatchingPublisher(outFile.getPath(), true);
+
+ // publish some messages
+ final JSONObject msg1 = new JSONObject();
+ pub.send("MyPartitionKey", "payload");
+ MRPublisherResponse pubResponse = new MRPublisherResponse();
+ pub.setPubResponse(pubResponse);
+
+ MRPublisherResponse mrPublisherResponse = pub.sendBatchWithResponse();
+ Assert.assertEquals(1, mrPublisherResponse.getPendingMsgs());
+
+ }
+
+ @Test
+ public void testSendBatchWithResponsePrAuthKey() throws Exception {
+
+ setUp(null);
+
+ final MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher) MRClientFactory
+ .createBatchingPublisher(outFile.getPath(), true);
+ pub.setProtocolFlag(ProtocolTypeConstants.AUTH_KEY.getValue());
+
+ // publish some messages
+ final JSONObject msg1 = new JSONObject();
+ pub.send("MyPartitionKey", msg1.toString());
+ MRPublisherResponse pubResponse = new MRPublisherResponse();
+ pub.setPubResponse(pubResponse);
+
+ MRPublisherResponse mrPublisherResponse = pub.sendBatchWithResponse();
+ Assert.assertEquals(1, mrPublisherResponse.getPendingMsgs());
+
+ }
+
+ @Test
+ public void testSendBatchWithResponsePrAaf() throws Exception {
+
+ setUp(null);
+
+ final MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher) MRClientFactory
+ .createBatchingPublisher(outFile.getPath(), true);
+ pub.setProtocolFlag(ProtocolTypeConstants.AAF_AUTH.getValue());
+
+ // publish some messages
+ final JSONObject msg1 = new JSONObject();
+ pub.send("MyPartitionKey", msg1.toString());
+ MRPublisherResponse pubResponse = new MRPublisherResponse();
+ pub.setPubResponse(pubResponse);
+
+ MRPublisherResponse mrPublisherResponse = pub.sendBatchWithResponse();
+ Assert.assertEquals(1, mrPublisherResponse.getPendingMsgs());
+
+ }
+
+ @Test
+ public void testSendBatchWithResponsePrNoauth() throws Exception {
+
+ setUp(null);
+
+ final MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher) MRClientFactory
+ .createBatchingPublisher(outFile.getPath(), true);
+ pub.setProtocolFlag(ProtocolTypeConstants.HTTPNOAUTH.getValue());
+
+ // publish some messages
+ final JSONObject msg1 = new JSONObject();
+ pub.send("MyPartitionKey", msg1.toString());
+ MRPublisherResponse pubResponse = new MRPublisherResponse();
+ pub.setPubResponse(pubResponse);
+
+ MRPublisherResponse mrPublisherResponse = pub.sendBatchWithResponse();
+ Assert.assertEquals(1, mrPublisherResponse.getPendingMsgs());
+
+ }
+
+ @Test
+ public void createPublisherResponse() throws Exception{
+ setUp(null);
+ MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher) MRClientFactory
+ .createBatchingPublisher(outFile.getPath(), true);
+
+ MRPublisherResponse response=pub.createMRPublisherResponse("{\"message\": \"published the message\", \"status\": \"200\"}", new MRPublisherResponse());
+ assertEquals("200", response.getResponseCode());
+
+ }
+
+ @Test
+ public void createPublisherResponseSucc() throws Exception{
+ setUp(null);
+ MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher) MRClientFactory
+ .createBatchingPublisher(outFile.getPath(), true);
+
+ MRPublisherResponse response=pub.createMRPublisherResponse("{\"fakemessage\": \"published the message\", \"fakestatus\": \"200\"}", new MRPublisherResponse());
+ assertEquals("200", response.getResponseCode());
+
+ }
+
+ @Test
+ public void createPublisherResponseError() throws Exception{
+ setUp(null);
+ MRSimplerBatchPublisher pub = (MRSimplerBatchPublisher) MRClientFactory
+ .createBatchingPublisher(outFile.getPath(), true);
+
+ MRPublisherResponse response=pub.createMRPublisherResponse("", new MRPublisherResponse());
+ assertEquals("400", response.getResponseCode());
}