Package com.alibaba.citrus.service.uribroker.uri

Examples of com.alibaba.citrus.service.uribroker.uri.GenericURIBroker


        assertEquals("http://localhost/", uri.setServerPort(80).render());
        assertEquals("https://localhost:80/", uri.setServerScheme("https").render());
        assertEquals("http://localhost/aa/bb", uri.addPath("aa").addPath("bb").render());

        // fork
        GenericURIBroker newUri = (GenericURIBroker) uri.setServerURI("http://www.taobao.com/aa/bb").fork();

        assertEquals("http://www.taobao.com/aa/bb/cc", newUri.addPath("cc").render());
        assertEquals("http://www.taobao.com/aa/bb/dd", newUri.addPath("dd").render());
    }
View Full Code Here


        assertBrokerRequestAware(service, false);
    }

    private void assertBrokerRequestAware(URIBrokerServiceImpl service, boolean expectedRequestAware) throws Exception {
        service.setBrokers(new URIBrokerInfo[] { new URIBrokerInfo("test", null, true, new GenericURIBroker()) });
        service.afterPropertiesSet();

        assertEquals(expectedRequestAware, service.getURIBrokerInternal("test").isRequestAware());
    }
View Full Code Here

    }

    @Test
    public void init_noBrokerName() throws Exception {
        service = new URIBrokerServiceImpl(null);
        service.setBrokers(new URIBrokerInfo[] { new URIBrokerInfo(null, null, true, new GenericURIBroker()) });

        try {
            service.afterPropertiesSet();
            fail();
        } catch (IllegalArgumentException e) {
View Full Code Here

    }

    @Test
    public void init_duplicatedBrokerName() throws Exception {
        service = new URIBrokerServiceImpl(null);
        service.setBrokers(new URIBrokerInfo[] { new URIBrokerInfo("name1", null, true, new GenericURIBroker()),
                                                 new URIBrokerInfo("name1", null, true, new ContentURIBroker()) });

        try {
            service.afterPropertiesSet();
            fail();
View Full Code Here

    @Test
    public void init_cyclicDepends() throws Exception {
        service = new URIBrokerServiceImpl(null);
        service.setBrokers(new URIBrokerInfo[] { //
                                                 new URIBrokerInfo("b4", "b1", true, new GenericURIBroker()), //
                                                 new URIBrokerInfo("b1", "b2", true, new GenericURIBroker()), //
                                                 new URIBrokerInfo("b2", "b3", true, new GenericURIBroker()), //
                                                 new URIBrokerInfo("b3", "b1", true, new GenericURIBroker()), //
        });

        try {
            service.afterPropertiesSet();
            fail();
View Full Code Here

    @Test
    public void init_parentNotExists() throws Exception {
        service = new URIBrokerServiceImpl(null);
        service.setBrokers(new URIBrokerInfo[] { //
                                                 new URIBrokerInfo("b4", "b1", true, new GenericURIBroker()), //
        });

        try {
            service.afterPropertiesSet();
            fail();
View Full Code Here

    @Test
    public void init_parentNotSuperclass() throws Exception {
        service = new URIBrokerServiceImpl(null);
        service.setBrokers(new URIBrokerInfo[] { //
                                                 new URIBrokerInfo("b4", "b1", true, new GenericURIBroker()), //
                                                 new URIBrokerInfo("b1", null, true, new ContentURIBroker()), //
        });

        // 可继承非super class
        service.afterPropertiesSet();
View Full Code Here

import org.junit.Test;

public class InterceptorForkTests {
    @Test
    public void test() {
        URIBroker u1 = new GenericURIBroker();
        u1.setServerURI("http://localhost:8080/");
        u1.setInterceptors(Collections.<URIBrokerInterceptor>singletonList(new MyInterceptor()));

        u1 = u1.fork();

        assertEquals(true, u1.isAutoReset());
        assertEquals("http://localhost:8080/", u1.toString());
        assertEquals("http://localhost:8080/?test=webx3", u1.render());

        // u1.toString以后,interceptor不被执行。
        u1.toString(); // http://localhost:8080/
        URIBroker u2 = u1.fork();

        assertEquals("http://localhost:8080/", u2.toString());
        assertEquals("http://localhost:8080/?test=webx3", u2.render());
        assertEquals("http://localhost:8080/", u2.toString());
    }
View Full Code Here

    private GenericURIBroker broker;
    private Randomize        random;

    @Before
    public void init() {
        broker = new GenericURIBroker();
        broker.setServerURI("http://taobao.com/hello");

        random = new Randomize();
        broker.addInterceptor(random);
View Full Code Here

        assertEquals("http://localhost/", uri.setServerPort(80).render());
        assertEquals("https://localhost/", uri.setServerScheme("https").render());
        assertEquals("http://localhost/aa/bb", uri.addPath("aa").addPath("bb").render());

        // fork
        GenericURIBroker newUri = (GenericURIBroker) uri.setServerURI("http://www.taobao.com/aa/bb").fork();

        assertEquals("http://www.taobao.com/aa/bb/cc", newUri.addPath("cc").render());
        assertEquals("http://www.taobao.com/aa/bb/dd", newUri.addPath("dd").render());
    }
View Full Code Here

TOP

Related Classes of com.alibaba.citrus.service.uribroker.uri.GenericURIBroker

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.