Package org.emftrace.metamodel.RuleModel

Examples of org.emftrace.metamodel.RuleModel.ElementDefinition


    }
   
    // check of the change type matches the one defined in the rule:
    for(int i = 0; i < rule.getElements().size(); i++)
    {
      ElementDefinition element = rule.getElements().get(i);
     
      if( element.getType().equalsIgnoreCase("AtomicChangeType") || element.getType().equalsIgnoreCase("CompositeChangeType") )
      {         
        String alias = element.getAlias() + "::name";
        String name  = ((AbstractChangeType) startingImpactSet.get(0)).getName();
               
        List<EObject> conditions = accessLayer.getAllChildren(rule.getConditions());
       
        for(int j = 0; j < conditions.size(); j++)
View Full Code Here


    public void testFindElementsForDeletion()
    {
        Rule rule = RuleModelFactory.eINSTANCE.createRule();
        LogicCondition logicCondition = RuleModelFactory.eINSTANCE.createLogicCondition();
        BaseCondition baseCondition = RuleModelFactory.eINSTANCE.createBaseCondition();
        ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
        ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
        e1.setAlias("e1");
        e2.setAlias("e2");
       
        rule.getElements().add(e1);
        rule.getElements().add(e2);
              
        rule.setConditions(logicCondition);
View Full Code Here

        l2.get(1).add(c2);
       
        Rule rule = RuleModelFactory.eINSTANCE.createRule();
        LogicCondition logicCondition = RuleModelFactory.eINSTANCE.createLogicCondition();
        BaseCondition baseCondition = RuleModelFactory.eINSTANCE.createBaseCondition();
        ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
        ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
        e1.setAlias("e1");
        e2.setAlias("e2");
       
        rule.getElements().add(e1);
        rule.getElements().add(e2);
       
        baseCondition.setSource("e2");
View Full Code Here

        result.get(1).add(c2);
       
        Rule rule = RuleModelFactory.eINSTANCE.createRule();
        accessLayer.addElement(project, rule);
       
        ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
        accessLayer.addElement(project, e1);
        ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
        accessLayer.addElement(project, e2);
       
        rule.getElements().add(e1);
        rule.getElements().add(e2);
       
        e1.setAlias("number_1");
        e2.setAlias("number_2");
       
        BaseCondition baseCondition = RuleModelFactory.eINSTANCE.createBaseCondition();
        LogicCondition logicCondition = RuleModelFactory.eINSTANCE.createLogicCondition();
        accessLayer.addElement(project, baseCondition);
        accessLayer.addElement(project, logicCondition);
       
        rule.setConditions(logicCondition);
        logicCondition.getBaseConditions().add(baseCondition);
        logicCondition.setType(LogicConditionType.AND);
        baseCondition.setSource("number_1::Id");
        baseCondition.setTarget("number_2::Id");
       
        List<EObject[]> tuples = new ArrayList<EObject[]>();
       
        // test "EQUALS":
        baseCondition.setType(BaseConditionType.VALUE_EQUALS);       
        assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
        assertEquals(1, result.get(0).size()); // test this once...
        assertEquals(1, result.get(1).size());
        c1.setId("test_addition");
        assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
        assertEquals(0, result.get(0).size());
        assertEquals(0, result.get(1).size());
        result.get(0).clear();
        result.get(0).add(c1);
        result.get(1).clear();
        result.get(1).add(c2);
       
        // test "STARTS_WITH":
        c1.setId("test_bla");
        baseCondition.setType(BaseConditionType.VALUE_STARTS_WITH);       
        assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
        c1.setId("bla");
        assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
        result.get(0).clear();
        result.get(0).add(c1);
        result.get(1).clear();
        result.get(1).add(c2);
       
        // test "ENDS_WITH":
        c1.setId("test");
        baseCondition.setType(BaseConditionType.VALUE_ENDS_WITH);       
        assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
        c1.setId("test_bla");
        assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
        result.get(0).clear();
        result.get(0).add(c1);
        result.get(1).clear();
        result.get(1).add(c2);
       
        // test "CONTAINS":
        c1.setId("test_addition");
        baseCondition.setType(BaseConditionType.VALUE_CONTAINS);       
        assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
        c1.setId("tes");
        assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
        result.get(0).clear();
        result.get(0).add(c1);
        result.get(1).clear();
        result.get(1).add(c2);
       
        // test "SIMILAR_TO"
        conditionProcessor.setCorrelation(0.5f);
        c1.setId("test1");
        baseCondition.setType(BaseConditionType.VALUE_SIMILAR_TO);       
        assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
        c1.setId("tast");
        assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
        result.get(0).clear();
        result.get(0).add(c1);
        result.get(1).clear();
        result.get(1).add(c2);
               
        // test "LESSER_THAN":
        c1.setId("1");
        c2.setId("2");
        baseCondition.setType(BaseConditionType.VALUE_LESSER_THAN);
        assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
        c1.setId("2");
        c2.setId("1");
        assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
        result.get(0).clear();
        result.get(0).add(c1);
        result.get(1).clear();
        result.get(1).add(c2);
       
        // test "GREATER_THAN":
        c1.setId("2");
        c2.setId("1");
        baseCondition.setType(BaseConditionType.VALUE_GREATER_THAN);
        assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
        c1.setId("1");
        c2.setId("2");
        assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
       
        // test "IS_PARENT":
        result.get(0).clear();
        result.get(0).add(rule);
        result.get(1).clear();
        result.get(1).add(baseCondition);
        baseCondition.setSource("number_1");
        baseCondition.setTarget("number_2");
        baseCondition.setType(BaseConditionType.MODEL_PARENT_OF);
        assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
        baseCondition.setSource("number_2");
        baseCondition.setTarget("number_1");
        assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
       
        // test "MODEL_EQUALS":
        baseCondition.setType(BaseConditionType.MODEL_EQUALS);
        baseCondition.setSource("e1::Source");
        baseCondition.setTarget("e2");
       
        e1.setAlias("e1");
        e2.setAlias("e2");
        e1.setType("TraceLink");
        e2.setType("Actor");
       
        TraceLink link  = LinkModelFactory.eINSTANCE.createTraceLink();
        Actor     actor = URNModelFactory.eINSTANCE.createActor();
       
        accessLayer.addElement(project, link);
View Full Code Here

        result.get(1).add(c2);
               
        Rule rule = RuleModelFactory.eINSTANCE.createRule();
        accessLayer.addElement(project, rule);
       
        ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
        accessLayer.addElement(project, e1);
        ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
        accessLayer.addElement(project, e2);
       
        rule.getElements().add(e1);
        rule.getElements().add(e2);
       
        e1.setAlias("number_1");
        e2.setAlias("number_2");
       
        BaseCondition baseCondition1 = RuleModelFactory.eINSTANCE.createBaseCondition();
        BaseCondition baseCondition2 = RuleModelFactory.eINSTANCE.createBaseCondition();
        LogicCondition logicCondition = RuleModelFactory.eINSTANCE.createLogicCondition();
        accessLayer.addElement(project, baseCondition1);
View Full Code Here

    public void testIsParent()
    {
        Rule rule = RuleModelFactory.eINSTANCE.createRule();
        accessLayer.addElement(project, rule);
       
        ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
        accessLayer.addElement(project, e1);
       
        rule.getElements().add(e1);
       
        List<EObject> l1 = new ArrayList<EObject>();
View Full Code Here

        result.get(1).add(c2);
               
        Rule rule = RuleModelFactory.eINSTANCE.createRule();
        accessLayer.addElement(project, rule);
       
        ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
        accessLayer.addElement(project, e1);
        ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
        accessLayer.addElement(project, e2);
       
        rule.getElements().add(e1);
        rule.getElements().add(e2);
       
        e1.setAlias("number_1");
        e2.setAlias("number_2");
       
        BaseCondition baseCondition1 = RuleModelFactory.eINSTANCE.createBaseCondition();
        BaseCondition baseCondition2 = RuleModelFactory.eINSTANCE.createBaseCondition();
        LogicCondition logicCondition = RuleModelFactory.eINSTANCE.createLogicCondition();
        accessLayer.addElement(project, baseCondition1);
View Full Code Here

            result.get(1).add(c2);
           
            Rule rule = RuleModelFactory.eINSTANCE.createRule();
            accessLayer.addElement(project, rule);
           
            ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
            accessLayer.addElement(project, e1);
            ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
            accessLayer.addElement(project, e2);
           
            rule.getElements().add(e1);
            rule.getElements().add(e2);
           
            e1.setAlias("number_1");
            e2.setAlias("number_2");
           
            BaseCondition baseCondition = RuleModelFactory.eINSTANCE.createBaseCondition();
            LogicCondition logicCondition = RuleModelFactory.eINSTANCE.createLogicCondition();
            accessLayer.addElement(project, baseCondition);
            accessLayer.addElement(project, logicCondition);
           
            rule.setConditions(logicCondition);
            logicCondition.getBaseConditions().add(baseCondition);
            logicCondition.setType(LogicConditionType.AND);
            baseCondition.setSource("number_1::Id");
            baseCondition.setTarget("number_2::Id");
           
            List<EObject[]> tuples = new ArrayList<EObject[]>();
           
            // test "EQUALS":
            baseCondition.setType(BaseConditionType.VALUE_EQUALS);       
            assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
            assertEquals(1, result.get(0).size()); // test this once...
            assertEquals(1, result.get(1).size());
            c1.setId("test_addition");
            assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
            assertEquals(0, result.get(0).size());
            assertEquals(0, result.get(1).size());
            result.get(0).clear();
            result.get(0).add(c1);
            result.get(1).clear();
            result.get(1).add(c2);
           
            // test "STARTS_WITH":
            c1.setId("test_bla");
            baseCondition.setType(BaseConditionType.VALUE_STARTS_WITH);       
            assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
            c1.setId("bla");
            assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
            result.get(0).clear();
            result.get(0).add(c1);
            result.get(1).clear();
            result.get(1).add(c2);
           
            // test "ENDS_WITH":
            c1.setId("test");
            baseCondition.setType(BaseConditionType.VALUE_ENDS_WITH);       
            assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
            c1.setId("test_bla");
            assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
            result.get(0).clear();
            result.get(0).add(c1);
            result.get(1).clear();
            result.get(1).add(c2);
           
            // test "CONTAINS":
            c1.setId("test_addition");
            baseCondition.setType(BaseConditionType.VALUE_CONTAINS);       
            assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
            c1.setId("tes");
            assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
            result.get(0).clear();
            result.get(0).add(c1);
            result.get(1).clear();
            result.get(1).add(c2);
           
            // test "SIMILAR_TO"
            c1.setId("test");
            baseCondition.setType(BaseConditionType.VALUE_SIMILAR_TO);       
            assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
            c1.setId("tast");
            assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
            result.get(0).clear();
            result.get(0).add(c1);
            result.get(1).clear();
            result.get(1).add(c2);
                   
            // test "LESSER_THAN":
            c1.setId("1");
            c2.setId("2");
            baseCondition.setType(BaseConditionType.VALUE_LESSER_THAN);
            assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
            c1.setId("2");
            c2.setId("1");
            assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
            result.get(0).clear();
            result.get(0).add(c1);
            result.get(1).clear();
            result.get(1).add(c2);
           
            // test "GREATER_THAN":
            c1.setId("2");
            c2.setId("1");
            baseCondition.setType(BaseConditionType.VALUE_GREATER_THAN);
            assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
            c1.setId("1");
            c2.setId("2");
            assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
           
            // test "IS_PARENT":
            result.get(0).clear();
            result.get(0).add(rule);
            result.get(1).clear();
            result.get(1).add(baseCondition);
            baseCondition.setSource("number_1");
            baseCondition.setTarget("number_2");
            baseCondition.setType(BaseConditionType.MODEL_PARENT_OF);
            assertTrue(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
            baseCondition.setSource("number_2");
            baseCondition.setTarget("number_1");
            assertFalse(conditionProcessor.executeBaseCondition(rule, result, baseCondition, tuples));
           
            // test "MODEL_EQUALS":
            baseCondition.setType(BaseConditionType.MODEL_EQUALS);
            baseCondition.setSource("e1::Source");
            baseCondition.setTarget("e2");
           
            e1.setAlias("e1");
            e2.setAlias("e2");
            e1.setType("TraceLink");
            e2.setType("Actor");
           
            TraceLink link  = LinkModelFactory.eINSTANCE.createTraceLink();
            Actor     actor = URNModelFactory.eINSTANCE.createActor();
           
            accessLayer.addElement(project, link);
View Full Code Here

            result.get(1).add(c2);
                   
            Rule rule = RuleModelFactory.eINSTANCE.createRule();
            accessLayer.addElement(project, rule);
           
            ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
            accessLayer.addElement(project, e1);
            ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
            accessLayer.addElement(project, e2);
           
            rule.getElements().add(e1);
            rule.getElements().add(e2);
           
            e1.setAlias("number_1");
            e2.setAlias("number_2");
           
            BaseCondition baseCondition1 = RuleModelFactory.eINSTANCE.createBaseCondition();
            BaseCondition baseCondition2 = RuleModelFactory.eINSTANCE.createBaseCondition();
            LogicCondition logicCondition = RuleModelFactory.eINSTANCE.createLogicCondition();
            accessLayer.addElement(project, baseCondition1);
View Full Code Here

      public Void call() throws Exception
      {
            Rule rule = RuleModelFactory.eINSTANCE.createRule();
            accessLayer.addElement(project, rule);
           
            ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
            accessLayer.addElement(project, e1);
           
            rule.getElements().add(e1);
           
            List<EObject> l1 = new ArrayList<EObject>();
View Full Code Here

TOP

Related Classes of org.emftrace.metamodel.RuleModel.ElementDefinition

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.