Package org.apache.excalibur.source.impl

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 = parser.parse(source.getInputStream());
        Element datatypeElement = (Element) sourceDoc.getElementsByTagNameNS(Constants.DEFINITION_NS, "convertor").item(0);
        Datatype datatype = datatypeManager.createDatatype(datatypeElement, false);
        DynamicSelectionList list =
            new DynamicSelectionList(datatype, null, serviceManager);
        list.generateSaxFragment(dest, Locale.ENGLISH, source);
        ResourceSource expectedSource =
            new ResourceSource("resource://org/apache/cocoon/forms/datatype/DynamicSelectionListTestCase.dest.xml");
        Document expected = parser.parse(expectedSource.getInputStream());
        assertEqual("Test if output is what is expected",
                expected, dest.getDocument());
    }
View Full Code Here


        Map objectModel = new HashMap();
        objectModel.put(ObjectModelHelper.REQUEST_OBJECT, request);
        Map contextObjectModel = new HashMap();
        contextObjectModel.put(ContextHelper.CONTEXT_OBJECT_MODEL, objectModel);
        Context context = new DefaultContext(contextObjectModel);
        Source sampleSource = new ResourceSource("resource://org/apache/cocoon/woody/datatype/FlowJXPathSelectionListTestCase.source.xml");
        Document sample = parser.parse(sampleSource.getInputStream());
        Element datatypeElement = (Element) sample.getElementsByTagNameNS(Constants.WD_NS, "datatype").item(0);
        Datatype datatype = datatypeManager.createDatatype(datatypeElement, false);
        FlowJXPathSelectionList list = new FlowJXPathSelectionList
            (context, "beans", "key", "value", datatype);
        DOMBuilder dest = new DOMBuilder();
        list.generateSaxFragment(dest, Locale.ENGLISH);
        Source expectedSource = new ResourceSource("resource://org/apache/cocoon/woody/datatype/FlowJXPathSelectionListTestCase.dest.xml");
        Document expected = parser.parse(expectedSource.getInputStream());
        assertEqual("Test if generated list matches expected",
            expected, dest.getDocument());
    }
View Full Code Here

        Map objectModel = new HashMap();
        objectModel.put(ObjectModelHelper.REQUEST_OBJECT, request);
        Map contextObjectModel = new HashMap();
        contextObjectModel.put(ContextHelper.CONTEXT_OBJECT_MODEL, objectModel);
        Context context = new DefaultContext(contextObjectModel);
        Source sampleSource = new ResourceSource("resource://org/apache/cocoon/woody/datatype/FlowJXPathSelectionListTestCase.source.xml");
        Document sample = parser.parse(sampleSource.getInputStream());
        Element datatypeElement = (Element) sample.getElementsByTagNameNS(Constants.WD_NS, "datatype").item(0);
        Datatype datatype = datatypeManager.createDatatype(datatypeElement, false);
        FlowJXPathSelectionList list = new FlowJXPathSelectionList
            (context, "beans", "key", "value", datatype);
        DOMBuilder dest = new DOMBuilder();
        list.generateSaxFragment(dest, Locale.ENGLISH);
        Source expectedSource = new ResourceSource("resource://org/apache/cocoon/woody/datatype/FlowJXPathSelectionListTestCaseWithNull.dest.xml");
        Document expected = parser.parse(expectedSource.getInputStream());
        assertEqual("Test if generated list matches expected",
                expected, dest.getDocument());
    }
View Full Code Here

    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/woody/datatype/EnumSelectionListTestCase.dest-no-null.xml");
        Document expected = parser.parse(expectedSource.getInputStream());
        assertEqual("Test if output is what is expected",
                expected, dest.getDocument());
    }
View Full Code Here

    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/woody/datatype/EnumSelectionListTestCase.dest.xml");
        Document expected = parser.parse(expectedSource.getInputStream());
        assertEqual("Test if output is what is expected",
                expected, dest.getDocument());
    }
View Full Code Here

     * Test the {@link EnumConvertorBuilder#build(org.w3c.dom.Element)
     * build} method.
     * @throws Exception
     */
    public void testBuild() throws Exception {
        Source confSource = new ResourceSource("resource://org/apache/cocoon/woody/datatype/convertor/EnumConvertorTestCase.conf.xml");
        Document sample = parser.parse(confSource.getInputStream());
        Element convertorElement = (Element) sample.getElementsByTagNameNS(Constants.WD_NS, "convertor").item(0);
        String enumClassName = convertorElement.getElementsByTagNameNS(Constants.WD_NS, "enum").item(0).getFirstChild().getNodeValue();
        EnumConvertorBuilder builder = new EnumConvertorBuilder();
        Convertor convertor = builder.build(convertorElement);
        assertTrue("The returned convertor is not an EnumConvertor",
View Full Code Here

        FlowHelper.setContextObject(objectModel, flowContextObject);
        objectModel.put(ObjectModelHelper.REQUEST_OBJECT, request);
        Map contextObjectModel = new HashMap();
        contextObjectModel.put(ContextHelper.CONTEXT_OBJECT_MODEL, objectModel);
        Context context = new DefaultContext(contextObjectModel);
        Source sampleSource = new ResourceSource("resource://org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.source.xml");
        Document sample = this.parser.parse(sampleSource.getInputStream());
        Element datatypeElement = (Element) sample.getElementsByTagNameNS(FormsConstants.DEFINITION_NS, "datatype").item(0);
        Datatype datatype = this.datatypeManager.createDatatype(datatypeElement, false);
        FlowJXPathSelectionList list = new FlowJXPathSelectionList
            (context, "beans", "key", "value", datatype,null,false,null,false);
        DOMBuilder dest = new DOMBuilder();
        list.generateSaxFragment(dest, Locale.ENGLISH);
        Source expectedSource = new ResourceSource("resource://org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.dest.xml");
        Document expected = this.parser.parse(expectedSource.getInputStream());
        Document destDocument = dest.getDocument();
        assertEqual("Test if generated list matches expected",
            expected, destDocument);
    }
View Full Code Here

        FlowHelper.setContextObject(objectModel, flowContextObject);
        objectModel.put(ObjectModelHelper.REQUEST_OBJECT, request);
        Map contextObjectModel = new HashMap();
        contextObjectModel.put(ContextHelper.CONTEXT_OBJECT_MODEL, objectModel);
        Context context = new DefaultContext(contextObjectModel);
        Source sampleSource = new ResourceSource("resource://org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCase.source.xml");
        Document sample = this.parser.parse(sampleSource.getInputStream());
        Element datatypeElement = (Element) sample.getElementsByTagNameNS(FormsConstants.DEFINITION_NS, "datatype").item(0);
        Datatype datatype = this.datatypeManager.createDatatype(datatypeElement, false);
        FlowJXPathSelectionList list = new FlowJXPathSelectionList
            (context, "beans", "key", "value", datatype,null,false,null,false);
        DOMBuilder dest = new DOMBuilder();
        list.generateSaxFragment(dest, Locale.ENGLISH);
        Source expectedSource = new ResourceSource("resource://org/apache/cocoon/forms/datatype/FlowJXPathSelectionListTestCaseWithNull.dest.xml");
        Document expected = this.parser.parse(expectedSource.getInputStream());
        Document destDocument = dest.getDocument();
        assertEqual("Test if generated list matches expected",
                expected, destDocument);
    }
View Full Code Here

    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

    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

TOP

Related Classes of org.apache.excalibur.source.impl.ResourceSource

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.