Package org.teiid.query.mapping.xml

Examples of org.teiid.query.mapping.xml.MappingChoiceNode


        MappingElement element = new MappingElement("Test"); //$NON-NLS-1$
       
        element.addCommentNode(new MappingCommentNode("this is comment text")); //$NON-NLS-1$
        element.addAttribute(new MappingAttribute("foo", "fooReal")); //$NON-NLS-1$ //$NON-NLS-2$
        element.addChildElement(new MappingElement("child1")); //$NON-NLS-1$
        element.addChoiceNode(new MappingChoiceNode());
        element.addSequenceNode(new MappingSequenceNode());
        element.addAllNode(new MappingAllNode());
       
        assertEquals(5, element.getNodeChildren().size());
        assertEquals(1, element.getAttributes().size());
View Full Code Here


* Test class for MappingChoiceNode
*/
public class TestMappingChoiceNode extends TestCase {

    public void testChoice() {
        MappingChoiceNode choice = new MappingChoiceNode();
        assertFalse(choice.throwExceptionOnDefault());
       
        choice = new MappingChoiceNode(true);
        assertTrue(choice.throwExceptionOnDefault());       
    }
View Full Code Here

        assertTrue(choice.throwExceptionOnDefault());       
    }
   
    public void testAddWrongChoice() {
       
        MappingChoiceNode choice = new MappingChoiceNode();
       
        try {
            choice.addAllNode(new MappingAllNode());
            fail("must have failed to add"); //$NON-NLS-1$
        }catch(RuntimeException e) {           
        }
       
        try {
            choice.addSequenceNode(new MappingSequenceNode());
            fail("must have failed to add"); //$NON-NLS-1$
        }catch(RuntimeException e) {           
        }

        try {
            choice.addChildElement(new MappingElement("foo")); //$NON-NLS-1$
            fail("must have failed to add"); //$NON-NLS-1$
        }catch(RuntimeException e) {           
        }

        try {
            choice.addChoiceNode(new MappingChoiceNode());
            fail("must have failed to add"); //$NON-NLS-1$
        }catch(RuntimeException e) {           
        }           
    }
View Full Code Here

        }           
    }
   
   
    public void testAddCriteria() {
        MappingChoiceNode choice = new MappingChoiceNode();
       
        choice.addCriteriaNode(new MappingCriteriaNode("chooseme > ?", false)); //$NON-NLS-1$
       
        // default node
        MappingCriteriaNode c2 = new MappingCriteriaNode();
        choice.addCriteriaNode(c2);
       
       assertTrue(choice.getDefaultNode() == c2);
    }
View Full Code Here

       
       assertTrue(choice.getDefaultNode() == c2);
    }
   
    public void testWithoutCriteria() {
        MappingChoiceNode choice = new MappingChoiceNode();
       
        try {
            choice.addCriteriaNode(new MappingCriteriaNode().setAsDefault(false))
            fail("must have failed to add"); //$NON-NLS-1$
        }catch(RuntimeException e) {
        }
       
    }
View Full Code Here

            "</xmlMapping>"; //$NON-NLS-1$
       
       
        MappingDocument doc = new MappingDocument(false);
        MappingElement element = doc.addChildElement(new MappingElement("parentNode")); //$NON-NLS-1$
        MappingChoiceNode choice = element.addChoiceNode(new MappingChoiceNode(true));
        MappingCriteriaNode criteria = choice.addCriteriaNode(new MappingCriteriaNode("childNodeCriteria", false)); //$NON-NLS-1$
        criteria.addChildElement(new MappingElement("childNode")); //$NON-NLS-1$

        String savedXML = saveMappingDocument(doc);
       
        assertEquals(expected, savedXML);       
View Full Code Here

TOP

Related Classes of org.teiid.query.mapping.xml.MappingChoiceNode

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.