Package com.linkedin.r2.testutils.filter

Examples of com.linkedin.r2.testutils.filter.MessageCountFilter


  private static TransportDispatcher createDispatcher()
  {
    return new TransportDispatcherBuilder()
            .addRpcHandler(ECHO_URI, new RpcEchoServer(new EchoServiceImpl()))
            .addRpcHandler(ON_EXCEPTION_ECHO_URI, new RpcEchoServer(new OnExceptionEchoService()))
            .addRpcHandler(THROWING_ECHO_URI, new RpcEchoServer(new ThrowingEchoService()))
            .addRestHandler(ECHO_URI, new RestEchoServer(new EchoServiceImpl()))
            .addRestHandler(ON_EXCEPTION_ECHO_URI, new RestEchoServer(new OnExceptionEchoService()))
            .addRestHandler(THROWING_ECHO_URI, new RestEchoServer(new ThrowingEchoService()))
            .build();
  }
View Full Code Here


  {
    return new TransportDispatcherBuilder()
            .addRpcHandler(ECHO_URI, new RpcEchoServer(new EchoServiceImpl()))
            .addRpcHandler(ON_EXCEPTION_ECHO_URI, new RpcEchoServer(new OnExceptionEchoService()))
            .addRpcHandler(THROWING_ECHO_URI, new RpcEchoServer(new ThrowingEchoService()))
            .addRestHandler(ECHO_URI, new RestEchoServer(new EchoServiceImpl()))
            .addRestHandler(ON_EXCEPTION_ECHO_URI, new RestEchoServer(new OnExceptionEchoService()))
            .addRestHandler(THROWING_ECHO_URI, new RestEchoServer(new ThrowingEchoService()))
            .build();
  }
View Full Code Here

  @SuppressWarnings("deprecation")
  private static TransportDispatcher createDispatcher()
  {
    return new TransportDispatcherBuilder()
            .addRpcHandler(ECHO_URI, new RpcEchoServer(new EchoServiceImpl()))
            .addRpcHandler(ON_EXCEPTION_ECHO_URI, new RpcEchoServer(new OnExceptionEchoService()))
            .addRpcHandler(THROWING_ECHO_URI, new RpcEchoServer(new ThrowingEchoService()))
            .addRestHandler(ECHO_URI, new RestEchoServer(new EchoServiceImpl()))
            .addRestHandler(ON_EXCEPTION_ECHO_URI, new RestEchoServer(new OnExceptionEchoService()))
            .addRestHandler(THROWING_ECHO_URI, new RestEchoServer(new ThrowingEchoService()))
            .build();
  }
View Full Code Here

  }

  @Test
  public void testRequestFilter()
  {
    final MessageCountFilter filter = new MessageCountFilter();
    final FilterChain fc = FilterChains.create(filter);

    fireRpcRequest(fc);
    assertMessageCounts(1, 0, 0, filter);

    filter.reset();
    assertMessageCounts(0, 0, 0, filter);

    fireRestRequest(fc);
    assertMessageCounts(1, 0, 0, filter);
  }
View Full Code Here

  }

  @Test
  public void testResponseFilter()
  {
    final MessageCountFilter filter = new MessageCountFilter();
    final FilterChain fc = FilterChains.create(filter);

    fireRpcResponse(fc);
    assertMessageCounts(0, 1, 0, filter);

    filter.reset();
    assertMessageCounts(0, 0, 0, filter);

    fireRestResponse(fc);
    assertMessageCounts(0, 1, 0, filter);
  }
View Full Code Here

  }

  @Test
  public void testErrorFilter()
  {
    final MessageCountFilter filter = new MessageCountFilter();
    final FilterChain fc = FilterChains.create(filter);

    fireRpcError(fc);
    assertMessageCounts(0, 0, 1, filter);

    filter.reset();
    assertMessageCounts(0, 0, 0, filter);

    fireRestError(fc);
    assertMessageCounts(0, 0, 1, filter);
  }
View Full Code Here

  }

  @Test
  public void testChainRequestFilters()
  {
    final MessageCountFilter filter1 = new MessageCountFilter();
    final MessageCountFilter filter2 = new MessageCountFilter();
    final MessageCountFilter filter3 = new MessageCountFilter();
    final FilterChain fc = FilterChains.create(filter1, filter2, filter3);

    fireRpcRequest(fc);
    assertMessageCounts(1, 0, 0, filter1);
    assertMessageCounts(1, 0, 0, filter2);
    assertMessageCounts(1, 0, 0, filter3);

    filter1.reset();
    filter2.reset();
    filter3.reset();

    fireRestRequest(fc);
    assertMessageCounts(1, 0, 0, filter1);
    assertMessageCounts(1, 0, 0, filter2);
    assertMessageCounts(1, 0, 0, filter3);
View Full Code Here

  }

  @Test
  public void testChainResponseFilters()
  {
    final MessageCountFilter filter1 = new MessageCountFilter();
    final MessageCountFilter filter2 = new MessageCountFilter();
    final MessageCountFilter filter3 = new MessageCountFilter();
    final FilterChain fc = FilterChains.create(filter1, filter2, filter3);

    fireRpcResponse(fc);
    assertMessageCounts(0, 1, 0, filter1);
    assertMessageCounts(0, 1, 0, filter2);
    assertMessageCounts(0, 1, 0, filter3);

    filter1.reset();
    filter2.reset();
    filter3.reset();

    fireRestResponse(fc);
    assertMessageCounts(0, 1, 0, filter1);
    assertMessageCounts(0, 1, 0, filter2);
    assertMessageCounts(0, 1, 0, filter3);
View Full Code Here

  }

  @Test
  public void testChainErrorFilters()
  {
    final MessageCountFilter filter1 = new MessageCountFilter();
    final MessageCountFilter filter2 = new MessageCountFilter();
    final MessageCountFilter filter3 = new MessageCountFilter();
    final FilterChain fc = FilterChains.create(filter1, filter2, filter3);

    fireRpcError(fc);
    assertMessageCounts(0, 0, 1, filter1);
    assertMessageCounts(0, 0, 1, filter2);
    assertMessageCounts(0, 0, 1, filter3);

    filter1.reset();
    filter2.reset();
    filter3.reset();

    fireRestError(fc);
    assertMessageCounts(0, 0, 1, filter1);
    assertMessageCounts(0, 0, 1, filter2);
    assertMessageCounts(0, 0, 1, filter3);
View Full Code Here

                        .setMaxR2ConnectionPoolSize(100);
        clientFactory = new HttpClientFactory();
        Map<String, String> properties = new HashMap<String, String>();
        properties.put(HttpClientFactory.HTTP_POOL_SIZE,
                       Integer.toString(restClientConfig.getMaxR2ConnectionPoolSize()));
        TransportClient transportClient = clientFactory.getClient(properties);
        R2Store r2Store = new R2Store(STORE_NAME,
                                      restClientConfig.getHttpBootstrapURL(),
                                      "0",
                                      transportClient,
                                      restClientConfig,
View Full Code Here

TOP

Related Classes of com.linkedin.r2.testutils.filter.MessageCountFilter

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.