Example usage for io.netty.handler.codec.http HttpMethod GET

List of usage examples for io.netty.handler.codec.http HttpMethod GET

Introduction

In this page you can find the example usage for io.netty.handler.codec.http HttpMethod GET.

Prototype

HttpMethod GET

To view the source code for io.netty.handler.codec.http HttpMethod GET.

Click Source Link

Document

The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI.

Usage

From source file:org.restexpress.pipeline.JsendWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapNullPointerInJsendXmlUsingQueryString() {
    sendEvent(HttpMethod.GET, "/null_pointer?format=xml", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(0, observer.getSuccessCount());
    assertEquals(1, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertTrue(httpResponse.toString().startsWith("<response>"));
    assertTrue(httpResponse.toString().contains("<code>500</code>"));
    assertTrue(httpResponse.toString().contains("<status>fail</status>"));
    assertTrue(httpResponse.toString().contains("<message>Null and void</message>"));
    assertTrue(httpResponse.toString().contains("<data class=\"string\">NullPointerException</data>"));
    assertTrue(httpResponse.toString().endsWith("</response>"));
}

From source file:org.restexpress.pipeline.JsendWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapInvalidUrlWithJsonFormat() {
    sendEvent(HttpMethod.GET, "/xyzt.json", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(0, observer.getSuccessCount());
    assertEquals(1, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertEquals(// w ww .j av a  2 s.c  o  m
            "{\"code\":404,\"status\":\"error\",\"message\":\"Unresolvable URL: http://null/xyzt.json\",\"data\":\"NotFoundException\"}",
            httpResponse.toString());
}

From source file:org.restexpress.pipeline.JsendWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapInvalidUrlWithJsonFormatUsingQueryString() {
    sendEvent(HttpMethod.GET, "/xyzt?format=json", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(0, observer.getSuccessCount());
    assertEquals(1, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertEquals(// www.  ja  va 2 s.c o m
            "{\"code\":404,\"status\":\"error\",\"message\":\"Unresolvable URL: http://null/xyzt?format=json\",\"data\":\"NotFoundException\"}",
            httpResponse.toString());
}

From source file:org.restexpress.pipeline.JsendWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapInvalidUrlWithXmlFormat() {
    sendEvent(HttpMethod.GET, "/xyzt.xml", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(0, observer.getSuccessCount());
    assertEquals(1, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertTrue(httpResponse.toString().startsWith("<response>"));
    assertTrue(httpResponse.toString().contains("<code>404</code>"));
    assertTrue(httpResponse.toString().contains("<status>error</status>"));
    assertTrue(httpResponse.toString().contains("<message>Unresolvable URL: http://null/xyzt.xml</message>"));
    assertTrue(httpResponse.toString().endsWith("</response>"));
}

From source file:org.restexpress.pipeline.JsendWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapInvalidUrlWithXmlFormatUsingQueryString() {
    sendEvent(HttpMethod.GET, "/xyzt?format=xml", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(0, observer.getSuccessCount());
    assertEquals(1, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertTrue(httpResponse.toString().startsWith("<response>"));
    assertTrue(httpResponse.toString().contains("<code>404</code>"));
    assertTrue(httpResponse.toString().contains("<status>error</status>"));
    assertTrue(httpResponse.toString()/* w  ww .j  a  v a 2s . c o  m*/
            .contains("<message>Unresolvable URL: http://null/xyzt?format=xml</message>"));
    assertTrue(httpResponse.toString().endsWith("</response>"));
}

From source file:org.restexpress.pipeline.RawWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapGetInRawJson() {
    sendEvent(HttpMethod.GET, "/normal_get.json", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(1, observer.getSuccessCount());
    assertEquals(0, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertEquals("\"Normal GET action\"", httpResponse.toString());
}

From source file:org.restexpress.pipeline.RawWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapGetInRawJsonUsingQueryString() {
    sendEvent(HttpMethod.GET, "/normal_get?format=json", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(1, observer.getSuccessCount());
    assertEquals(0, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertEquals("\"Normal GET action\"", httpResponse.toString());
}

From source file:org.restexpress.pipeline.RawWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapGetInRawXml() {
    sendEvent(HttpMethod.GET, "/normal_get.xml", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(1, observer.getSuccessCount());
    assertEquals(0, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertEquals("<string>Normal GET action</string>", httpResponse.toString());
}

From source file:org.restexpress.pipeline.RawWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapGetInRawXmlUsingQueryString() {
    sendEvent(HttpMethod.GET, "/normal_get?format=xml", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(1, observer.getSuccessCount());
    assertEquals(0, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertEquals("<string>Normal GET action</string>", httpResponse.toString());
}

From source file:org.restexpress.pipeline.RawWrappedResponseTest.java

License:Apache License

@Test
public void shouldWrapNotFoundInRawJson() {
    sendEvent(HttpMethod.GET, "/not_found.json", "");
    assertEquals(1, observer.getReceivedCount());
    assertEquals(1, observer.getCompleteCount());
    assertEquals(0, observer.getSuccessCount());
    assertEquals(1, observer.getExceptionCount());
    //      System.out.println(httpResponse.toString());
    assertEquals("\"Item not found\"", httpResponse.toString());
}