Package com.linkedin.databus.core.test.netty

Examples of com.linkedin.databus.core.test.netty.SimpleHttpResponseHandler.awaitResponseUninterruptedly()


                                                     HttpMethod.GET, "/sources");

    SimpleTestHttpClient httpClient = SimpleTestHttpClient.createLocal(TimeoutPolicy.ALL_TIMEOUTS);
    SimpleHttpResponseHandler respHandler = httpClient.sendRequest(_serverAddress, httpRequest);

    assertTrue("failed to get a response", respHandler.awaitResponseUninterruptedly(1, TimeUnit.SECONDS));
    ByteArrayInputStream in = new ByteArrayInputStream(respHandler.getReceivedBytes());
    ObjectMapper objMapper = new ObjectMapper();
    List<IdNamePair> res = objMapper.readValue(in, new TypeReference<List<IdNamePair>>(){});
    assertNotNull("no result", res);
    if (LOG.isDebugEnabled())
View Full Code Here


    httpRequest.setHeader(DatabusHttpHeaders.DBUS_CLIENT_SERVICE_HDR, "unittestclient");
    SimpleTestHttpClient httpClient = SimpleTestHttpClient.createLocal(TimeoutPolicy.ALL_TIMEOUTS);
    SimpleHttpResponseHandler respHandler = httpClient.sendRequest(_serverAddress, httpRequest);

    assertTrue("failed to get a response",
               respHandler.awaitResponseUninterruptedly(1, TimeUnit.SECONDS));
    ByteArrayInputStream in = new ByteArrayInputStream(respHandler.getReceivedBytes());
    ObjectMapper objMapper = new ObjectMapper();
    List<IdNamePair> res = objMapper.readValue(in, new TypeReference<List<IdNamePair>>(){});
    assertNotNull("no result", res);
    if (LOG.isDebugEnabled())
View Full Code Here

                                                     HttpMethod.GET, "/sources");

    SimpleTestHttpClient httpClient = SimpleTestHttpClient.createLocal(TimeoutPolicy.ALL_TIMEOUTS);
    SimpleHttpResponseHandler respHandler = httpClient.sendRequest(_serverAddress, httpRequest);

    assertTrue("failed to get a response", respHandler.awaitResponseUninterruptedly(1, TimeUnit.SECONDS));
    ByteArrayInputStream in = new ByteArrayInputStream(respHandler.getReceivedBytes());
    ObjectMapper objMapper = new ObjectMapper();
    List<IdNamePair> res = objMapper.readValue(in, new TypeReference<List<IdNamePair>>(){});
    assertNotNull("no result", res);
    if (LOG.isDebugEnabled())
View Full Code Here

                                                     HttpMethod.GET, "/register?sources=3002");

    SimpleTestHttpClient httpClient = SimpleTestHttpClient.createLocal(TimeoutPolicy.ALL_TIMEOUTS);
    SimpleHttpResponseHandler respHandler = httpClient.sendRequest(_serverAddress, httpRequest);

    assertTrue("failed to get a response", respHandler.awaitResponseUninterruptedly(1, TimeUnit.SECONDS));
    byte[] respBytes = respHandler.getReceivedBytes();
    if (LOG.isDebugEnabled())
    {
      LOG.debug("/register response:" + new String(respBytes));
    }
View Full Code Here

    SimpleTestHttpClient httpClient = SimpleTestHttpClient.createLocal(TimeoutPolicy.ALL_TIMEOUTS);
    HttpRequest httpRequest = new DefaultHttpRequest(HttpVersion.HTTP_1_1,
                                         HttpMethod.GET, "/register?sources=4001,4002");
    SimpleHttpResponseHandler respHandler = httpClient.sendRequest(_serverAddress, httpRequest);

    assertTrue("failed to get a response", respHandler.awaitResponseUninterruptedly(1, TimeUnit.SECONDS));
    ByteArrayInputStream in = new ByteArrayInputStream(respHandler.getReceivedBytes());
    List<RegisterResponseEntry> res =
        objMapper.readValue(in, new TypeReference<List<RegisterResponseEntry>>(){});
    assertNotNull("no result", res);
    if (LOG.isDebugEnabled())
View Full Code Here

    // /register?sources=1,2,3
    SimpleTestHttpClient httpClient = SimpleTestHttpClient.createLocal(TimeoutPolicy.ALL_TIMEOUTS);
    HttpRequest httpRequest = new DefaultHttpRequest(HttpVersion.HTTP_1_1,
                                         HttpMethod.GET, "/register?sources=5001,5002,5003");
    SimpleHttpResponseHandler respHandler = httpClient.sendRequest(_serverAddress, httpRequest);
    assertTrue("failed to get a response", respHandler.awaitResponseUninterruptedly(1, TimeUnit.SECONDS));

    if (LOG.isDebugEnabled())
    {
      LOG.debug("/register response:" + new String(respHandler.getReceivedBytes()));
    }
View Full Code Here

                               "/register?sources=4002&" + DatabusHttpHeaders.PROTOCOL_VERSION_PARAM + "=4");

    SimpleTestHttpClient httpClient = SimpleTestHttpClient.createLocal(TimeoutPolicy.ALL_TIMEOUTS);
    SimpleHttpResponseHandler respHandler = httpClient.sendRequest(_serverAddress, httpRequest);

    assertTrue("failed to get a response", respHandler.awaitResponseUninterruptedly(1, TimeUnit.SECONDS));
    HttpResponse respObj = respHandler.getResponse();
    assertNull("/register v4 returned unexpected error: " +
               respObj.getHeader(DatabusHttpHeaders.DATABUS_ERROR_CLASS_HEADER),
               respObj.getHeader(DatabusHttpHeaders.DATABUS_ERROR_CLASS_HEADER));
    String registerResponseProtocolVersionStr =
View Full Code Here

        new DefaultHttpRequest(HttpVersion.HTTP_1_1,
                               HttpMethod.GET,
                               "/register?sources=4002&" + DatabusHttpHeaders.PROTOCOL_VERSION_PARAM + "=1");
    SimpleTestHttpClient httpClient = SimpleTestHttpClient.createLocal(TimeoutPolicy.ALL_TIMEOUTS);
    SimpleHttpResponseHandler respHandler = httpClient.sendRequest(_serverAddress, httpRequest);
    assertTrue("failed to get a response", respHandler.awaitResponseUninterruptedly(1, TimeUnit.SECONDS));
    HttpResponse respObj = respHandler.getResponse();
    assertNotNull("/register failed to return expected error",
                  respObj.getHeader(DatabusHttpHeaders.DATABUS_ERROR_CLASS_HEADER));
    LOG.debug("DATABUS_ERROR_CLASS_HEADER = " + respObj.getHeader(DatabusHttpHeaders.DATABUS_ERROR_CLASS_HEADER));
View Full Code Here

    httpRequest =
        new DefaultHttpRequest(HttpVersion.HTTP_1_1,
                               HttpMethod.GET,
                               "/register?sources=4002&" + DatabusHttpHeaders.PROTOCOL_VERSION_PARAM + "=5");
    respHandler = httpClient.sendRequest(_serverAddress, httpRequest);
    assertTrue("failed to get a response", respHandler.awaitResponseUninterruptedly(1, TimeUnit.SECONDS));
    respObj = respHandler.getResponse();
    assertNotNull("/register failed to return expected error",
                  respObj.getHeader(DatabusHttpHeaders.DATABUS_ERROR_CLASS_HEADER));
    LOG.debug("DATABUS_ERROR_CLASS_HEADER = " + respObj.getHeader(DatabusHttpHeaders.DATABUS_ERROR_CLASS_HEADER));
View Full Code Here

    httpRequest =
        new DefaultHttpRequest(HttpVersion.HTTP_1_1,
                               HttpMethod.GET,
                               "/register?sources=4002&" + DatabusHttpHeaders.PROTOCOL_VERSION_PARAM + "=2");
    respHandler = httpClient.sendRequest(_serverAddress, httpRequest);
    assertTrue("failed to get a response", respHandler.awaitResponseUninterruptedly(1, TimeUnit.SECONDS));
    respObj = respHandler.getResponse();
    assertNull("/register v2 returned unexpected error: " +
               respObj.getHeader(DatabusHttpHeaders.DATABUS_ERROR_CLASS_HEADER),
               respObj.getHeader(DatabusHttpHeaders.DATABUS_ERROR_CLASS_HEADER));
    LOG.debug("DATABUS_ERROR_CLASS_HEADER = " + respObj.getHeader(DatabusHttpHeaders.DATABUS_ERROR_CLASS_HEADER));
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.