Examples of OKAvroHandler


Examples of org.apache.flume.api.RpcTestUtils.OKAvroHandler

   */
  @Test(expected=EventDeliveryException.class)
  public void testServerDisconnect() throws FlumeException,
      EventDeliveryException, InterruptedException {
    NettyAvroRpcClient client = null;
    Server server = RpcTestUtils.startServer(new OKAvroHandler());
    try {
      client = RpcTestUtils.getStockLocalClient(server.getPort());
      server.close();
      Thread.sleep(1000L); // wait a second for the close to occur
      try {
View Full Code Here

Examples of org.apache.flume.api.RpcTestUtils.OKAvroHandler

   */
  @Test(expected=EventDeliveryException.class)
  public void testClientClosedRequest() throws FlumeException,
      EventDeliveryException {
    NettyAvroRpcClient client = null;
    Server server = RpcTestUtils.startServer(new OKAvroHandler());
    try {
      client = RpcTestUtils.getStockLocalClient(server.getPort());
      client.close();
      Assert.assertFalse("Client should not be active", client.isActive());
      System.out.println("Yaya! I am not active after client close!");
View Full Code Here

Examples of org.apache.flume.api.RpcTestUtils.OKAvroHandler

  @Test
  public void testFailover()
      throws FlumeException, EventDeliveryException,InterruptedException {
    FailoverRpcClient client = null;
    Server server1 = RpcTestUtils.startServer(new OKAvroHandler());
    Server server2 = RpcTestUtils.startServer(new OKAvroHandler());
    Server server3 = RpcTestUtils.startServer(new OKAvroHandler());
    Properties props = new Properties();
    int s1Port = server1.getPort();
    int s2Port = server2.getPort();
    int s3Port = server3.getPort();
    props.put("client.type", "default_failover");
    props.put("hosts", "host1 host2 host3");
    props.put("hosts.host1", "127.0.0.1:" + String.valueOf(s1Port));
    props.put("hosts.host2", "127.0.0.1:" + String.valueOf(s2Port));
    props.put("hosts.host3", "127.0.0.1:" + String.valueOf(s3Port));
    client = (FailoverRpcClient) RpcClientFactory.getInstance(props);
    List<Event> events = new ArrayList<Event>();
    for (int i = 0; i < 50; i++) {
      events.add(EventBuilder.withBody("evt: " + i, Charset.forName("UTF8")));
    }
    client.appendBatch(events);
    Assert.assertEquals(client.getLastConnectedServerAddress(),
        new InetSocketAddress("127.0.0.1", server1.getPort()));
    server1.close();
    Thread.sleep(1000L); // wait a second for the close to occur
    events = new ArrayList<Event>();
    for (int i = 0; i < 50; i++) {
      events.add(EventBuilder.withBody("evt: " + i, Charset.forName("UTF8")));
    }
    client.appendBatch(events);
    Assert.assertEquals(new InetSocketAddress("localhost", server2.getPort()),
        client.getLastConnectedServerAddress());
    server2.close();
    Thread.sleep(1000L); // wait a second for the close to occur
    client.append(EventBuilder.withBody("Had a sandwich?",
        Charset.forName("UTF8")));
    Assert.assertEquals(new InetSocketAddress("localhost", server3.getPort()),
        client.getLastConnectedServerAddress());
    // Bring server 2 back.
    Server server4 = RpcTestUtils.startServer(new OKAvroHandler(), s2Port);
    server3.close();
    Thread.sleep(1000L); // wait a second for the close to occur
    events = new ArrayList<Event>();
    for (int i = 0; i < 50; i++) {
      events.add(EventBuilder.withBody("evt: " + i, Charset.forName("UTF8")));
    }
    client.appendBatch(events);
    Assert.assertEquals(new InetSocketAddress("localhost", s2Port),
        client.getLastConnectedServerAddress());

    Server server5 = RpcTestUtils.startServer(new OKAvroHandler(), s1Port);
    // Make sure we are still talking to server 4

    client
    .append(EventBuilder.withBody("Had a mango?", Charset.forName("UTF8")));
    Assert.assertEquals(new InetSocketAddress("localhost", s2Port),
        client.getLastConnectedServerAddress());
    server4.close();
    Thread.sleep(1000L); // wait a second for the close to occur
    events = new ArrayList<Event>();
    for (int i = 0; i < 50; i++) {
      events.add(EventBuilder.withBody("evt: " + i, Charset.forName("UTF8")));
    }
    client.appendBatch(events);
    Assert.assertEquals(new InetSocketAddress("localhost", s1Port),
        client.getLastConnectedServerAddress());
    server5.close();
    Thread.sleep(1000L); // wait a second for the close to occur
    Server server6 = RpcTestUtils.startServer(new OKAvroHandler(), s1Port);
    client
    .append(EventBuilder.withBody("Had a whole watermelon?",
        Charset.forName("UTF8")));
    Assert.assertEquals(new InetSocketAddress("localhost", s1Port),
        client.getLastConnectedServerAddress());

    server6.close();
    Thread.sleep(1000L); // wait a second for the close to occur
    Server server7 = RpcTestUtils.startServer(new OKAvroHandler(), s3Port);
    events = new ArrayList<Event>();
    for (int i = 0; i < 50; i++) {
      events.add(EventBuilder.withBody("evt: " + i, Charset.forName("UTF8")));
    }
    client.appendBatch(events);
View Full Code Here

Examples of org.apache.flume.api.RpcTestUtils.OKAvroHandler

   */
  @Test(
      expected = EventDeliveryException.class)
  public void testFailedServers() throws FlumeException, EventDeliveryException {
    FailoverRpcClient client = null;
    Server server1 = RpcTestUtils.startServer(new OKAvroHandler());
    Server server2 = RpcTestUtils.startServer(new OKAvroHandler());
    Server server3 = RpcTestUtils.startServer(new OKAvroHandler());
    Properties props = new Properties();
    props.put("client.type", "default_failover");

    props.put("hosts", "host1 host2 host3");
    props.put("hosts.host1", "localhost:" + String.valueOf(server1.getPort()));
View Full Code Here

Examples of org.apache.flume.api.RpcTestUtils.OKAvroHandler

  @Test
  public void testTwoParamSimpleAppend() throws FlumeException,
      EventDeliveryException {
    RpcClient client = null;
    Server server = RpcTestUtils.startServer(new OKAvroHandler());
    try {
      client = RpcClientFactory.getInstance(localhost, server.getPort());
      client.append(EventBuilder.withBody("wheee!!!", Charset.forName("UTF8")));
    } finally {
      RpcTestUtils.stopServer(server);
View Full Code Here

Examples of org.apache.flume.api.RpcTestUtils.OKAvroHandler

  @Test
  public void testThreeParamBatchAppend() throws FlumeException,
      EventDeliveryException {
    int batchSize = 7;
    RpcClient client = null;
    Server server = RpcTestUtils.startServer(new OKAvroHandler());
    try {
      client = RpcClientFactory.getInstance(localhost, server.getPort(),
          batchSize);

      List<Event> events = new ArrayList<Event>();
View Full Code Here

Examples of org.apache.flume.api.RpcTestUtils.OKAvroHandler

  // we are supposed to handle this gracefully
  @Test
  public void testTwoParamBatchAppendOverflow() throws FlumeException,
      EventDeliveryException {
    RpcClient client = null;
    Server server = RpcTestUtils.startServer(new OKAvroHandler());
    try {
      client = RpcClientFactory.getInstance(localhost, server.getPort());
      int batchSize = client.getBatchSize();
      int moreThanBatch = batchSize + 1;
      List<Event> events = new ArrayList<Event>();
View Full Code Here

Examples of org.apache.flume.api.RpcTestUtils.OKAvroHandler

   * @throws EventDeliveryException
   */
  @Test
  public void testOKServerSimple() throws FlumeException,
      EventDeliveryException {
    RpcTestUtils.handlerSimpleAppendTest(new OKAvroHandler());
  }
View Full Code Here

Examples of org.apache.flume.api.RpcTestUtils.OKAvroHandler

   * @throws EventDeliveryException
   */
  @Test
  public void testOKServerBatch() throws FlumeException,
      EventDeliveryException {
    RpcTestUtils.handlerBatchAppendTest(new OKAvroHandler());
  }
View Full Code Here

Examples of org.apache.flume.api.RpcTestUtils.OKAvroHandler

  public void testBatchOverrun() throws FlumeException, EventDeliveryException {

    int batchSize = 10;
    int moreThanBatchSize = batchSize + 1;
    NettyAvroRpcClient client = null;
    Server server = RpcTestUtils.startServer(new OKAvroHandler());
    try {
      client = new NettyAvroRpcClient.Builder()
          .hostname(localhost).port(server.getPort()).batchSize(batchSize)
          .build();
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.