Package com.alibaba.citrus.turbine.uribroker.uri

Examples of com.alibaba.citrus.turbine.uribroker.uri.TurbineURIBroker


        return getFieldValue(rundata, "lazyCommitRequestContext", LazyCommitRequestContext.class).getRedirectLocation();
    }

    @Test
    public void redirect_getURI() {
        TurbineURIBroker uri = (TurbineURIBroker) rundata.redirectTo("link2").uri();
        uri.setTarget("hello").addQueryData("aaa", 1);

        assertEquals("http://www.taobao.com/hello?aaa=1", rundata.getRedirectLocation());
    }
View Full Code Here


    private MappingRuleService mappingRuleService;
    private MappingRuleService mappingRuleService2;

    @Before
    public void init() {
        broker = new TurbineURIBroker();

        mappingRuleService = createMock(MappingRuleService.class);
        expect(mappingRuleService.getMappedName("mymapper", "myTarget.vm")).andReturn("myTarget.htm").anyTimes();
        expect(mappingRuleService.getMappedName("mymapper", "my/pageXyz.vm")).andReturn("my/pageXyz.htm").anyTimes();
        replay(mappingRuleService);
View Full Code Here

        expect(mappingRuleService2.getMappedName("mymapper2", "myTarget2.vm")).andReturn("myTarget2.htm").anyTimes();
        replay(mappingRuleService2);
    }

    private TurbineURIBroker createParentBroker() {
        TurbineURIBroker parent = new TurbineURIBroker();

        parent.setMappingRuleService(mappingRuleService);
        parent.setActionParam("myaction");
        parent.setConvertTargetCase(true);
        parent.setTargetMappingRule("mymapper");
        parent.setAction("myAction");
        parent.setTarget("myTarget.vm");
        parent.setComponentPath("myComponent");

        return parent;
    }
View Full Code Here

        return parent;
    }

    private TurbineURIBroker createSubBroker(URIBroker parent, boolean overrideActionAndTarget) {
        TurbineURIBroker broker = new TurbineURIBroker();

        broker.setParent(parent);
        broker.setMappingRuleService(mappingRuleService2);
        broker.setActionParam("myaction2");
        broker.setConvertTargetCase(false);
        broker.setTargetMappingRule("mymapper2");
        broker.setComponentPath("myComponent2");

        if (overrideActionAndTarget) {
            broker.setAction("myAction2");
            broker.setTarget("myTarget2.vm");
        }

        return broker;
    }
View Full Code Here

    }

    @Test
    public void getActionParam() {
        // default value
        broker = new TurbineURIBroker().setAction("myAction");
        assertEquals("action", broker.getActionParam());
        assertEquals("http:///?action=myAction", broker.toString());

        // set empty
        broker = new TurbineURIBroker().setActionParam(null).setAction("myAction");
        assertEquals("action", broker.getActionParam());
        assertEquals("http:///?action=myAction", broker.toString());

        broker = new TurbineURIBroker().setActionParam("  ").setAction("myAction");
        assertEquals("action", broker.getActionParam());
        assertEquals("http:///?action=myAction", broker.toString());

        // set value
        broker = new TurbineURIBroker().setActionParam(" myaction ").setAction("myAction");
        assertEquals("myaction", broker.getActionParam());
        assertEquals("http:///?myaction=myAction", broker.toString());
    }
View Full Code Here

        assertEquals("http:///?action=myAction2", broker.toString());
    }

    @Test
    public void init_withParent() {
        TurbineURIBroker parent = createParentBroker();

        // empty broker
        broker.setParent(parent);
        broker.init();
View Full Code Here

        assertEquals("http:///myComponent2/myTarget.htm?myaction2=myAction", broker.toString());
    }

    @Test
    public void reset_withParent() {
        TurbineURIBroker parent = createParentBroker();
        broker = createSubBroker(parent, true);
        broker.init();
        broker.reset();

        assertSame(mappingRuleService, broker.getMappingRuleService());
View Full Code Here

        URIBrokerService uris = (URIBrokerService) factory.getBean("uris");

        URIBroker link1 = uris.getURIBroker("link1");
        assertEquals("http://taobao.com/hello", link1.toString());

        TurbineURIBroker link2 = (TurbineURIBroker) uris.getURIBroker("link2");
        assertSame(factory.getBean("mappingRuleService"), link2.getMappingRuleService());
        assertEquals("http://taobao.com/mycontext/myservlet/mycomponent/my_target.htm?action=myAction",
                     link2.toString());

        TurbineURIBroker link3 = (TurbineURIBroker) uris.getURIBroker("link3");
        assertSame(factory.getBean("mapping2"), link3.getMappingRuleService());
        assertEquals("http://taobao.com/mycontext/myservlet/mycomponent/myTarget.vhtml?myaction=myAction",
                     link3.toString());
    }
View Full Code Here

        URIBrokerService uris = (URIBrokerService) factory.getBean("uris");

        URIBroker link1 = uris.getURIBroker("link1");
        assertEquals("http://taobao.com/hello", link1.toString());

        TurbineURIBroker link2 = (TurbineURIBroker) uris.getURIBroker("link2");
        assertNull(link2.getMappingRuleService());
        assertEquals("http://taobao.com/mycontext/myservlet/mycomponent/my_target.vm?action=myAction", link2.toString());

        TurbineURIBroker link3 = (TurbineURIBroker) uris.getURIBroker("link3");
        assertNull(link3.getMappingRuleService());
        assertEquals("http://taobao.com/mycontext/myservlet/mycomponent/myTarget.vm?myaction=myAction",
                     link3.toString());
    }
View Full Code Here

        return getFieldValue(rundata, "lazyCommitRequestContext", LazyCommitRequestContext.class).getRedirectLocation();
    }

    @Test
    public void redirect_getURI() {
        TurbineURIBroker uri = (TurbineURIBroker) rundata.redirectTo("link2").uri();
        uri.setTarget("hello").addQueryData("aaa", 1);

        assertEquals("http://www.taobao.com/hello?aaa=1", rundata.getRedirectLocation());
    }
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.turbine.uribroker.uri.TurbineURIBroker

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.