Package org.mojavemvc.core

Examples of org.mojavemvc.core.MappedControllerDatabase


    public void testHttpMethodController2() {

        Set<Class<?>> controllerClasses = new HashSet<Class<?>>();
        controllerClasses.add(TestHttpMethodController2.class);
        FakeRouteMap rm = new FakeRouteMap();
        ControllerDatabase db = new MappedControllerDatabase(controllerClasses, rm,
                new HashMap<String, EntityMarshaller>());

        assertEquals(TestHttpMethodController2.class, db.getControllerClass("TestHttpMethodController2"));

        ActionSignature sig = db.getHttpMethodActionSignature(TestHttpMethodController2.class, HttpMethod.GET);
        assertNotNull(sig);
        assertTrue(sig instanceof HttpMethodActionSignature);
        assertEquals("getAction", sig.methodName());

        List<Class<?>> interceptors = db.getInterceptorsForHttpMethodAction(TestHttpMethodController2.class,
                HttpMethod.GET);
        assertNotNull(interceptors);
        assertEquals(1, interceptors.size());
        assertEquals(Interceptor1.class, interceptors.get(0));

        sig = db.getHttpMethodActionSignature(TestHttpMethodController2.class, HttpMethod.POST);
        assertNotNull(sig);
        assertEquals("postAction", sig.methodName());

        interceptors = db.getInterceptorsForHttpMethodAction(TestHttpMethodController2.class, HttpMethod.POST);
        assertNotNull(interceptors);
        assertEquals(2, interceptors.size());
        assertEquals(Interceptor1.class, interceptors.get(0));
        assertEquals(Interceptor2.class, interceptors.get(1));
       
View Full Code Here


    public void testHttpMethodController3() {

        Set<Class<?>> controllerClasses = new HashSet<Class<?>>();
        controllerClasses.add(TestHttpMethodController3.class);
        FakeRouteMap rm = new FakeRouteMap();
        ControllerDatabase db = new MappedControllerDatabase(controllerClasses, rm,
                new HashMap<String, EntityMarshaller>());

        assertEquals(TestHttpMethodController3.class, db.getControllerClass("TestHttpMethodController3"));

        ActionSignature sig = db.getHttpMethodActionSignature(TestHttpMethodController3.class, HttpMethod.GET);
        assertNotNull(sig);
        assertTrue(sig instanceof HttpMethodActionSignature);
        assertEquals("multiAction", sig.methodName());

        List<Class<?>> interceptors = db.getInterceptorsForHttpMethodAction(TestHttpMethodController3.class,
                HttpMethod.GET);
        assertNotNull(interceptors);
        assertEquals(2, interceptors.size());
        assertEquals(Interceptor1.class, interceptors.get(0));
        assertEquals(Interceptor2.class, interceptors.get(1));

        sig = db.getHttpMethodActionSignature(TestHttpMethodController3.class, HttpMethod.POST);
        assertNotNull(sig);
        assertTrue(sig instanceof HttpMethodActionSignature);
        assertEquals("multiAction", sig.methodName());

        interceptors = db.getInterceptorsForHttpMethodAction(TestHttpMethodController3.class, HttpMethod.POST);
        assertNotNull(interceptors);
        assertEquals(2, interceptors.size());
        assertEquals(Interceptor1.class, interceptors.get(0));
        assertEquals(Interceptor2.class, interceptors.get(1));

        sig = db.getHttpMethodActionSignature(TestHttpMethodController3.class, HttpMethod.PUT);
        assertNotNull(sig);
        assertTrue(sig instanceof HttpMethodActionSignature);
        assertEquals("multiAction", sig.methodName());

        interceptors = db.getInterceptorsForHttpMethodAction(TestHttpMethodController3.class, HttpMethod.PUT);
        assertNotNull(interceptors);
        assertEquals(2, interceptors.size());
        assertEquals(Interceptor1.class, interceptors.get(0));
        assertEquals(Interceptor2.class, interceptors.get(1));
       
View Full Code Here

    public void testInvalidHttpMethodController() {

        try {
            Set<Class<?>> controllerClasses = new HashSet<Class<?>>();
            controllerClasses.add(TestInvalidHttpMethodController.class);
            new MappedControllerDatabase(controllerClasses, new FakeRouteMap(),
                    new HashMap<String, EntityMarshaller>());
            fail("should have thrown exception");
        } catch (Exception e) {
            if (!(e instanceof ConfigurationException)) {
                fail("wrong exception type");
View Full Code Here

    public void testParamPathController1() {
       
        Set<Class<?>> controllerClasses = new HashSet<Class<?>>();
        controllerClasses.add(TestParamPathController1.class);
        FakeRouteMap rm = new FakeRouteMap();
        ControllerDatabase db = new MappedControllerDatabase(controllerClasses, rm,
                new HashMap<String, EntityMarshaller>());
       
        assertEquals(TestParamPathController1.class, db.getControllerClass("TestParamPathController1"));
        assertEquals(1, rm.size());
        assertTrue(rm.contains(new MojaveRoute("TestParamPathController1", "getAction", "to/:name")));
    }
View Full Code Here

    public void testParamPathController2() {
       
        Set<Class<?>> controllerClasses = new HashSet<Class<?>>();
        controllerClasses.add(TestParamPathController2.class);
        FakeRouteMap rm = new FakeRouteMap();
        ControllerDatabase db = new MappedControllerDatabase(controllerClasses, rm,
                new HashMap<String, EntityMarshaller>());
       
        assertEquals(TestParamPathController2.class, db.getControllerClass("TestParamPathController2"));
        assertEquals(1, rm.size());
        assertTrue(rm.contains(new MojaveRoute("TestParamPathController2", "getAction", ":name/:location<[a-z]+>")));
    }
View Full Code Here

    public void testParamPathController3() {
       
        Set<Class<?>> controllerClasses = new HashSet<Class<?>>();
        controllerClasses.add(TestParamPathController3.class);
        FakeRouteMap rm = new FakeRouteMap();
        ControllerDatabase db = new MappedControllerDatabase(controllerClasses, rm,
                new HashMap<String, EntityMarshaller>());
       
        assertEquals(TestParamPathController3.class, db.getControllerClass("TestParamPathController3"));
        assertEquals(1, rm.size());
        assertTrue(rm.contains(new MojaveRoute("TestParamPathController3", null, ":name")));
    }
View Full Code Here

    public void testParamPathController4() {
       
        Set<Class<?>> controllerClasses = new HashSet<Class<?>>();
        controllerClasses.add(TestParamPathController4.class);
        FakeRouteMap rm = new FakeRouteMap();
        ControllerDatabase db = new MappedControllerDatabase(controllerClasses, rm,
                new HashMap<String, EntityMarshaller>());
       
        assertEquals(TestParamPathController4.class, db.getControllerClass("TestParamPathController4"));
        assertEquals(1, rm.size());
        assertTrue(rm.contains(new MojaveRoute("TestParamPathController4", null, ":name")));
    }
View Full Code Here

    public void testParamPathController_Invalid1() {
       
        try {
            Set<Class<?>> controllerClasses = new HashSet<Class<?>>();
            controllerClasses.add(TestParamPathController_Invalid1.class);
            new MappedControllerDatabase(controllerClasses, new FakeRouteMap(),
                    new HashMap<String, EntityMarshaller>());
            fail("should have thrown exception");
        } catch (Exception e) {
            if (!(e instanceof ConfigurationException)) {
                fail("wrong exception type");
View Full Code Here

    public void testParamPathController_Invalid2() {
       
        try {
            Set<Class<?>> controllerClasses = new HashSet<Class<?>>();
            controllerClasses.add(TestParamPathController_Invalid2.class);
            new MappedControllerDatabase(controllerClasses, new FakeRouteMap(),
                    new HashMap<String, EntityMarshaller>());
            fail("should have thrown exception");
        } catch (Exception e) {
            if (!(e instanceof ConfigurationException)) {
                fail("wrong exception type");
View Full Code Here

    public void testParamPathController_Invalid3() {
       
        try {
            Set<Class<?>> controllerClasses = new HashSet<Class<?>>();
            controllerClasses.add(TestParamPathController_Invalid3.class);
            new MappedControllerDatabase(controllerClasses, new FakeRouteMap(),
                    new HashMap<String, EntityMarshaller>());
            fail("should have thrown exception");
        } catch (Exception e) {
            if (!(e instanceof ConfigurationException)) {
                fail("wrong exception type");
View Full Code Here

TOP

Related Classes of org.mojavemvc.core.MappedControllerDatabase

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.