Package net.paoding.rose.web.impl.mapping

Examples of net.paoding.rose.web.impl.mapping.EngineGroupImpl


            return "def";
        }
    };

    public void testGetPost() {
        EngineGroup engineGroup = new EngineGroupImpl();
        engineGroup.addEngine(ReqMethod.GET, new LinkedEngine(null, getEngine, null));
        engineGroup.addEngine(ReqMethod.POST, new LinkedEngine(null, postEngine, null));

        assertSame(getEngine, engineGroup.getEngines(ReqMethod.GET)[0].getTarget());
        assertSame(postEngine, engineGroup.getEngines(ReqMethod.POST)[0].getTarget());

        String msg = "not allowed method should return engines with length is zero";
        assertEquals(msg, 0, engineGroup.getEngines(ReqMethod.PUT).length);
        assertEquals(msg, 0, engineGroup.getEngines(ReqMethod.DELETE).length);
        assertEquals(msg, 0, engineGroup.getEngines(ReqMethod.OPTIONS).length);

        assertEquals("[GET, POST]", engineGroup.toString());
    }
View Full Code Here


        assertEquals("[GET, POST]", engineGroup.toString());
    }

    public void testNotOverrideByAll() {
        EngineGroup engineGroup = new EngineGroupImpl();
        engineGroup.addEngine(ReqMethod.GET, new LinkedEngine(null, getEngine, null));
        engineGroup.addEngine(ReqMethod.ALL, new LinkedEngine(null, defEngine, null));
        engineGroup.addEngine(ReqMethod.POST, new LinkedEngine(null, postEngine, null));

        assertSame(getEngine, engineGroup.getEngines(ReqMethod.GET)[0].getTarget());
        assertSame(defEngine, engineGroup.getEngines(ReqMethod.GET)[1].getTarget());
        assertSame(defEngine, engineGroup.getEngines(ReqMethod.POST)[0].getTarget());
        assertSame(postEngine, engineGroup.getEngines(ReqMethod.POST)[1].getTarget());

        assertSame(defEngine, engineGroup.getEngines(ReqMethod.PUT)[0].getTarget());
        assertSame(defEngine, engineGroup.getEngines(ReqMethod.DELETE)[0].getTarget());

        assertEquals("[GET, POST, DELETE, PUT, HEAD, OPTIONS, TRACE]", engineGroup.toString());
    }
View Full Code Here

TOP

Related Classes of net.paoding.rose.web.impl.mapping.EngineGroupImpl

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.