Package org.emftrace.metamodel.URNModel

Examples of org.emftrace.metamodel.URNModel.Concern


    @Test
    public void testExecuteLogicCondition()
    {
        List<List<EObject>> result = new ArrayList<List<EObject>>();
               
        Concern c1 = URNModelFactory.eINSTANCE.createConcern();
        Concern c2 = URNModelFactory.eINSTANCE.createConcern();
        accessLayer.addElement(project, c1);
        accessLayer.addElement(project, c2);
              
        result.add(new ArrayList<EObject>());
        result.get(0).add(c1);
        result.add(new ArrayList<EObject>());
        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);
        accessLayer.addElement(project, baseCondition2);
        accessLayer.addElement(project, logicCondition);
       
        rule.setConditions(logicCondition);
        logicCondition.getBaseConditions().add(baseCondition1);
        logicCondition.getBaseConditions().add(baseCondition2);
        baseCondition1.setSource("number_1::Id");
        baseCondition1.setTarget("number_2::Id");
        baseCondition1.setType(BaseConditionType.VALUE_EQUALS);
        baseCondition2.setSource("number_1::name");
        baseCondition2.setTarget("number_2::name");
        baseCondition2.setType(BaseConditionType.VALUE_EQUALS);
       
        List<List<EObject[]>> tuples = new ArrayList<List<EObject[]>>();
        tuples.add(new ArrayList<EObject[]>());
        tuples.add(new ArrayList<EObject[]>());
       
        // test "AND":
        c1.setId("creator");
        c2.setId("creator");
        c1.setName("name");
        c2.setName("name");
        logicCondition.setType(LogicConditionType.AND);
        assertTrue(conditionProcessor.executeLogicCondition(rule, result, rule.getConditions(), tuples));
        c1.setId("creator__");
        assertFalse(conditionProcessor.executeLogicCondition(rule, result, rule.getConditions(), tuples));
        result.get(0).clear();
        result.get(0).add(c1);
        result.get(1).clear();
        result.get(1).add(c2);
       
        // test "OR":
        logicCondition.setType(LogicConditionType.OR);
        assertTrue(conditionProcessor.executeLogicCondition(rule, result, rule.getConditions(), tuples));
        c2.setName("name___");
        assertFalse(conditionProcessor.executeLogicCondition(rule, result, rule.getConditions(), tuples));
        result.get(0).clear();
        result.get(0).add(c1);
        result.get(1).clear();
        result.get(1).add(c2);
       
        // test "XOR":
        c1.setId("creator");
        logicCondition.setType(LogicConditionType.XOR);
        assertTrue(conditionProcessor.executeLogicCondition(rule, result, rule.getConditions(), tuples));
        c1.setId("creator");
        c2.setId("creator");
        c1.setName("name");
        c2.setName("name");
        result.get(0).clear();
        result.get(0).add(c1);
        result.get(1).clear();
        result.get(1).add(c2);
        assertFalse(conditionProcessor.executeLogicCondition(rule, result, rule.getConditions(), tuples));
View Full Code Here


    @Test
    public void testRun()
    {
        List<List<EObject>> result = new ArrayList<List<EObject>>();
       
        Concern c1 = URNModelFactory.eINSTANCE.createConcern();
        Concern c2 = URNModelFactory.eINSTANCE.createConcern();
        accessLayer.addElement(project, c1);
        accessLayer.addElement(project, c2);
              
        result.add(new ArrayList<EObject>());
        result.get(0).add(c1);
        result.add(new ArrayList<EObject>());
        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);
        accessLayer.addElement(project, baseCondition2);
        accessLayer.addElement(project, logicCondition);
       
        rule.setConditions(logicCondition);
        logicCondition.getBaseConditions().add(baseCondition1);
        logicCondition.getBaseConditions().add(baseCondition2);
        baseCondition1.setSource("number_1::Id");
        baseCondition1.setTarget("number_2::Id");
        baseCondition1.setType(BaseConditionType.VALUE_EQUALS);
        baseCondition2.setSource("number_1::name");
        baseCondition2.setTarget("number_2::name");
        baseCondition2.setType(BaseConditionType.VALUE_EQUALS);
       
        c1.setId("1");
        c2.setId("1");
        c1.setName("name");
        c2.setName("name");
        logicCondition.setType(LogicConditionType.AND);
       
        List<List<EObject[]>> tuples = new ArrayList<List<EObject[]>>();
        tuples.add(new ArrayList<EObject[]>());
        tuples.add(new ArrayList<EObject[]>());
View Full Code Here

    @Test
    public void testIsModelEqual()
    {
        List<List<EObject>> result = new ArrayList<List<EObject>>();
       
        Concern c1 = URNModelFactory.eINSTANCE.createConcern();
        Concern c2 = URNModelFactory.eINSTANCE.createConcern();
        Concern c3 = c1;
        accessLayer.addElement(project, c1);
        accessLayer.addElement(project, c2);
              
        result.add(new ArrayList<EObject>());
        result.get(0).add(c1);
View Full Code Here

    @Test
    public void testAreRelated()
    {
        List<List<EObject>> result = new ArrayList<List<EObject>>();
       
        Concern c1 = URNModelFactory.eINSTANCE.createConcern();
        Concern c2 = URNModelFactory.eINSTANCE.createConcern();
        Concern c3 = URNModelFactory.eINSTANCE.createConcern();
        accessLayer.addElement(project, c1);
        accessLayer.addElement(project, c2);
        accessLayer.addElement(project, c3);
       
        TraceLink l1 = LinkModelFactory.eINSTANCE.createTraceLink();
View Full Code Here

    @Test
    public void testAreIndirectlyRelated()
    {
        List<List<EObject>> result = new ArrayList<List<EObject>>();
       
        Concern c1 = URNModelFactory.eINSTANCE.createConcern();
        Concern c2 = URNModelFactory.eINSTANCE.createConcern();
        Concern c3 = URNModelFactory.eINSTANCE.createConcern();
        Concern c4 = URNModelFactory.eINSTANCE.createConcern();
        accessLayer.addElement(project, c1);
        accessLayer.addElement(project, c2);
        accessLayer.addElement(project, c3);
        accessLayer.addElement(project, c4);
       
View Full Code Here

    }
   
    @Test
    public void testcheckIfLinkExists()
    {
        Concern c1 = URNModelFactory.eINSTANCE.createConcern();
        Concern c2 = URNModelFactory.eINSTANCE.createConcern();
        LinkType t = LinkModelFactory.eINSTANCE.createLinkType();
       
        List<EObject> sources = new ArrayList<EObject>();
        sources.add(c1);
        List<EObject> targets = new ArrayList<EObject>();
View Full Code Here

    }

    @Test
    public void testCreateLinkProjectModelElementModelElementStringLinkType()
    {      
        Concern c1 = URNModelFactory.eINSTANCE.createConcern();
        Concern c2 = URNModelFactory.eINSTANCE.createConcern();
        LinkType t = LinkModelFactory.eINSTANCE.createLinkType();
       
        assertEquals(0, accessLayer.getElements(project, "LinkContainer").size());
        assertNotNull(linkManager.createLink(project, c1, c2, "42", t, ""));
        assertEquals(1, accessLayer.getElements(project, "LinkContainer").size());
View Full Code Here

        TraceLink link1 = LinkModelFactory.eINSTANCE.createTraceLink();
        TraceLink link2 = LinkModelFactory.eINSTANCE.createTraceLink();
        accessLayer.addElement(project, link1);
        accessLayer.addElement(project, link2);
               
        Concern concern1 = URNModelFactory.eINSTANCE.createConcern();
        Concern concern2 = URNModelFactory.eINSTANCE.createConcern();
        Concern concern3 = URNModelFactory.eINSTANCE.createConcern();
        accessLayer.addElement(project, concern1);
        accessLayer.addElement(project, concern2);
        accessLayer.addElement(project, concern3);
       
        // create a transitive relation:       
View Full Code Here

        TraceLink link = LinkModelFactory.eINSTANCE.createTraceLink();
        accessLayer.addElement(project, link);
        link.setCreatedByUser(false);
        link.setCreatedByRule("Test");
       
        Concern c1 = URNModelFactory.eINSTANCE.createConcern();
        Concern c2 = URNModelFactory.eINSTANCE.createConcern();
        accessLayer.addElement(project, c1);
        accessLayer.addElement(project, c2);
       
        assertEquals(1, accessLayer.getElements(project, "TraceLink").size());
        linkManager.validateLink(project, (TraceLink)null);
View Full Code Here

    {               
        TraceLink link = LinkModelFactory.eINSTANCE.createTraceLink();
        accessLayer.addElement(project, link);
        link.setCreatedByUser(false);
       
        Concern c1 = URNModelFactory.eINSTANCE.createConcern();
        Concern c2 = URNModelFactory.eINSTANCE.createConcern();
        accessLayer.addElement(project, c1);
        accessLayer.addElement(project, c2);
       
        assertEquals(1, accessLayer.getElements(project, "TraceLink").size());
        linkManager.validateLink(project, (TraceLink)null);
View Full Code Here

TOP

Related Classes of org.emftrace.metamodel.URNModel.Concern

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.