Search in sources :

Example 1 with RequestHandlerMethod

use of com.tvd12.ezyhttp.server.core.reflect.RequestHandlerMethod in project ezyhttp by youngmonkeys.

the class RequestHandlerImplementerTest method test.

@Test
public void test() {
    RequestHandlerImplementer.setDebug(true);
    ControllerProxy homeController = new ControllerProxy(new HomeController());
    for (RequestHandlerMethod method : homeController.getRequestHandlerMethods()) {
        RequestHandlerImplementer implementer = new RequestHandlerImplementer(homeController, method);
        implementer.implement();
    }
}
Also used : RequestHandlerMethod(com.tvd12.ezyhttp.server.core.reflect.RequestHandlerMethod) HomeController(com.tvd12.ezyhttp.server.core.test.controller.HomeController) RequestHandlerImplementer(com.tvd12.ezyhttp.server.core.asm.RequestHandlerImplementer) ControllerProxy(com.tvd12.ezyhttp.server.core.reflect.ControllerProxy) BaseTest(com.tvd12.test.base.BaseTest) Test(org.testng.annotations.Test)

Example 2 with RequestHandlerMethod

use of com.tvd12.ezyhttp.server.core.reflect.RequestHandlerMethod in project ezyhttp by youngmonkeys.

the class RequestHandlerMethodTest method test.

@Test
public void test() throws Exception {
    // given
    RequestHandlerMethod sut = new RequestHandlerMethod("/get", new EzyMethod(InternalController.class.getDeclaredMethod("getSomething")));
    // when
    // then
    Asserts.assertFalse(sut.isPayment());
    Asserts.assertNull(sut.getFeature());
    System.out.println(sut);
}
Also used : RequestHandlerMethod(com.tvd12.ezyhttp.server.core.reflect.RequestHandlerMethod) EzyMethod(com.tvd12.ezyfox.reflect.EzyMethod) BaseTest(com.tvd12.test.base.BaseTest) Test(org.testng.annotations.Test)

Example 3 with RequestHandlerMethod

use of com.tvd12.ezyhttp.server.core.reflect.RequestHandlerMethod in project ezyhttp by youngmonkeys.

the class RequestHandlerImplementerTest method implementOneFailed.

@Test
public void implementOneFailed() throws Exception {
    // given
    ControllerProxy controller = new ControllerProxy(new Controller());
    RequestHandlerMethod handlerMethod = new RequestHandlerMethod("/", new EzyMethod(Controller.class.getDeclaredMethod("doGet")));
    RequestHandlerImplementer sut = new RequestHandlerImplementer(controller, handlerMethod);
    // when
    Throwable e = Asserts.assertThrows(sut::implement);
    // then
    Asserts.assertEquals(0, handlerMethod.getParameterTypes().length);
    Asserts.assertThat(e).isEqualsType(IllegalStateException.class);
}
Also used : RequestHandlerMethod(com.tvd12.ezyhttp.server.core.reflect.RequestHandlerMethod) RequestHandlerImplementer(com.tvd12.ezyhttp.server.core.asm.RequestHandlerImplementer) ControllerProxy(com.tvd12.ezyhttp.server.core.reflect.ControllerProxy) EzyMethod(com.tvd12.ezyfox.reflect.EzyMethod) Test(org.testng.annotations.Test)

Example 4 with RequestHandlerMethod

use of com.tvd12.ezyhttp.server.core.reflect.RequestHandlerMethod in project ezyhttp by youngmonkeys.

the class RequestHandlerImplementerTest method test.

@Test
public void test() {
    RequestHandlerImplementer.setDebug(true);
    ControllerProxy homeController = new ControllerProxy(new HomeController());
    for (RequestHandlerMethod method : homeController.getRequestHandlerMethods()) {
        RequestHandlerImplementer implementer = new RequestHandlerImplementer(homeController, method);
        implementer.implement();
    }
}
Also used : RequestHandlerMethod(com.tvd12.ezyhttp.server.core.reflect.RequestHandlerMethod) HomeController(com.tvd12.ezyhttp.server.boot.test.controller.HomeController) RequestHandlerImplementer(com.tvd12.ezyhttp.server.core.asm.RequestHandlerImplementer) ControllerProxy(com.tvd12.ezyhttp.server.core.reflect.ControllerProxy) BaseTest(com.tvd12.test.base.BaseTest) Test(org.testng.annotations.Test)

Example 5 with RequestHandlerMethod

use of com.tvd12.ezyhttp.server.core.reflect.RequestHandlerMethod in project ezyhttp by youngmonkeys.

the class RequestHandlerImplementerTest method test.

@Test
public void test() {
    RequestHandlerImplementer.setDebug(true);
    ControllerProxy homeController = new ControllerProxy(new HomeController());
    for (RequestHandlerMethod method : homeController.getRequestHandlerMethods()) {
        RequestHandlerImplementer implementer = new RequestHandlerImplementer(homeController, method);
        implementer.implement();
    }
}
Also used : RequestHandlerMethod(com.tvd12.ezyhttp.server.core.reflect.RequestHandlerMethod) HomeController(com.tvd12.ezyhttp.server.jetty.test.controller.HomeController) RequestHandlerImplementer(com.tvd12.ezyhttp.server.core.asm.RequestHandlerImplementer) ControllerProxy(com.tvd12.ezyhttp.server.core.reflect.ControllerProxy) BaseTest(com.tvd12.test.base.BaseTest) Test(org.testng.annotations.Test)

Aggregations

RequestHandlerMethod (com.tvd12.ezyhttp.server.core.reflect.RequestHandlerMethod)7 Test (org.testng.annotations.Test)6 ControllerProxy (com.tvd12.ezyhttp.server.core.reflect.ControllerProxy)5 BaseTest (com.tvd12.test.base.BaseTest)5 EzyMethod (com.tvd12.ezyfox.reflect.EzyMethod)4 RequestHandlerImplementer (com.tvd12.ezyhttp.server.core.asm.RequestHandlerImplementer)4 ArrayList (java.util.ArrayList)2 EzyLoggable (com.tvd12.ezyfox.util.EzyLoggable)1 HttpMethod (com.tvd12.ezyhttp.core.constant.HttpMethod)1 HomeController (com.tvd12.ezyhttp.server.boot.test.controller.HomeController)1 RequestHandler (com.tvd12.ezyhttp.server.core.handler.RequestHandler)1 RequestURIDecorator (com.tvd12.ezyhttp.server.core.handler.RequestURIDecorator)1 RequestURI (com.tvd12.ezyhttp.server.core.request.RequestURI)1 RequestURIMeta (com.tvd12.ezyhttp.server.core.request.RequestURIMeta)1 HomeController (com.tvd12.ezyhttp.server.core.test.controller.HomeController)1 HomeController (com.tvd12.ezyhttp.server.jetty.test.controller.HomeController)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1