Package org.metagrid.gatekeeper.common.io.test

Examples of org.metagrid.gatekeeper.common.io.test.StringResource


                {
                public void run()
                    throws Exception
                    {
                    reader.read(
                        new StringResource(
                            "<frog xmlns='urn:metagrid'></frog>"
                            ).reader()
                        );
                    }
                }
            );
        //
        // Try parsing a known element.
        assertNotNull(
            reader.read(
                new StringResource(
                    "<node xmlns='urn:metagrid'></node>"
                    ).reader()
                )
            );
        }
View Full Code Here


                {
                public void run()
                    throws Exception
                    {
                    reader.read(
                        new StringResource(
                            "<node xmlns='urn:metagrid'></node>"
                            ).reader()
                        );
                    }
                }
            );
        //
        // Try parsing a known element.
        assertNotNull(
            reader.read(
                new StringResource(
                    "<frog xmlns='urn:metagrid'></frog>"
                    ).reader()
                )
            );
        }
View Full Code Here

            AppleNode.WEIGHT_PROPERTY_URI,
            "27"
            );
        //
        // Create our target resource.
        StringResource resource = new StringResource(
            "test data"
            );
        //
        // Create our Node writer.
        XMLNodeWriter<Node> writer = new XMLNodeWriterImpl<Node>();
        //
        // Write the node ....
        writer.write(
            resource,
            node
            );

        log.debug("----");
        log.debug(resource.data());
        log.debug("----");
        }
View Full Code Here

        {

        //
        // Local map of XML resources.
        StringResourceMap resources = new StringResourceMap(
            new StringResource(
                new URI("urn://test/000"),

                "<node xmlns='urn:metagrid' ident='urn://outer/000' type='urn:node.outer.one'>"
                      + "<properties>"
                          + "<property type='urn:test.outer.int'>000</property>"
View Full Code Here

    public void testXMLNodeReader()
    throws Exception
        {
        //
        // Create our XML resource.
        StringResource resource = new StringResource(
            URI.create("urn:test"),
                "<node xmlns='urn:metagrid' ident='urn://apples/001' type='urn:metagrid.apple'>"
              + "  <properties>"
              + "    <property type='urn:metagrid.apple.weight'>27</property>"
              + "    <property type='urn:metagrid.fruit.modified'>2008-11-29T06:25:50.379+0000</property>"
              + "  </properties>"
              + "</node>"
            );
        //
        // Create our AppleBeanFactory.
        final AppleBeanFactory apples = new AppleBeanFactoryImpl();
        //
        // Create our AppleNode server.
        final NodeServer<AppleNode> server = new AppleNodeServerImpl(
            new FruitBeanImpl.StringIdentBuilder<AppleBean>(
                new URI(
                    "urn://apples/"
                    )
                ),
            apples
            );
        //
        // Create our XMLNodeReader.
        final XMLNodeReader<AppleNode> creator = new XMLNodeReaderImpl<AppleNode>(
            server.creator()
            );
        //
        // Parse the node XML.
        AppleNode created = creator.read(
            resource.reader()
            );
        //
        // Check the AppleNode weight.
        assertEquals(
            "27",
View Full Code Here

        {

        //
        // Local map of XML resources.
        StringResourceMap resources = new StringResourceMap(
            new StringResource(
                new URI("urn://test/000"),

                "<node xmlns='urn:metagrid' ident='urn://outer/000' type='urn:node.outer.two'>"
                        + "<properties>"
                            + "<property type='urn:test.outer.int'>000</property>"
View Full Code Here

    public void testParseCreatedProperty()
    throws Exception
        {
        //
        // Create our XML resource.
        final StringResource resource = new StringResource(
            URI.create("urn:test"),
            "<node xmlns='urn:metagrid' ident='urn://apples/001' type='urn:metagrid.apple'>"
            + "  <properties>"
            + "    <property type='urn:metagrid.apple.weight'>27</property>"
            + "    <property type='urn:metagrid.fruit.created'>2008-11-29T06:25:50.379+0000</property>"
            + "  </properties>"
            + "</node>"
            );
        //
        // Create our AppleBeanFactory.
        final AppleBeanFactory apples = new AppleBeanFactoryImpl();
        //
        // Create our AppleNode server.
        final NodeServer<AppleNode> server = new AppleNodeServerImpl(
            new FruitBeanImpl.StringIdentBuilder<AppleBean>(
                new URI(
                    "urn://apples/"
                    )
                ),
            apples
            );
        //
        // Create our XMLNodeReader.
        final XMLNodeReader<AppleNode> creator = new XMLNodeReaderImpl<AppleNode>(
            server.creator()
            );
        //
        // Parse the node XML.
        assertThrows(
            PropertyException.class,
            new TestBlock()
                {
                public void run()
                    throws Exception
                    {
                    creator.read(
                        resource.reader()
                        );
                    }
                }
            );
        }
View Full Code Here

            new XMLPropertyReaderImpl()
            );
        //
        // Parse the test XML.
        reader.read(
            new StringResource(
                  "<properties xmlns='urn:metagrid'>"
                + "  <property type='urn:metagrid/property/type/frog'>property.frog</property>"
                + "  <property type='urn:metagrid/property/type/toad'>property.toad</property>"
                + "</properties>"
                ).reader(),
View Full Code Here

            new XMLPropertyReaderImpl()
            );
        //
        // Parse the test XML.
        reader.read(
            new StringResource(
                  "<!-- skip this comment -->"
                + "<properties xmlns='urn:metagrid'>"
                + "  <!-- skip this comment -->"
                + "  <property type='urn:metagrid/property/type/frog'>property.frog</property>"
                + "  <!-- skip this comment -->"
View Full Code Here

        //
        // Create the Iterable reader.
        log.debug("Creating Iterable");
        Iterable<Node> iterable =
            reader.read(
                new StringResource(
                      "<nodes xmlns='urn:metagrid'>"
                    + "  <node ident='urn:node/001' type='urn:metagrid.node'/>"
                    + "  <node ident='urn:node/002' type='urn:metagrid.node'/>"
                    + "</nodes>"
                    ).reader()
View Full Code Here

TOP

Related Classes of org.metagrid.gatekeeper.common.io.test.StringResource

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.