Package org.apache.synapse.config

Examples of org.apache.synapse.config.SynapseConfiguration


    }

    public void testHostBasedAPIDispatch() throws Exception {
        API api = new API(TEST_API, "/test");
        api.setHost("synapse.apache.org");
        SynapseConfiguration synapseConfig = new SynapseConfiguration();
        synapseConfig.addAPI(TEST_API, api);

        RESTRequestHandler handler = new RESTRequestHandler();

        // Messages that don't have the proper host set should not be dispatched
        MessageContext synCtx = getMessageContext(synapseConfig, false, "/test", "GET");
View Full Code Here


        API api1 = new API(apiName1, "/test");
        API api2 = new API(apiName2, "/dictionary");
        api2.setHost("synapse.apache.org");
        API api3 = new API(apiName3, "/foo/bar");

        SynapseConfiguration synapseConfig = new SynapseConfiguration();
        synapseConfig.addAPI(apiName1, api1);
        synapseConfig.addAPI(apiName2, api2);
        synapseConfig.addAPI(apiName3, api3);

        RESTRequestHandler handler = new RESTRequestHandler();
        MessageContext synCtx = getMessageContext(synapseConfig, false, "/test", "GET");
        handler.process(synCtx);
        assertEquals(apiName1, synCtx.getProperty(RESTConstants.SYNAPSE_REST_API));
View Full Code Here

    public void testQueryParams() throws Exception {
        API api = new API("TestAPI", "/test");
        Resource resource = new Resource();
        api.addResource(resource);

        SynapseConfiguration synapseConfig = new SynapseConfiguration();
        synapseConfig.addAPI(api.getName(), api);

        RESTRequestHandler handler = new RESTRequestHandler();

        MessageContext synCtx = getMessageContext(synapseConfig, false,
                "/test/admin?a=5&b=10&user=bar", "GET");
View Full Code Here

        SequenceMediator faultSequence = getTestSequence("seq.fault", "seq.fault.value");
        ((PropertyMediator) faultSequence.getChild(0)).setScope("axis2");
        resource.setFaultSequence(faultSequence);
        api.addResource(resource);

        SynapseConfiguration synapseConfig = new SynapseConfiguration();
        synapseConfig.addAPI(api.getName(), api);
        synapseConfig.addSequence("main", getTestSequence("main.in", "main.value"));
        MessageContext synCtx = getMessageContext(synapseConfig, false, "/test/~foo", "GET");
        MessageContextCreatorForAxis2.setSynConfig(synapseConfig);
        MessageContextCreatorForAxis2.setSynEnv(synCtx.getEnvironment());

        org.apache.axis2.context.MessageContext mc = ((Axis2MessageContext) synCtx).getAxis2MessageContext();
View Full Code Here

     *
     * @return
     * @throws Exception
     */
    public MessageContext build() throws Exception {
        SynapseConfiguration testConfig = new SynapseConfiguration();
        // TODO: check whether we need a SynapseEnvironment in all cases
        SynapseEnvironment synEnv
            = new Axis2SynapseEnvironment(new ConfigurationContext(new AxisConfiguration()),
                                          testConfig);
        MessageContext synCtx;
        if (requireAxis2MessageContext) {
            synCtx = new Axis2MessageContext(new org.apache.axis2.context.MessageContext(),
                                             testConfig, synEnv);
        } else {
            synCtx = new TestMessageContext();
            synCtx.setEnvironment(synEnv);
            synCtx.setConfiguration(testConfig);
        }

        for (Map.Entry<String,Entry> mapEntry : entries.entrySet()) {
            testConfig.addEntry(mapEntry.getKey(), mapEntry.getValue());
        }

        XMLStreamReader parser = null;
        if (contentString != null) {
            parser = StAXUtils.createXMLStreamReader(new StringReader(contentString));
View Full Code Here

        Resource resource = new Resource();
        resource.setDispatcherHelper(new URLMappingHelper("/"));
        resource.setInSequence(getTestSequence(PROP_NAME, PROP_VALUE));
        api.addResource(resource);

        SynapseConfiguration synapseConfig = new SynapseConfiguration();
        synapseConfig.addAPI(api.getName(), api);

        RESTRequestHandler handler = new RESTRequestHandler();

        MessageContext synCtx = getMessageContext(synapseConfig, false, "/test", "GET");
        handler.process(synCtx);
View Full Code Here

        Resource resource = new Resource();
        resource.setDispatcherHelper(new URLMappingHelper("/foo/bar/*"));
        resource.setInSequence(getTestSequence(PROP_NAME, PROP_VALUE));
        api.addResource(resource);

        SynapseConfiguration synapseConfig = new SynapseConfiguration();
        synapseConfig.addAPI(api.getName(), api);

        RESTRequestHandler handler = new RESTRequestHandler();

        MessageContext synCtx = getMessageContext(synapseConfig, false, "/test/foo/bar", "GET");
        handler.process(synCtx);
View Full Code Here

        Resource resource = new Resource();
        resource.setDispatcherHelper(new URLMappingHelper("*.jsp"));
        resource.setInSequence(getTestSequence(PROP_NAME, PROP_VALUE));
        api.addResource(resource);

        SynapseConfiguration synapseConfig = new SynapseConfiguration();
        synapseConfig.addAPI(api.getName(), api);

        RESTRequestHandler handler = new RESTRequestHandler();

        MessageContext synCtx = getMessageContext(synapseConfig, false, "/test/foo/bar/index.jsp", "GET");
        handler.process(synCtx);
View Full Code Here

        Resource resource = new Resource();
        resource.setDispatcherHelper(new URLMappingHelper("/foo/bar"));
        resource.setInSequence(getTestSequence(PROP_NAME, PROP_VALUE));
        api.addResource(resource);

        SynapseConfiguration synapseConfig = new SynapseConfiguration();
        synapseConfig.addAPI(api.getName(), api);

        RESTRequestHandler handler = new RESTRequestHandler();

        MessageContext synCtx = getMessageContext(synapseConfig, false, "/test/foo/bar", "GET");
        handler.process(synCtx);
View Full Code Here

        api.addResource(resource1);
        api.addResource(resource2);
        api.addResource(resource3);

        SynapseConfiguration synapseConfig = new SynapseConfiguration();
        synapseConfig.addAPI(api.getName(), api);

        RESTRequestHandler handler = new RESTRequestHandler();

        MessageContext synCtx = getMessageContext(synapseConfig, false, "/test/foo/", "GET");
        handler.process(synCtx);
View Full Code Here

TOP

Related Classes of org.apache.synapse.config.SynapseConfiguration

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.