Package hu.sztaki.ilab.longneck.process.block

Examples of hu.sztaki.ilab.longneck.process.block.If


       
        // Load document
        Document doc = documentBuilder.parse(classLoader.getResourceAsStream("unmarshal/if.xml"));
       
        LongneckProcess process = (LongneckProcess) unmarshaller.unmarshal(doc);
        If testedIf = (If) process.getBlocks().get(0);
       
        Assert.assertEquals(2, testedIf.getCondition().getConstraints().size());
        Assert.assertEquals(nncApplyTo, ((NotNullConstraint) testedIf.getCondition().getConstraints().get(0)).getApplyTo());
        Assert.assertEquals(incApplyTo, ((IsNullConstraint) testedIf.getCondition().getConstraints().get(1)).getApplyTo());

        Assert.assertEquals(1, testedIf.getThenBranch().getBlocks().size());
        Assert.assertEquals(copy1ApplyTo, ((Copy) testedIf.getThenBranch().getBlocks().get(0)).getApplyTo());
        Assert.assertEquals("a", ((Copy) testedIf.getThenBranch().getBlocks().get(0)).getFrom());

        Assert.assertEquals(1, testedIf.getElseBranch().getBlocks().size());
        Assert.assertEquals(copy2ApplyTo, ((Copy) testedIf.getElseBranch().getBlocks().get(0)).getApplyTo());
        Assert.assertEquals("b", ((Copy) testedIf.getElseBranch().getBlocks().get(0)).getFrom());       
    }
View Full Code Here


       
        // Create an if sequence
        Sequence seq = new Sequence();
        seq.setSourceInfo(new SourceInfo("file:///dummy.xml", null, 1, 1, 0));
        far.put(seq);
        If ifBlock = new If();
        seq.setBlocks(Arrays.asList(new Block[] { ifBlock }));
       
        EqualsConstraint equals = new EqualsConstraint();
        equals.setApplyTo("a");
        equals.setValue("aaa");
        ifBlock.setConstraints(Arrays.asList(new Constraint[] { equals }));
       
        Sequence thenBranch = new Sequence();
        thenBranch.setSourceInfo(new SourceInfo("file:///dummy.xml", null, 2, 2, 0));
        far.put(thenBranch);
        Set setbThen = new Set();
        setbThen.setSourceInfo(new SourceInfo("file:///dummy.xml", null, 3, 3, 0));
        setbThen.setApplyTo("b");
        setbThen.setValue("then");       
        thenBranch.setBlocks(Arrays.asList(new Block[] { setbThen }));
        ifBlock.setThenBranch(thenBranch);
       
        Sequence elseBranch = new Sequence();
        elseBranch.setSourceInfo(new SourceInfo("file:///dummy.xml", null, 4, 4, 0));
        far.put(elseBranch);
        Set setbElse = new Set();
        setbElse.setSourceInfo(new SourceInfo("file:///dummy.xml", null, 5, 5, 0));
        setbElse.setApplyTo("b");
        setbElse.setValue("else");       
        elseBranch.setBlocks(Arrays.asList(new Block[] { setbElse }));
        ifBlock.setElseBranch(elseBranch);

        return seq;
    }
View Full Code Here

TOP

Related Classes of hu.sztaki.ilab.longneck.process.block.If

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.