Package com.volantis.xml.pipeline.sax

Examples of com.volantis.xml.pipeline.sax.XMLProcess


            throws Throwable {

        HTTPRequestOperationProcess process = (HTTPRequestOperationProcess)
                createTestableProcess();
        SAXHandler handler = new SAXHandler();
        XMLProcess consumer = XMLHelpers.createSAXHandlerProcess(handler);

        WebDriverAccessor accessor = createWebDriverAccessor(
                new WebDriverRequestImpl(), new WebDriverResponseImpl());
        XMLPipelineContext context = process.getPipelineContext();
        context.setProperty(WebDriverAccessor.class, accessor, false);
View Full Code Here


    public void testGZIPResponse() throws Exception {
        HTTPRequestOperationProcess process =
                (HTTPRequestOperationProcess) createTestableProcess();

        SAXHandler handler = new SAXHandler();
        XMLProcess consumer = XMLHelpers.createSAXHandlerProcess(handler);
        process.setNextProcess(consumer);

        final String input =
                "<html>" +
                "<head>" +
View Full Code Here

        XMLPipelineContext context = getPipelineContext();
        if (!context.inErrorRecoveryMode()) {
            // run through the list of Transformer handlers and set up the
            // transformations

            XMLProcess cup = new ContextManagerProcess(true);
            cup.setPipeline(getPipeline());
            final XMLProcess next = getNextProcess();
            setNextProcess(cup);
            cup.setNextProcess(next);

            TransformerHandler transformerHandler = null;
            ContentHandler handler = getNextProcess();
View Full Code Here

        // todo this is commented out since the mechanism to associate a the 'base' attribute with any element isn't catered for by the current framework.
        //        boolean baseuriExists = configuration.getConverterConfiguration().
        //                getTuples(NamespaceSupport.XMLNS,
        //                        ContextManagerProcess.BASE_ATTRIBUTE) != null;
        //        if (!baseuriExists) {
        XMLProcess cup = getPipelineContext().
                getPipelineFactory().createContextUpdatingProcess();
        cup.setPipeline(getPipeline());
        cup.setNextProcess(next);
        setNextProcess(cup);
        //        }

    }
View Full Code Here

        XMLPipelineContext context = process.getPipelineContext();

        SAXHandler saxHandler = new SAXHandler();

        XMLProcess next = XMLHelpers.createSAXHandlerProcess(saxHandler);

        process.setNextProcess(next);

        // Setup the operation and message.
        WSDLOperation operation = new WSDLOperation();
View Full Code Here

     * If it isn't required this method will return null.
     *
     * @return the newly created URL rewrite process, null if not required.
     */
    private XMLProcess createURLRewriterProcess(String redirectURL) {
        XMLProcess process = null;
        if (redirectURL != null && getFollowRedirects()) {
            URLRewriteProcessConfiguration urlRewriteConfig =
                    new URLRewriteProcessConfiguration();

            ConverterConfiguration convertConfig =
View Full Code Here

        // We aim to have the following process(es) in the pipeline
        // WDProcess -> CUP -> [[URLRewriteProcess] | [Pipeline]] -> next
        // where URLRewriteProcess is chained to its own CUP setup in
        // its setPipeline() method.
        XMLProcess nextProcess = next;

        // If the configuration has the the 'responseContainsPipelineMarkup'
        // flag set, then we need to create a pipeline and insert it before
        // the next process (which could be the URLRewriteProcess or next
        if (configuration.getResponseContainsPipelineMarkup()) {
            XMLPipeline pipeline = getPipelineContext().getPipelineFactory().
                    createDynamicPipeline(getPipelineContext());
            XMLProcess pipelineProcess = pipeline.getPipelineProcess();
            pipelineProcess.setNextProcess(nextProcess);
            nextProcess = pipelineProcess;
        }

        if (redirectURL != null) {
            if (redirectURL.indexOf("://") == -1) {
                // We have been redirected to a relative url. In
                // this case there is no need to rewrite relative urls
                redirectURL = null;
            } else {
                // We need to set redirectURL to its prefex i.e.
                // remove the resource part if there is one.
                if (hasResource(redirectURL)) {
                    int index = redirectURL.lastIndexOf('/');
                    redirectURL = redirectURL.substring(0, index);
                }
            }
        }
        // We want the URLRewrite process to appear immediately after the
        // CUP so that
        XMLProcess urlRewriteProcess = createURLRewriterProcess(redirectURL);
        if (urlRewriteProcess != null) {
            // Only add the url rewriter process to the pipeline if
            // the process returned is not null. This process is chained
            // to the cup process so that its ouput will be returned
            // to the cup.
            urlRewriteProcess.setNextProcess(nextProcess);
            urlRewriteProcess.setPipeline(getPipeline());
            nextProcess = urlRewriteProcess;
        }
        // Always create the cup process. Note that this won't always be
        // the case. See the comments in URLRewriteProcess.
        XMLProcess cup = getPipelineContext().
                getPipelineFactory().createContextUpdatingProcess();
        cup.setPipeline(getPipeline());

        // Chain the cup to the next process (which may be the URLRewrite
        // process OR Pipeline OR next in that order).
        cup.setNextProcess(nextProcess);
        setNextProcess(cup);

        source.setSystemId(getUrlString());
        conditioner.condition(source, cup);
    }
View Full Code Here

    }

        // javadoc inherited
    public void testStartElement() throws Exception {
        // create an instance of the class that is to be tested
        XMLProcess process = createTestableProcess();
       
        // create a "base" URI
        URL baseURI = null;
        try {
            baseURI = new URL("http://foo.com");
        } catch (MalformedURLException e) {
            fail("Could not construct a java.net.URL instance");
        }

        String localName = "localName";
        String namespaceURI = "";
        String qName = localName;

        AttributesImpl atts = new AttributesImpl();
        atts.addAttribute(NamespaceSupport.XMLNS,
                          "base",
                          "xml:base",
                          "String",
                          baseURI.toExternalForm());
       
        // set the next process
        XMLProcessTestable next = new XMLProcessTestable();
        process.setNextProcess(next);
       
        // invoke the method that is being tested
        process.startElement(namespaceURI, localName, qName, atts);
       
        // get hold of the current base uri from the pipeline context
        URL currentBase =
                process.getPipeline().getPipelineContext().getCurrentBaseURI();
       
        // ensure that the XMLPipelineContext is updated with the new base
        assertEquals(
                "XMLPipelineContext should have had its base uri updated",
                baseURI,
View Full Code Here

    }

    // javadoc inherited
    public void testEndElement() throws Exception {
        // create an instance of the class that is to be tested
        XMLProcess process = createTestableProcess();
               
        // create a "base" URI
        URL baseURI = null;
        try {
            baseURI = new URL("http://foo.com");
        } catch (MalformedURLException e) {
            fail("Could not construct a java.net.URL instance");
        }
       
        // ensure the pipeline context has a current base uri
        XMLPipelineContext context
                = process.getPipeline().getPipelineContext();
        context.pushBaseURI(baseURI.toExternalForm());

        String localName = "localName";
        String namespaceURI = "";
        String qName = localName;               
       
        // set the next process
        XMLProcessTestable next = new XMLProcessTestable();
        process.setNextProcess(next);
       
        // invoke the method that is being tested
        process.endElement(namespaceURI, localName, qName);
       
        // retrieve the current base
        URL base =
                process.getPipeline().getPipelineContext().getCurrentBaseURI();
        // ensure that the base uri is null
        assertNull("XMLPipelineContext should have had its base uri popped",
                   base);
       
        // ensure that the event is forwarded to the next process
View Full Code Here

    }

    // javadoc inherited
    public void testSetDocumentLocator() throws Exception {
        // create an instance of the class that is to be tested
        XMLProcess process = createTestableProcess();
       
        // create a locator
        LocatorImpl locator = new LocatorImpl();
       
        // create a "base" URI
        URL baseURI = null;
        try {
            baseURI = new URL("http://foo.com");
        } catch (MalformedURLException e) {
            fail("Could not construct a java.net.URL instance");
        }
       
        // update the locator with the location
        locator.setSystemId(baseURI.toExternalForm());
       
        // set the next process
        XMLProcessTestable next = new XMLProcessTestable();
        process.setNextProcess(next);
       
        // invoke the method that is being tested
        process.setDocumentLocator(locator);       
        process.startDocument();
       
        // get hold of the current base uri from the pipeline context
        URL currentBase =
                process.getPipeline().getPipelineContext().getCurrentBaseURI();
       
        // ensure that the XMLPipelineContext is updated with the new base
        assertEquals(
                "XMLPipelineContext should have had its base uri updated",
                baseURI,
                currentBase);
       
        // get hold of the current locator from the pipeline context
        Locator currentLocator =
                process.getPipeline().getPipelineContext().getCurrentLocator();
       
        // ensure that the XMLPipelineContexts stack of locators is updated
        assertSame(
                "XMLPipelineContext should have the current locator updated",
                locator,
View Full Code Here

TOP

Related Classes of com.volantis.xml.pipeline.sax.XMLProcess

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.