--- /dev/null
+/*******************************************************************************\r
+ * ============LICENSE_START=======================================================\r
+ * org.onap.dmaap\r
+ * ================================================================================\r
+ * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ *\r
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
+ * \r
+ *******************************************************************************/\r
+\r
+package com.att.nsa.mr.client.impl;\r
+\r
+import java.io.File;\r
+import java.io.FileOutputStream;\r
+import java.io.IOException;\r
+import java.util.List;\r
+import java.util.Properties;\r
+import java.util.concurrent.TimeUnit;\r
+\r
+import org.json.JSONObject;\r
+import org.junit.After;\r
+import org.junit.Assert;\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+import com.att.nsa.mr.client.MRClientFactory;\r
+import com.att.nsa.mr.client.MRConsumer;\r
+import com.att.nsa.mr.client.MRPublisher.message;\r
+import com.att.nsa.mr.client.response.MRPublisherResponse;\r
+\r
+public class MRSimplerBatchConsumerTest {\r
+ \r
+ File outFile;\r
+ @Before\r
+ public void setUp() throws Exception {\r
+ Properties properties = new Properties();\r
+ properties.load(MRSimplerBatchConsumerTest.class.getClassLoader().getResourceAsStream("dme2/consumer.properties"));\r
+ \r
+ String routeFilePath="dme2/preferredRoute.txt";\r
+ \r
+ File file = new File(MRSimplerBatchConsumerTest.class.getClassLoader().getResource(routeFilePath).getFile());\r
+ properties.put("DME2preferredRouterFilePath", MRSimplerBatchConsumerTest.class.getClassLoader().getResource(routeFilePath).getFile());\r
+ \r
+ outFile = new File(file.getParent() + "/consumer_tmp.properties");\r
+ properties.store(new FileOutputStream(outFile), "");\r
+ }\r
+\r
+ @Test\r
+ public void testSend() throws IOException, InterruptedException {\r
+ \r
+ final MRConsumer cc = MRClientFactory.createConsumer(outFile.getPath()); \r
+ \r
+ try {\r
+ for(String msg : cc.fetch()){\r
+ System.out.println(msg);\r
+ }\r
+ } catch (Exception e) {\r
+ System.err.println ( e.getClass().getName () + ": " + e.getMessage () );\r
+ } \r
+ \r
+ }\r
+\r
+}\r