Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.LongWritable


    @Test
         public void testURITriple() throws IOException, InterruptedException {
        Text t=new Text("<http://a.example.com/>\t<http://b.example.com/>\t<http://c.example.com/> .");
        Mapper.Context c=mock(Mapper.Context.class);
        mapper.map(new LongWritable(75),t,c);
        verify(c).write(new Text("<http://c.example.com/>"),new LongWritable(1));
        verifyNoMoreInteractions(c);
    }
View Full Code Here


    @Test
    public void testLiteralTriple() throws IOException, InterruptedException {
        Text t=new Text("<http://a.example.com/>\t<http://b.example.com/>\t\"even on the darkest night\"@en .");
        Mapper.Context c=mock(Mapper.Context.class);
        mapper.map(new LongWritable(75),t,c);
        verifyNoMoreInteractions(c);
    }
View Full Code Here

    @Test
    public void testExternalURITriple() throws IOException, InterruptedException {
        Text t=new Text("<http://a.example.com/>\t<http://b.example.com/>\t<http://c.example.com/> .");
        Mapper.Context c=mock(Mapper.Context.class);
        mapper.map(new LongWritable(75),t,c);
        verify(c).write(new Text("<http://a.example.com/>"),new LongWritable(1));
        verifyNoMoreInteractions(c);
    }
View Full Code Here

                    ,0
                    ,0
                    ,null
                )
        );
        m.map(new LongWritable(666),new Text("Ganbaru!"),c2);
        verify(c2).getInputSplit();
        verify(c2).write(
                new TaggedTextItem(new Text("Ganbaru!"),new VIntWritable(75)), new VIntWritable(75)
        );
        verifyNoMoreInteractions(c2);

        Mapper.Context c3=mock(Mapper.Context.class);
        stub(c3.getInputSplit()).toReturn(
                new FileSplit(
                        new Path("s3n://basekb-now/2013-11-10/sieved/description/description-m-00099.nt.gz")
                        ,0
                        ,0
                        ,null
                )
        );
        m.map(new LongWritable(667),new Text("He was some kind of recording genius"),c3);
        verify(c3).getInputSplit();
        verify(c3).write(
                new TaggedTextItem(new Text("He was some kind of recording genius"),new VIntWritable(0)), new VIntWritable(0)
        );
        verifyNoMoreInteractions(c3);

        Mapper.Context c4=mock(Mapper.Context.class);
        stub(c4.getInputSplit()).toReturn(
                new FileSplit(
                        new Path("s3n://basekb-now/2013-11-10/sieved/a/a-m-21345.nt.gz")
                        ,0
                        ,0
                        ,null
                )
        );

        m.map(new LongWritable(668),new Text("Nothing comes easy"),c4);
        verify(c4).getInputSplit();
        verify(c4).write(
                new TaggedTextItem(new Text("Nothing comes easy"),new VIntWritable(23)), new VIntWritable(23)
        );
        verifyNoMoreInteractions(c4);
View Full Code Here

    }

    @Test
    public void rejectsCompleteGarbage() throws IOException,
    InterruptedException {
        mapper.map(new LongWritable(1L),
                new Text("Furkle murkle yurkle urkle"), context);
        verify(context).getCounter(FreebasePrefilterCounter.IGNORED);
        verifyNoMoreInteractions(context);
    }
View Full Code Here

    }

    @Test
    public void ignoresPrefixDeclarations() throws IOException,
    InterruptedException {
        mapper.map(new LongWritable(1L), new Text(
                "@prefix foo: <http://bar.com/>."), context);
        verify(context).getCounter(FreebasePrefilterCounter.PREFIX_DECL);
        verifyNoMoreInteractions(context);
    }
View Full Code Here

    @Test
    public void acceptsOrdinaryTriples() throws IOException,
    InterruptedException {
        String ordinaryTriple = "ns:aviation.aircraft.first_flight\tns:type.property.unique\ttrue.";
        mapper.map(new LongWritable(1L), new Text(ordinaryTriple), context);
        verify(context).getCounter(FreebasePrefilterCounter.ACCEPTED);
        verify(context)
        .write(new Text(
                "<http://rdf.basekb.com/ns/aviation.aircraft.first_flight>"),
                new Text(
View Full Code Here

    }

    @Test
    public void rejectsMostATriples() throws IOException, InterruptedException {
        String ordinaryTriple = "ns:aviation.aircraft.first_flight\trdf:type\tns:anythingInsideFreebase.";
        mapper.map(new LongWritable(1L), new Text(ordinaryTriple), context);
        verify(context).getCounter(FreebasePrefilterCounter.IGNORED);
        verifyNoMoreInteractions(context);
    }
View Full Code Here

    @Test
    public void testExternalURITriple() throws IOException, InterruptedException {
        Text t=new Text("<http://a.example.com/>\t<http://b.example.com/>\t<http://c.example.com/> .");
        Mapper.Context c=mock(Mapper.Context.class);
        mapper.map(new LongWritable(75),t,c);
        verify(c).write(new Text("<http://b.example.com/>"),new LongWritable(1));
        verifyNoMoreInteractions(c);
    }
View Full Code Here

    @Test
    public void acceptsForeignATriples() throws IOException,
    InterruptedException {
        String ordinaryTriple = "ns:aviation.aircraft.first_flight\trdf:type\towl:Thing.";
        mapper.map(new LongWritable(1L), new Text(ordinaryTriple), context);
        verify(context).getCounter(FreebasePrefilterCounter.ACCEPTED);
        verify(context)
        .write(new Text(
                "<http://rdf.basekb.com/ns/aviation.aircraft.first_flight>"),
                new Text(
View Full Code Here

TOP

Related Classes of org.apache.hadoop.io.LongWritable

Copyright © 2018 www.massapicom. 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.