Package com.volantis.mcs.eclipse.common.odom.xpath

Examples of com.volantis.mcs.eclipse.common.odom.xpath.ODOMXPath.create()


            final ODOMXPath createPath =
                        new ODOMXPath(sourceToTargetPath, newAttribute);

            // This just creates an EMPTY attribute.......
            final ODOMAttribute createdAttribute =
                        (ODOMAttribute) createPath.
                        create(sourceElement, odomFactory);

            // ....but in doing so it might have created us a new target:
            // first check whether it was originally null
            if (targetElement == null) {
View Full Code Here


     * Test the creation of an ODOMXPath when node exists.
     */
    public void testCreateNodeExists() throws Exception {
        // Check when element exists
        ODOMXPath path = new ODOMXPath("cd[2]");
        ODOMObservable result = path.create((ODOMElement) root, factory);
        assertNull("Result should be null", result);

        // Check when attribute exists
        path = new ODOMXPath("cd[2]/@country");
        result = path.create((ODOMElement) root, factory);
View Full Code Here

        ODOMObservable result = path.create((ODOMElement) root, factory);
        assertNull("Result should be null", result);

        // Check when attribute exists
        path = new ODOMXPath("cd[2]/@country");
        result = path.create((ODOMElement) root, factory);
        assertNull("Result should be null", result);

        // Check when text exists
        path = new ODOMXPath("cd[2]/title/text()");
        result = path.create((ODOMElement) root, factory);
View Full Code Here

        result = path.create((ODOMElement) root, factory);
        assertNull("Result should be null", result);

        // Check when text exists
        path = new ODOMXPath("cd[2]/title/text()");
        result = path.create((ODOMElement) root, factory);
        assertNull("Result should be null", result);
    }


    /**
 
View Full Code Here

     */
    public void testCreateNodeTooGeneral() throws Exception {
        // Check when element exists
        ODOMXPath path = new ODOMXPath("cd");
        try {
            path.create((ODOMElement) root, factory);
            fail("Expected an IllegalStateException.");
        } catch (IllegalStateException e) {
        }
    }

View Full Code Here

    public void testCreateElementMultiStep() throws Exception {
        ODOMElement context = (ODOMElement) factory.element("root");
        ODOMXPath path = new ODOMXPath("a/b");

        // Test creation of whole path from empty context
        ODOMObservable newNode = path.create(context, factory);

        assertTrue("New node not an element (is a " +
                   newNode.getClass().getName() + ")",
                   newNode instanceof Element);
View Full Code Here

                     new ODOMXPath(newNode).getExternalForm());

        // Test creation of single additional step
        path = new ODOMXPath(path, "c");

        newNode = path.create(context, factory);

        assertTrue("New node not an element (is a " +
                   newNode.getClass().getName() + ")",
                   newNode instanceof Element);
View Full Code Here

    public void testCreateAttributeMultiStep() throws Exception {
        ODOMElement context = (ODOMElement) factory.element("root");
        ODOMXPath path = new ODOMXPath("a/@b");

        // Test creation of whole path from empty context
        ODOMObservable newNode = path.create(context, factory);

        assertTrue("New node not an attribute (is a " +
                   newNode.getClass().getName() + ")",
                   newNode instanceof Attribute);
View Full Code Here

                     new ODOMXPath(newNode).getExternalForm());

        // Test creation of single additional step
        path = new ODOMXPath("a/@c");

        newNode = path.create(context, factory);

        assertTrue("New node not an attribute (is a " +
                   newNode.getClass().getName() + ")",
                   newNode instanceof Attribute);
View Full Code Here

    public void testCreateTextMultiStep() throws Exception {
        ODOMElement context = (ODOMElement) factory.element("root");
        ODOMXPath path = new ODOMXPath("a/b/text()");

        // Test creation of whole path from empty context
        ODOMObservable newNode = path.create(context, factory);

        assertTrue("New node not text (is a " +
                   newNode.getClass().getName() + ")",
                   newNode instanceof Text);
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.