Examples of Utf8


Examples of org.apache.avro.util.Utf8

  @Test
  public void testSingleRpc() throws IOException {
    Transceiver t = new LocalTransceiver(new TestResponder(protocol));
    GenericRecord params = new GenericData.Record(protocol.getMessages().get(
        "m").getRequest());
    params.put("x", new Utf8("hello"));
    GenericRequestor r = new GenericRequestor(protocol, t);
    assertEquals(new Utf8("there"), r.request("m", params));
  }
View Full Code Here

Examples of org.apache.avro.util.Utf8

    }

    @Override
    public Object respond(Message message, Object request)
        throws AvroRemoteException {
      assertEquals(new Utf8("hello"), ((GenericRecord) request).get("x"));
      return new Utf8("there");
    }
View Full Code Here

Examples of org.apache.avro.util.Utf8

    Transceiver transceiver = new NettyTransceiver(new InetSocketAddress(
        serverPort));
    Mail proxy = (Mail) SpecificRequestor.getClient(Mail.class, transceiver);

    Message msg = new Message();
    msg.to = new Utf8("wife");
    msg.from = new Utf8("husband");
    msg.body = new Utf8("I love you!");

    try {
      CharSequence result = proxy.send(msg);
      System.out.println("Result: " + result);
      Assert.assertEquals(
View Full Code Here

Examples of org.apache.avro.util.Utf8

public class TestNettyServer {

  public static class MailImpl implements Mail {
    // in this simple example just return details of the message
    public CharSequence send(Message message) {
      return new Utf8("Sent message to [" + message.to.toString() + "] from ["
          + message.from.toString() + "] with body [" + message.body.toString()
          + "]");
    }
View Full Code Here

Examples of org.apache.avro.util.Utf8

    check("\"boolean\"", Boolean.FALSE, Boolean.TRUE);
  }

  @Test
  public void testString() throws Exception {
    check("\"string\"", new Utf8(""), new Utf8("a"));
    check("\"string\"", new Utf8("a"), new Utf8("b"));
    check("\"string\"", new Utf8("a"), new Utf8("ab"));
    check("\"string\"", new Utf8("ab"), new Utf8("b"));
  }
View Full Code Here

Examples of org.apache.avro.util.Utf8

          new GenericData.Fixed(new byte[]{(byte)'b'}));
  }

  @Test
  public void testUnion() throws Exception {
    check("[\"string\", \"long\"]", new Utf8("a"), new Utf8("b"), false);
    check("[\"string\", \"long\"]", new Long(1), new Long(2), false);
    check("[\"string\", \"long\"]", new Utf8("a"), new Long(1), false);
  }
View Full Code Here

Examples of org.apache.avro.util.Utf8

  @Test
  public void testSpecificRecord() throws Exception {
    TestRecord s1 = new TestRecord();
    TestRecord s2 = new TestRecord();
    s1.name = new Utf8("foo");
    s1.kind = Kind.BAZ;
    s1.hash = new MD5();
    s1.hash.bytes(new byte[] {0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5});
    s2.name = new Utf8("bar");
    s2.kind = Kind.BAR;
    s2.hash = new MD5();
    s2.hash.bytes(new byte[] {0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,6});
    Schema schema = SpecificData.get().getSchema(TestRecord.class);
View Full Code Here

Examples of org.apache.avro.util.Utf8

    proxy = (Simple)SpecificRequestor.getClient(Simple.class, client);
  }

  @Test
  public void testHello() throws IOException {
    CharSequence response = proxy.hello(new Utf8("bob"));
    assertEquals(new Utf8("goodbye"), response);
  }
View Full Code Here

Examples of org.apache.avro.util.Utf8

  }

  @Test
  public void testEcho() throws IOException {
    TestRecord record = new TestRecord();
    record.name = new Utf8("foo");
    record.kind = Kind.BAR;
    record.hash = new MD5();
    System.arraycopy(new byte[]{0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5}, 0,
                     record.hash.bytes(), 0, 16);
    TestRecord echoed = proxy.echo(record);
View Full Code Here

Examples of org.apache.avro.util.Utf8

  @Test
  public void testOneWay() throws IOException {
    ackCount = 0;
    proxy.ack();
    proxy.hello(new Utf8("foo"));                 // intermix normal req
    proxy.ack();
    try { Thread.sleep(100); } catch (InterruptedException e) {}
    assertEquals(2, ackCount);
  }
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.