Package org.emftrace.metamodel.RuleModel

Examples of org.emftrace.metamodel.RuleModel.Rule


            tuples.add(new EObject[3]);
            tuples.get(0)[0] = c1;
            tuples.get(0)[1] = c2;
            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);
            accessLayer.addElement(project, e2);
            accessLayer.addElement(project, e3);
            e1.setAlias("e1");
            e2.setAlias("e2");
            e3.setAlias("e3");
            e1.setType("Concern");
            e2.setType("Concern");
            e3.setType("AtomicChangeType");
           
            rule.getElements().add(e1);
            rule.getElements().add(e2);
            rule.getElements().add(e3);
            rule.setRuleID("TestRule");
           
            type.setName("Test");
                   
            assertEquals(0, resultProcessor.getImpactSet().size());
            resultProcessor.processReportImpactResult(project, rule, result, tuples, 0);
View Full Code Here


            tuples.add(new ArrayList<EObject[]>());
            tuples.get(0).add(new EObject[2]);
            tuples.get(0).get(0)[0] = c1;
            tuples.get(0).get(0)[1] = c2;
   
            Rule rule = RuleModelFactory.eINSTANCE.createRule();
            accessLayer.addElement(project, rule);
           
            LogicCondition cnd1 = RuleModelFactory.eINSTANCE.createLogicCondition();
            accessLayer.addElement(project, cnd1);
            BaseCondition cnd2 = RuleModelFactory.eINSTANCE.createBaseCondition();
            accessLayer.addElement(project, cnd2);
             
            rule.setConditions(cnd1);
            cnd1.getBaseConditions().add(cnd2);
            cnd2.setSource("Test");
            cnd2.setTarget("Test");
           
            ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
            ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
            accessLayer.addElement(project, e1);
            accessLayer.addElement(project, e2);
            e1.setAlias("e1");
            e2.setAlias("e2");
            e1.setType("Concern");
            e2.setType("Concern");
           
            rule.getElements().add(e1);
            rule.getElements().add(e2);
            rule.setRuleID("TestRule");
           
            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");
                   
            LogicCondition logicCondition = RuleModelFactory.eINSTANCE.createLogicCondition();
            logicCondition.getBaseConditions().add(baseCondition);
           
            rule.setConditions(logicCondition);
           
            rule.getActions().add(a1);
           
            joinProcessor.run(project, rule, result, tuples);
           
            resultProcessor.run(null, rule, result, tuples);
            assertEquals(0, accessLayer.getElements(project, "TraceLink").size());
View Full Code Here

      Callable<Void> call = new Callable<Void>()
      {
      @Override
      public Void call() throws Exception
      {
            Rule r1 = RuleModelFactory.eINSTANCE.createRule();
            Rule r2 = RuleModelFactory.eINSTANCE.createRule();
           
            accessLayer.addElement(project, r1);
            accessLayer.addElement(project, r2);
           
            RuleCatalog c1 = RuleModelFactory.eINSTANCE.createRuleCatalog();
           
            accessLayer.addElement(project, c1);
           
            c1.getRules().add(r1);
           
            assertEquals(1, c1.getRules().size());
            assertEquals(1, accessLayer.getElements(project, "RuleCatalog").size());
            assertEquals(2, accessLayer.getElements(project, "Rule").size());
            projectCleaner.cleanUpRuleOrphans(project);
            assertEquals(1, c1.getRules().size());
            assertEquals(2, accessLayer.getElements(project, "Rule").size());
            assertEquals(2, accessLayer.getElements(project, "RuleCatalog").size());
           
            Rule r3 = RuleModelFactory.eINSTANCE.createRule();
            accessLayer.addElement(project, r3);
           
            assertEquals(3, accessLayer.getElements(project, "Rule").size());
            projectCleaner.cleanUpLinkTypeOrphans(project);
            assertEquals(3, accessLayer.getElements(project, "Rule").size());
View Full Code Here

      Callable<Void> call = new Callable<Void>()
      {
      @Override
      public Void call() throws Exception
      {
            Rule r1 = RuleModelFactory.eINSTANCE.createRule();
            Rule r2 = RuleModelFactory.eINSTANCE.createRule();
           
            project.deleteElements(project.getContents());
           
            accessLayer.addElement(project, r1);
            accessLayer.addElement(project, r2);
View Full Code Here

      Callable<Void> call = new Callable<Void>()
      {
      @Override
      public Void call() throws Exception
      {
            Rule rule = RuleModelFactory.eINSTANCE.createRule();
            accessLayer.addElement(project, rule);
           
            LogicCondition cnd1 = RuleModelFactory.eINSTANCE.createLogicCondition();
            accessLayer.addElement(project, cnd1);
            BaseCondition cnd2 = RuleModelFactory.eINSTANCE.createBaseCondition();
            accessLayer.addElement(project, cnd2);
             
            rule.setConditions(cnd1);
            cnd1.getBaseConditions().add(cnd2);
            cnd2.setSource("e1::creator");
            cnd2.setTarget("e2::creator");
           
            ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
            ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
            accessLayer.addElement(project, e1);
            accessLayer.addElement(project, e2);
            e1.setAlias("e1");
            e2.setAlias("e2");
            e1.setType("Concern");
            e2.setType("Actor");
           
            rule.getElements().add(e1);
            rule.getElements().add(e2);
           
            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

            results.get(0).clear();
           
            List<EObject> models = new ArrayList<EObject>();
            models.add(link);
           
            Rule rule = RuleModelFactory.eINSTANCE.createRule();
            accessLayer.addElement(project, rule);
           
            ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
            accessLayer.addElement(project, e1);
            e1.setType("TraceLink");
            rule.getElements().add(e1);
           
            assertEquals(1, results.size());
            assertEquals(0, results.get(0).size());
            elementProcessor.retrieveElements(project, rule, models, results);
            assertEquals(1, results.size());
View Full Code Here

    }
   
    @Test
    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);
               
        List<Integer> paths = new ArrayList<Integer>();
       
        ConditionProcessorHelper.findElementsForDeletion(paths, rule, logicCondition);
        assertTrue(paths.isEmpty());
View Full Code Here

      Callable<Void> call = new Callable<Void>()
      {
      @Override
      public Void call() throws Exception
      {
            Rule rule = RuleModelFactory.eINSTANCE.createRule();
            accessLayer.addElement(project, rule);
            ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
            accessLayer.addElement(project, e1);
            e1.setType("TraceLink");
            e1.setAlias("e1");
            ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
            accessLayer.addElement(project, e2);
            e2.setType("Concern");
            e2.setAlias("e2");
            rule.getElements().add(e1);
            rule.getElements().add(e2);
            TraceLink link = LinkModelFactory.eINSTANCE.createTraceLink();
            accessLayer.addElement(project, link);
            Concern concern = URNModelFactory.eINSTANCE.createConcern();
            accessLayer.addElement(project, concern);
           
View Full Code Here

      Callable<Void> call = new Callable<Void>()
      {
      @Override
      public Void call() throws Exception
      {
            Rule rule = RuleModelFactory.eINSTANCE.createRule();
            accessLayer.addElement(project, rule);
            ElementDefinition e1 = RuleModelFactory.eINSTANCE.createElementDefinition();
            accessLayer.addElement(project, e1);
            e1.setType("TraceLink");
            e1.setAlias("e1");
            ElementDefinition e2 = RuleModelFactory.eINSTANCE.createElementDefinition();
            accessLayer.addElement(project, e2);
            e2.setType("Concern");
            e2.setAlias("e2");
            rule.getElements().add(e1);
            rule.getElements().add(e2);
            TraceLink link = LinkModelFactory.eINSTANCE.createTraceLink();
            accessLayer.addElement(project, link);
            Concern concern = URNModelFactory.eINSTANCE.createConcern();
            accessLayer.addElement(project, concern);
           
View Full Code Here

        l1.get(1).add(c2);
        l2.add(new ArrayList<EObject>());
        l2.add(new ArrayList<EObject>());
        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");
       
        rule.setConditions(logicCondition);
        logicCondition.getBaseConditions().add(baseCondition);
       
        assertEquals(1, l1.get(0).size());
        assertEquals(1, l1.get(1).size());
        assertEquals(0, l2.get(0).size());
View Full Code Here

TOP

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

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.