Package org.discoproject.worker.protocol.encoder

Examples of org.discoproject.worker.protocol.encoder.WorkerAnnounceEncoder


    assertEquals("TASK 2 \"\"\n", encodedString);
  }

  @Test
  public void testWorkerAnnounceEncoder() {
    final WorkerAnnounceEncoder encoder = new WorkerAnnounceEncoder();
    encoder.set("version", 12345);
    final String encodedString = encoder.toString();
    assertEquals("WORKER 33 {\"pid\":12345,\"version\":\"version\"}\n", encodedString);
  }
View Full Code Here


  public DiscoWorker(final ReadableByteChannel readChannel, final WritableByteChannel writeChannel) {
    this.discoIOChannel = new DiscoIOChannel(readChannel, writeChannel, new DiscoWorkerDecoder().setListener(this));
    this.map = null;
    this.reduce = null;

    this.workerAnnounceEncoder = new WorkerAnnounceEncoder();
    this.requestTaskEncoder = new RequestTaskEncoder();
    this.outputEncoder = new OutputEncoder();
    this.doneEncoder = new DoneEncoder();
    this.errorEncoder = new ErrorEncoder();
    this.fatalEncoder = new FatalEncoder();
View Full Code Here

public class DiscoTest {

  @Test
  public void testWorkerAnnounceEncode() {
    final String expected = "WORKER 29 {\"pid\":25094,\"version\":\"1.0\"}\n";
    assertEquals(expected, new WorkerAnnounceEncoder().set("1.0", 25094).toString());
  }
View Full Code Here

    final DiscoIOChannel ioChannel = new DiscoIOChannel(pipeFromDisco.source(), new NullByteChannel(),
            new DiscoWorkerDecoder().setListener(listener));

    final String okStr = "OK 4 \"ok\"\n";
    pipeFromDisco.sink().write(ByteBuffer.wrap(okStr.getBytes()));
    ioChannel.write(new WorkerAnnounceEncoder().set("1.0", 555));

    inOrder.verify(listener).ok();
  }
View Full Code Here

TOP

Related Classes of org.discoproject.worker.protocol.encoder.WorkerAnnounceEncoder

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.