Package org.emftrace.metamodel.RuleModel

Examples of org.emftrace.metamodel.RuleModel.ActionDefinition


           
            LinkType l1 = LinkModelFactory.eINSTANCE.createLinkType();
            accessLayer.addElement(project, l1);
            l1.setName("Test");
           
            ActionDefinition a1 = RuleModelFactory.eINSTANCE.createActionDefinition();
            accessLayer.addElement(project, a1);
            a1.setSourceElement("e1");
            a1.setTargetElement("e2");
            a1.setResultType("Test");
            a1.setActionType(ActionType.CREATE_LINK);
           
            rule.getActions().add(a1);
           
            assertEquals(0, accessLayer.getElements(project, "TraceLink").size());
            ruleEngine.applyRule(null, null, rule);
View Full Code Here


            result.get(1).add(c2);
           
            Rule rule = RuleModelFactory.eINSTANCE.createRule();
            accessLayer.addElement(project, rule);
           
            ActionDefinition action = RuleModelFactory.eINSTANCE.createActionDefinition();
            accessLayer.addElement(project, action);
           
            rule.getActions().add(action);       
           
            action.setSourceElement("e1");
            action.setTargetElement("e2");
            action.setResultType("Test");
            action.setActionType(ActionType.CREATE_LINK);
           
            ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
            ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
            accessLayer.addElement(project, e1);
            accessLayer.addElement(project, e2);
View Full Code Here

           
            LinkType l2 = LinkModelFactory.eINSTANCE.createLinkType();
            accessLayer.addElement(project, l2);
            l2.setName("TestRelation");
           
            ActionDefinition a1 = RuleModelFactory.eINSTANCE.createActionDefinition();
            accessLayer.addElement(project, a1);
            a1.setSourceElement("e1");
            a1.setTargetElement("e2");
            a1.setResultType("Test");
            a1.setActionType(ActionType.CREATE_LINK);
           
            rule.getActions().add(a1);
           
            /*
             * case 1:
             *
             * <and>
             *     e1.name = e2.name
             *      <not>
             *         e1.name = "test"
             *      </not>
             * </and>
             */
           
             lc2.getBaseConditions().add(bc2);
            
             assertEquals(0, accessLayer.getElements(project, "TraceLink").size());       
             ruleEngine.applyRule(project, null, rule);
             assertEquals(1, accessLayer.getElements(project, "TraceLink").size());
           
            /*
             * case 2:
             *
             * <and>
             *     e1.name = e2.name
             *      <not>
             *        <and>
             *             e1.name = "test"
             *              e1.name = "test2"
             *          </and>
             *      </not>
             * </and>
             */
           
             a1.setResultType("TestRelation");
             lc2.getBaseConditions().clear();
             lc2.getLogicConditions().add(lc3);
             lc3.getBaseConditions().add(bc2);
             lc3.getBaseConditions().add(bc3);
            
View Full Code Here

            tuples.get(0)[2] = type;
   
            Rule rule = RuleModelFactory.eINSTANCE.createRule();
            accessLayer.addElement(project, rule);
           
            ActionDefinition action = RuleModelFactory.eINSTANCE.createActionDefinition();
            accessLayer.addElement(project, action);
           
            rule.getActions().add(action);       
           
            action.setSourceElement("e1");
            action.setImpactedElement("e2");
            action.setResultType("Test");
            action.setActionType(ActionType.REPORT_IMPACT);
           
            ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
            ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
            ElementDefinition e3 = RuleModelFactory.eINSTANCE.createElementDefinition();
            accessLayer.addElement(project, e1);
View Full Code Here

           
            LinkType l1 = LinkModelFactory.eINSTANCE.createLinkType();
            accessLayer.addElement(project, l1);
            l1.setName("Test");
           
            ActionDefinition a1 = RuleModelFactory.eINSTANCE.createActionDefinition();
            accessLayer.addElement(project, a1);
            a1.setSourceElement("e1");
            a1.setTargetElement("e2");
            a1.setResultType("Test");
            a1.setActionType(ActionType.CREATE_LINK);
           
            BaseCondition baseCondition = RuleModelFactory.eINSTANCE.createBaseCondition();
            baseCondition.setSource("e1");
            baseCondition.setTarget("e2");
                   
View Full Code Here

      Callable<Void> call = new Callable<Void>()
      {
      @Override
      public Void call() throws Exception
      {
            ActionDefinition actionDef = RuleModelFactory.eINSTANCE.createActionDefinition();
            actionDef.setActionType(ActionType.CREATE_LINK);
            List<String> elements = new ArrayList<String>();
            elements.add("e1");
            assertFalse(ruleValidator.checkActionDefinition(project, actionDef, elements));
            actionDef.setSourceElement("e2");
            assertFalse(ruleValidator.checkActionDefinition(project, actionDef, elements));
            actionDef.setSourceElement("e1");
            assertFalse(ruleValidator.checkActionDefinition(project, actionDef, elements));
            actionDef.setTargetElement("e2");
            assertFalse(ruleValidator.checkActionDefinition(project, actionDef, elements));
            elements.add("e2");
            assertFalse(ruleValidator.checkActionDefinition(project, actionDef, elements));
            actionDef.setResultType("test");
            assertFalse(ruleValidator.checkActionDefinition(project, actionDef, elements));
            LinkType linkType = LinkModelFactory.eINSTANCE.createLinkType();
            accessLayer.addElement(project, linkType);
            linkType.setName("test");
            assertTrue(ruleValidator.checkActionDefinition(project, actionDef, elements));
View Full Code Here

           
            LinkType l1 = LinkModelFactory.eINSTANCE.createLinkType();
            accessLayer.addElement(project, l1);
            l1.setName("Test");
           
            ActionDefinition a1 = RuleModelFactory.eINSTANCE.createActionDefinition();
            accessLayer.addElement(project, a1);
            a1.setSourceElement("e1");
            a1.setTargetElement("e2");
            a1.setResultType("Test");
            a1.setActionType(ActionType.CREATE_LINK);
           
            rule.getActions().add(a1);
           
            assertTrue(ruleValidator.validateRule(project, rule));
            a1.setSourceElement("42");
            assertFalse(ruleValidator.validateRule(project, rule));
        return null;
      }
    };
   
View Full Code Here

         
          ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
          ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
          ElementDefinition e3 = RuleModelFactory.eINSTANCE.createElementDefinition();
         
          ActionDefinition a = RuleModelFactory.eINSTANCE.createActionDefinition();
          a.setActionType(ActionType.CREATE_LINK);
         
          rule.getElements().add(e1);
          rule.getElements().add(e2);
          rule.getElements().add(e3);
         
View Full Code Here

TOP

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

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.