Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.LongWritable


  public void testStandAloneClient() throws Exception {
    testParallel(10, false, 2, 4, 2, 4, 100);
    Client client = new Client(LongWritable.class, conf);
    InetSocketAddress address = new InetSocketAddress("127.0.0.1", 10);
    try {
      client.call(new LongWritable(RANDOM.nextLong()),
              address, null, null, conf);
      fail("Expected an exception to have been thrown");
    } catch (IOException e) {
      String message = e.getMessage();
      String addressText = address.toString();
View Full Code Here


    doThrow(new IOException("Injected fault")).when(mockFactory).createSocket();
    Client client = new Client(LongWritable.class, conf, mockFactory);
   
    InetSocketAddress address = new InetSocketAddress("127.0.0.1", 10);
    try {
      client.call(new LongWritable(RANDOM.nextLong()),
              address, null, null);
      fail("Expected an exception to have been thrown");
    } catch (IOException e) {
      assertTrue(e.getMessage().contains("Injected fault"));
    }
View Full Code Here

      SequenceFile.Writer writer = null;
      try {
        writer = SequenceFile.createWriter(fs, fsConfig, controlFile,
                                           Text.class, LongWritable.class,
                                           CompressionType.NONE);
        writer.append(new Text(name), new LongWritable(fileSize));
      } catch(Exception e) {
        throw new IOException(e.getLocalizedMessage());
      } finally {
      if (writer != null)
          writer.close();
View Full Code Here

    }

    public void run() {
      for (int i = 0; i < count; i++) {
        try {
          LongWritable param = new LongWritable(RANDOM.nextLong());
          LongWritable value =
            (LongWritable)client.call(param, server, null, null, conf);
          if (!param.equals(value)) {
            LOG.fatal("Call failed!");
            failed = true;
            break;
View Full Code Here

    public void run() {
      for (int i = 0; i < count; i++) {
        try {
          Writable[] params = new Writable[addresses.length];
          for (int j = 0; j < addresses.length; j++)
            params[j] = new LongWritable(RANDOM.nextLong());
          Writable[] values = client.call(params, addresses, null, null, conf);
          for (int j = 0; j < addresses.length; j++) {
            if (!params[j].equals(values[j])) {
              LOG.fatal("Call failed!");
              failed = true;
View Full Code Here

    }

    @Test
    public void rejectsOther() throws IOException, InterruptedException {
        mapper.map(
                new LongWritable(999),
                new Text("<http://a.b.c/>\t<http://rdf.basekb.com/ns/type.object.key>\t\"/wikipedia/en_id/136701\"\t."),
                context
        );
        verifyNoMoreInteractions(context);
    }
View Full Code Here

    }

    @Test
    public void tsukiNiKawatteOshiyokiyo() throws IOException, InterruptedException {
        mapper.map(
                new LongWritable(999),
                new Text("<http://a.b.c/>\t<http://rdf.basekb.com/ns/type.object.key>\t\"/wikipedia/en/Sailor_Moon\"\t."),
                context
        );
        verify(context).write(
            new Text("<http://dbpedia.org/resource/Sailor_Moon>"),
View Full Code Here

    @Test
    public void tryItOut() throws IOException, InterruptedException {
        Iterable<Writable> recyclingIterable=new RecyclingIterable(
                LongWritable.class,
                new LongWritable(1)
        );

        reducer.reduce(new Text("New York"),recyclingIterable,context);
        reducer.reduce(new Text("New Jersey"),recyclingIterable,context);
        reducer.reduce(new Text("New Mexico"),recyclingIterable,context);
View Full Code Here


    @Test
    public void acceptsAGoodTriple() throws IOException, InterruptedException {
        pse3mapper.map(
                new LongWritable(944L),
                new Text("<http://example.com/A>\t<http://example.com/B>\t<http://example.com/C>."),
                mockContext);

        verify(pse3mapper.accepted).write(
                new WritableTriple(
View Full Code Here

    }

    @Test
    public void acceptsARealFreebaseTriple() throws IOException,InterruptedException {
        pse3mapper.map(
                new LongWritable(944L),
                new Text("<http://rdf.basekb.com/ns/m.06fm3lj>\t<http://rdf.basekb.com/ns/book.written_work.author>\t<http://rdf.basekb.com/ns/m.03qp7yf>."),
                mockContext);

        verify(pse3mapper.accepted).write(
                new WritableTriple(
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.