Examples of ResourceSource


Examples of org.apache.excalibur.source.impl.ResourceSource

    public void testGenerateSaxFragment() throws Exception {
        DOMBuilder dest = new DOMBuilder();
        EnumSelectionList list =
            new EnumSelectionList(Sex.class.getName(), new EnumType(), false);
        list.generateSaxFragment(dest, Locale.ENGLISH);
        ResourceSource expectedSource =
            new ResourceSource("resource://org/apache/cocoon/forms/datatype/EnumSelectionListTestCase.dest-no-null.xml");
        Document expected = this.parser.parse(expectedSource.getInputStream());
        Document destDocument = dest.getDocument();
        assertEqual("Test if output is what is expected",
                expected, destDocument);
    }
View Full Code Here

Examples of org.apache.excalibur.source.impl.ResourceSource

    public void testGenerateSaxFragmentNullable() throws Exception {
        DOMBuilder dest = new DOMBuilder();
        EnumSelectionList list =
            new EnumSelectionList(Sex.class.getName(), new EnumType(), true);
        list.generateSaxFragment(dest, Locale.ENGLISH);
        ResourceSource expectedSource =
            new ResourceSource("resource://org/apache/cocoon/forms/datatype/EnumSelectionListTestCase.dest.xml");
        Document expected = this.parser.parse(expectedSource.getInputStream());
        Document destDocument = dest.getDocument();
        assertEqual("Test if output is what is expected",
                expected, destDocument);
    }
View Full Code Here

Examples of org.apache.excalibur.source.impl.ResourceSource

     * @throws MalformedURLException
     * @throws ParserConfigurationException
     */
    public void testGenerateSaxFragment() throws Exception {
        DOMBuilder dest = new DOMBuilder();
        ResourceSource source =
            new ResourceSource("resource://org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.source.xml");
        Document sourceDoc = this.parser.parse(source.getInputStream());
        Element datatypeElement = (Element) sourceDoc.getElementsByTagNameNS(FormsConstants.DEFINITION_NS, "convertor").item(0);
        Datatype datatype = this.datatypeManager.createDatatype(datatypeElement, false);
        DynamicSelectionList list =
            new DynamicSelectionList(datatype, null, this.getManager());
        list.generateSaxFragment(dest, Locale.ENGLISH, source);
        ResourceSource expectedSource =
            new ResourceSource("resource://org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.dest.xml");
        Document expected = this.parser.parse(expectedSource.getInputStream());
        assertEqual("Test if output is what is expected",
                expected, dest.getDocument());
    }
View Full Code Here

Examples of org.apache.servicemix.jbi.jaxp.ResourceSource

        if (responseContent == null) {
            if (responseXml != null) {
                responseContent = new StringSource(responseXml);
            }
            else if (responseResource != null) {
                return new ResourceSource(responseResource);
            }
        }
        return responseContent;
    }
View Full Code Here

Examples of org.servicemix.jbi.jaxp.ResourceSource

        if (responseContent == null) {
            if (responseXml != null) {
                responseContent = new StringSource(responseXml);
            }
            else if (responseResource != null) {
                return new ResourceSource(responseResource);
            }
        }
        return responseContent;
    }
View Full Code Here

Examples of org.springframework.xml.transform.ResourceSource

        interceptor.setRequestXslt(xslt);
        interceptor.afterPropertiesSet();
        MessageFactory messageFactory = MessageFactory.newInstance();
        SOAPMessage saajMessage = messageFactory.createMessage();
        SaajSoapMessage message = new SaajSoapMessage(saajMessage);
        transformer.transform(new ResourceSource(input), message.getPayloadResult());
        MessageContext context = new DefaultMessageContext(message, new SaajSoapMessageFactory(messageFactory));

        Assert.assertTrue("Invalid interceptor result", interceptor.handleRequest(context, null));
        StringResult expected = new StringResult();
        transformer.transform(new SAXSource(SaxUtils.createInputSource(output)), expected);
View Full Code Here

Examples of org.springframework.xml.transform.ResourceSource

    public void testPox() throws Exception {
        interceptor.setRequestXslt(xslt);
        interceptor.afterPropertiesSet();
        DomPoxMessageFactory factory = new DomPoxMessageFactory();
        DomPoxMessage message = factory.createWebServiceMessage();
        transformer.transform(new ResourceSource(input), message.getPayloadResult());
        MessageContext context = new DefaultMessageContext(message, factory);

        Assert.assertTrue("Invalid interceptor result", interceptor.handleRequest(context, null));
        StringResult expected = new StringResult();
        transformer.transform(new SAXSource(SaxUtils.createInputSource(output)), expected);
View Full Code Here

Examples of org.springframework.xml.transform.ResourceSource

        if (requestXslt != null) {
            Assert.isTrue(requestXslt.exists(), "requestXslt \"" + requestXslt + "\" does not exit");
            if (logger.isInfoEnabled()) {
                logger.info("Transforming request using " + requestXslt);
            }
            Source requestSource = new ResourceSource(xmlReader, requestXslt);
            requestTemplates = transformerFactory.newTemplates(requestSource);
        }
        if (responseXslt != null) {
            Assert.isTrue(responseXslt.exists(), "responseXslt \"" + responseXslt + "\" does not exit");
            if (logger.isInfoEnabled()) {
                logger.info("Transforming response using " + responseXslt);
            }
            Source responseSource = new ResourceSource(xmlReader, responseXslt);
            responseTemplates = transformerFactory.newTemplates(responseSource);
        }
    }
View Full Code Here

Examples of org.springframework.xml.transform.ResourceSource

        XMLReader xmlReader = XMLReaderFactory.createXMLReader();
        xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
        for (int i = 0; i < resources.length; i++) {
            Assert.notNull(resources[i], "Resource is null");
            Assert.isTrue(resources[i].exists(), "Resource " + resources[i] + " does not exist");
            schemaSources[i] = new ResourceSource(xmlReader, resources[i]);
        }
        SchemaFactory schemaFactory = SchemaFactory.newInstance(schemaLanguage);
        return schemaFactory.newSchema(schemaSources);
    }
View Full Code Here

Examples of org.springframework.xml.transform.ResourceSource

     * @param payload the XML payload
     * @return the request matcher
     */
    public static RequestMatcher payload(Resource payload) throws IOException {
        Assert.notNull(payload, "'payload' must not be null");
        return payload(new ResourceSource(payload));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.