Package org.metagrid.gatekeeper.node

Examples of org.metagrid.gatekeeper.node.Node


    public void update(final ServiceRequest request)
        {
        log.debug("ServiceRequestHandlerImpl.update()");
        log.debug("URI [" + request.uri() + "]");
        try {
            Node node = this.updator.read(
                request.reader(),
                new URIHandler()
                    {
                    public URI uri(URI ident)
                        {
View Full Code Here


            inner
            );

        //
        // Create the proxy node.
        Node created = outer.create(
            URI.create("urn:node/000"),
            URI.create("urn:type/created")
            );

        //
        // Check the created node property.
        assertEquals(
            "0",
            created.properties().get(
                CountedNodeServer.SERIAL_PROPERTY_URI
                ).value()
            );

        //
        // Re-request the node.
        Node selected = outer.select(
            created.ident()
            );

        //
        // Check the node properties.
        assertEquals(
            "1",
            created.properties().get(
                CountedNodeServer.SERIAL_PROPERTY_URI
                ).value()
            );
        assertEquals(
            "1",
            selected.properties().get(
                CountedNodeServer.SERIAL_PROPERTY_URI
                ).value()
            );

        //
        // Check they are the same thing.
        assertEquals(
            created,
            selected
            );
        assertSame(
            created,
            selected
            );

        //
        // Update the node.
        Node updated = outer.update(
            created.ident(),
            new SimpleDateProperty(
                created,
                URI.create("urn:property/timestamp"),
                new Date()
                )
            );

        assertEquals(
            "2",
            created.properties().get(
                CountedNodeServer.SERIAL_PROPERTY_URI
                ).value()
            );
        assertEquals(
            "2",
            selected.properties().get(
                CountedNodeServer.SERIAL_PROPERTY_URI
                ).value()
            );
        assertEquals(
            "2",
            updated.properties().get(
                CountedNodeServer.SERIAL_PROPERTY_URI
                ).value()
            );

        //
        // Update the node.
        selected.properties().set(
            URI.create("urn:property/colour"),
            "green"
            );

        assertEquals(
            "green",
            created.properties().get(
                URI.create("urn:property/colour")
                ).value()
            );
        assertEquals(
            "green",
            selected.properties().get(
                URI.create("urn:property/colour")
                ).value()
            );
        assertEquals(
            "green",
            updated.properties().get(
                URI.create("urn:property/colour")
                ).value()
            );

        assertEquals(
            "3",
            created.properties().get(
                CountedNodeServer.SERIAL_PROPERTY_URI
                ).value()
            );
        assertEquals(
            "3",
            selected.properties().get(
                CountedNodeServer.SERIAL_PROPERTY_URI
                ).value()
            );
        assertEquals(
            "3",
            updated.properties().get(
                CountedNodeServer.SERIAL_PROPERTY_URI
                ).value()
            );

        }
View Full Code Here

TOP

Related Classes of org.metagrid.gatekeeper.node.Node

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.