Package com.mapr

Examples of com.mapr.TailSpout.nextTuple()


        // add some files
        FileUtils.writeByteArrayToFile(new File(tempDir, "x-1"), payload("x-1"), true);
        FileUtils.writeByteArrayToFile(new File(tempDir, "x-2"), payload("x-2"), true);

        // verify we read both files in order
        spout.nextTuple();
        List<Object> tuple1 = collector.getTuple();
        assertEquals("x-1", new String((byte[]) tuple1.get(0), Charsets.UTF_8));

        spout.nextTuple();
        List<Object> tuple2 = collector.getTuple();
View Full Code Here


        // verify we read both files in order
        spout.nextTuple();
        List<Object> tuple1 = collector.getTuple();
        assertEquals("x-1", new String((byte[]) tuple1.get(0), Charsets.UTF_8));

        spout.nextTuple();
        List<Object> tuple2 = collector.getTuple();
        Object msgId2 = collector.getMessageId();
        assertEquals("x-2", new String((byte[]) tuple2.get(0), Charsets.UTF_8));

        // verify that we get empty records for a bit
View Full Code Here

        assertEquals("x-2", new String((byte[]) tuple2.get(0), Charsets.UTF_8));

        // verify that we get empty records for a bit
        // the fact that we get tuple2 values is because no 'emit' hits
        // collector, so values are unchanged.
        spout.nextTuple();
        List<Object> tuple3 = collector.getTuple();
        assertEquals("x-2", new String((byte[]) tuple3.get(0), Charsets.UTF_8));
        assertEquals(msgId2, collector.getMessageId());

        // delete an old file without a problem
View Full Code Here

        assertEquals(msgId2, collector.getMessageId());

        // delete an old file without a problem
        assertTrue(new File(tempDir, "x-1").delete());

        spout.nextTuple();
        List<Object> tuple4 = collector.getTuple();
        assertEquals("x-2", new String((byte[]) tuple4.get(0), Charsets.UTF_8));
        assertEquals(msgId2, collector.getMessageId());

        // add a file that doesn't match the pattern without impact
View Full Code Here

        assertEquals(msgId2, collector.getMessageId());

        // add a file that doesn't match the pattern without impact
        FileUtils.writeByteArrayToFile(new File(tempDir, "y-1"),
            payload("y-1"), true);
        spout.nextTuple();
        List<Object> tuple5 = collector.getTuple();
        assertEquals("x-2", new String((byte[]) tuple5.get(0), Charsets.UTF_8));
        assertEquals(msgId2, collector.getMessageId());

       
View Full Code Here

        assertEquals(msgId2, collector.getMessageId());

       
        // append content to an existing file
        FileUtils.writeByteArrayToFile(new File(tempDir, "x-1"), payload("x-11"), true);
        spout.nextTuple();
        List<Object> tuple11 = collector.getTuple();
        assertEquals("x-11", new String((byte[]) tuple11.get(0), Charsets.UTF_8));

    }
   
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.