Package org.emftrace.metamodel.LinkModel

Examples of org.emftrace.metamodel.LinkModel.TraceLink


        LinkContainer c2 = LinkModelFactory.eINSTANCE.createLinkContainer();
       
        accessLayer.addElement(project, c1);
        accessLayer.addElement(project, c2);
       
        TraceLink l1 = LinkModelFactory.eINSTANCE.createTraceLink();
        TraceLink l2 = LinkModelFactory.eINSTANCE.createTraceLink();
        TraceLink l3 = LinkModelFactory.eINSTANCE.createTraceLink();
       
        accessLayer.addElement(project, l1);
        accessLayer.addElement(project, l2);
        accessLayer.addElement(project, l3);
       
        c1.getLinks().add(l1);
        c2.getLinks().add(l2);
        c2.getLinks().add(l3);
       
        assertEquals(3, accessLayer.getElements(project, "LinkContainer").size());
        assertEquals(3, accessLayer.getElements(project, "TraceLink").size());
        projectCleaner.updateLinkContainer(project);
        assertEquals(1, accessLayer.getElements(project, "LinkContainer").size());
        assertEquals(3, accessLayer.getElements(project, "TraceLink").size());
       
        TraceLink l4 = LinkModelFactory.eINSTANCE.createTraceLink();
        accessLayer.addElement(project, l4);
       
        assertEquals(4, accessLayer.getElements(project, "TraceLink").size());
        assertEquals(3, ((LinkContainer)accessLayer.getElements(project, "LinkContainer").get(0)).getLinks().size());
        projectCleaner.updateLinkContainer(project);
View Full Code Here


    }
   
    @Test
    public void testRetrieveElementsProjectStringListOfQueryElement()
    {
        TraceLink link = LinkModelFactory.eINSTANCE.createTraceLink();
        accessLayer.addElement(project, link);
       
        List<EObject> list = new ArrayList<EObject>();
        list.clear();
       
View Full Code Here

    }

    @Test
    public void testRetrieveElementsProjectTraceRuleListOfModelElementListOfListOfQueryElement()
    {
        TraceLink link = LinkModelFactory.eINSTANCE.createTraceLink();
        accessLayer.addElement(project, link);
       
        List<List<EObject>> results = new ArrayList<List<EObject>>();
        results.add(new ArrayList<EObject>());
        results.get(0).clear();
View Full Code Here

        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);
       
        List<List<EObject>> results = new ArrayList<List<EObject>>();
View Full Code Here

        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);
       
        List<List<EObject>> list = new ArrayList<List<EObject>>();
View Full Code Here

             List<EObject> sources = new ArrayList<EObject>();
             List<EObject> targets = new ArrayList<EObject>();
             sources.add(src);
             targets.add(dst);

             TraceLink          link = linkManager.checkIfLinkExists(project, sources, targets, rule.getRuleID(), type);
             if( link == null ) link = linkManager.checkIfLinkExists(project, targets, sources, rule.getRuleID(), type);                            
             if( link == null ) link = linkManager.createLink(project, src, dst, linkManager.getName(), type, rule.getRuleID());

             if( link != null )
             {
                 link.setLastVisited(Calendar.getInstance().getTime().toString());
                    
                 if( link.getDescription() == null || link.getDescription().equals("") )
                 {
                     String description = "";
                     if( !rule.getRuleID().contains("rule") && !rule.getRuleID().contains("Rule") ) description = "[Rule ";
                     else description = "[";
                        
                     description = description + rule.getRuleID() + ", " + Calendar.getInstance().getTime().toString() + "]: ";
                        
                     if( rule.getDescription() != null ) description = description + rule.getDescription();
                        
                     link.setDescription(description);                                   
                     link.setLastModified(Calendar.getInstance().getTime().toString());
                 }
                    
             }                           
         } 
  }
View Full Code Here

      accessLayer.addElement(project, a1);
      accessLayer.addElement(project, a2);
      accessLayer.addElement(project, a3);
      accessLayer.addElement(project, a4);
     
      TraceLink linkA1_A2 = LinkModelFactory.eINSTANCE.createTraceLink();
      TraceLink linkA2_A3 = LinkModelFactory.eINSTANCE.createTraceLink();
      TraceLink linkA2_A4 = LinkModelFactory.eINSTANCE.createTraceLink();
     
      accessLayer.addElement(project, linkA1_A2);
      accessLayer.addElement(project, linkA2_A3);
      accessLayer.addElement(project, linkA2_A4);
     
      LinkTypeCatalog linkTypes = LinkModelFactory.eINSTANCE.createLinkTypeCatalog();
     
      accessLayer.addElement(project, linkTypes);
     
      LinkType linkType1 = LinkModelFactory.eINSTANCE.createLinkType();
      LinkType linkType2 = LinkModelFactory.eINSTANCE.createLinkType();
      LinkType linkType3 = LinkModelFactory.eINSTANCE.createLinkType();
     
      accessLayer.addElement(project, linkType1);
      accessLayer.addElement(project, linkType2);
      accessLayer.addElement(project, linkType3);
     
      linkType1.setName("refinement");
      linkType2.setName("implements");
      linkType3.setName("requires");
     
      linkTypes.getLinkTypes().add(linkType1);
      linkTypes.getLinkTypes().add(linkType2);
      linkTypes.getLinkTypes().add(linkType3);
     
      linkA1_A2.setSource(a1);
      linkA1_A2.setTarget(a2);
      linkA1_A2.setType(linkType1);
     
      linkA2_A3.setSource(a2);
      linkA2_A3.setTarget(a3);
      linkA2_A3.setType(linkType1);
     
      linkA2_A4.setSource(a2);
      linkA2_A4.setTarget(a4);
      linkA2_A4.setType(linkType2);
     
      ChangeTypeCatalog changeTypes = ChangeModelFactory.eINSTANCE.createChangeTypeCatalog();
     
      accessLayer.addElement(project, changeTypes);
     
      AtomicChangeType changeType1 = ChangeModelFactory.eINSTANCE.createAtomicChangeType();
      AtomicChangeType changeType2 = ChangeModelFactory.eINSTANCE.createAtomicChangeType();
     
      accessLayer.addElement(project, changeType1);
      accessLayer.addElement(project, changeType2);
     
      changeType1.setName("rename");
      changeType2.setName("delete");
     
      changeTypes.getChangeTypes().add(changeType1);
      changeTypes.getChangeTypes().add(changeType2);
     
      Rule impactRule1 = RuleModelFactory.eINSTANCE.createRule();
      Rule impactRule2 = RuleModelFactory.eINSTANCE.createRule();
     
      accessLayer.addElement(project, impactRule1);
      accessLayer.addElement(project, impactRule2);
     
      ElementDefinition rule1ED1 = RuleModelFactory.eINSTANCE.createElementDefinition();
      ElementDefinition rule1ED2 = RuleModelFactory.eINSTANCE.createElementDefinition();
      ElementDefinition rule1ED3 = RuleModelFactory.eINSTANCE.createElementDefinition();
      ElementDefinition rule2ED1 = RuleModelFactory.eINSTANCE.createElementDefinition();
      ElementDefinition rule2ED2 = RuleModelFactory.eINSTANCE.createElementDefinition();
      ElementDefinition rule2ED3 = RuleModelFactory.eINSTANCE.createElementDefinition();
     
      accessLayer.addElement(project, rule1ED1);
      accessLayer.addElement(project, rule1ED2);
      accessLayer.addElement(project, rule1ED3);
      accessLayer.addElement(project, rule2ED1);
      accessLayer.addElement(project, rule2ED2);
      accessLayer.addElement(project, rule2ED3);
     
      rule1ED1.setType("Concern");
      rule1ED1.setAlias("e1");
      rule1ED2.setType("Concern");
      rule1ED2.setAlias("e2");
      rule1ED3.setType("AtomicChangeType");
      rule1ED3.setAlias("e3");
     
      rule2ED1.setType("Concern");
      rule2ED1.setAlias("e1");
      rule2ED2.setType("Concern");
      rule2ED2.setAlias("e2");
      rule2ED3.setType("AtomicChangeType");
      rule2ED3.setAlias("e3");
     
      impactRule1.getElements().add(rule1ED1);
      impactRule1.getElements().add(rule1ED2);
      impactRule1.getElements().add(rule1ED3);
     
      impactRule2.getElements().add(rule2ED1);
      impactRule2.getElements().add(rule2ED2);
      impactRule2.getElements().add(rule2ED3);
     
      ActionDefinition rule1Action = RuleModelFactory.eINSTANCE.createActionDefinition();
      ActionDefinition rule2Action = RuleModelFactory.eINSTANCE.createActionDefinition();
     
      accessLayer.addElement(project, rule1Action);
      accessLayer.addElement(project, rule2Action);
     
      rule1Action.setActionType(ActionType.REPORT_IMPACT);
      rule1Action.setResultType("rename");
      rule1Action.setSourceElement("e1");
      rule1Action.setImpactedElement("e2");
     
      rule2Action.setActionType(ActionType.REPORT_IMPACT);
      rule2Action.setResultType("delete");
      rule2Action.setSourceElement("e1");
      rule2Action.setImpactedElement("e2");
     
      impactRule1.getActions().add(rule1Action);
      impactRule2.getActions().add(rule2Action);
     
      LogicCondition rule1LC = RuleModelFactory.eINSTANCE.createLogicCondition();
      LogicCondition rule2LC = RuleModelFactory.eINSTANCE.createLogicCondition();
     
      accessLayer.addElement(project, rule1LC);
      accessLayer.addElement(project, rule2LC);
     
      rule1LC.setType(LogicConditionType.AND);
      rule2LC.setType(LogicConditionType.AND);
     
      impactRule1.setConditions(rule1LC);
      impactRule2.setConditions(rule2LC);
     
      BaseCondition rule1BC1 = RuleModelFactory.eINSTANCE.createBaseCondition();
      BaseCondition rule1BC2 = RuleModelFactory.eINSTANCE.createBaseCondition();
      BaseCondition rule2BC1 = RuleModelFactory.eINSTANCE.createBaseCondition();
      BaseCondition rule2BC2 = RuleModelFactory.eINSTANCE.createBaseCondition();
     
      accessLayer.addElement(project, rule1BC1);
      accessLayer.addElement(project, rule1BC2);
      accessLayer.addElement(project, rule2BC1);
      accessLayer.addElement(project, rule2BC2);
     
      rule1BC1.setType(BaseConditionType.VALUE_EQUALS);
      rule1BC1.setSource("e3::name");
      rule1BC1.setValue("rename");
     
      rule1BC2.setType(BaseConditionType.MODEL_RELATED_TO);
      rule1BC2.setSource("e1");
      rule1BC2.setTarget("e2");
      rule1BC2.setValue("refinement");     
     
      rule2BC1.setType(BaseConditionType.VALUE_EQUALS);
      rule2BC1.setSource("e3::name");
      rule2BC1.setValue("delete");
     
      rule2BC2.setType(BaseConditionType.MODEL_RELATED_TO);
      rule2BC2.setSource("e1");
      rule2BC2.setTarget("e2");
      rule2BC2.setValue("implements");
     
      rule1LC.getBaseConditions().add(rule1BC1);
      rule1LC.getBaseConditions().add(rule1BC2);
      rule2LC.getBaseConditions().add(rule2BC1);
      rule2LC.getBaseConditions().add(rule2BC2);
     
      RuleCatalog impactRules = RuleModelFactory.eINSTANCE.createRuleCatalog();
     
      accessLayer.addElement(project, impactRules);
     
      impactRules.getRules().add(impactRule1);
      impactRules.getRules().add(impactRule2);
     
      List<EObject> startingImpactSet = new ArrayList<EObject>();
     
      startingImpactSet.add(changeType1);
      startingImpactSet.add(a1);
     
      assertEquals(0, accessLayer.getElements(project, "ReportContainer").size());
      assertEquals(0, accessLayer.getElements(project, "ImpactReport").size());
     
      impactAnalyzer.init(impactRules);
      assertEquals(2, impactAnalyzer.performImpactAnalysis(project, startingImpactSet, true, false));
      assertEquals(1, accessLayer.getElements(project, "ReportContainer").size());
      assertEquals(2, accessLayer.getElements(project, "ImpactReport").size());
     
      linkA2_A4.setType(linkType1);
      startingImpactSet.add(changeType1);
      startingImpactSet.add(a1);
     
      impactAnalyzer.init(impactRules);
      assertEquals(1, impactAnalyzer.performImpactAnalysis(project, startingImpactSet, true, false));
      assertEquals(1, accessLayer.getElements(project, "ReportContainer").size());
      assertEquals(3, accessLayer.getElements(project, "ImpactReport").size());
     
      startingImpactSet.add(changeType1);
      startingImpactSet.add(a1);
     
      impactAnalyzer.init(impactRules);
      assertEquals(3, impactAnalyzer.performImpactAnalysis(project, startingImpactSet, false, true));
      assertEquals(1, accessLayer.getElements(project, "ReportContainer").size());
      assertEquals(4, accessLayer.getElements(project, "ImpactReport").size());
     
      startingImpactSet.add(changeType1);
      startingImpactSet.add(a1);
     
      impactAnalyzer.init(impactRules);
      assertEquals(3, impactAnalyzer.performImpactAnalysis(project, startingImpactSet, true, true));
      assertEquals(1, accessLayer.getElements(project, "ReportContainer").size());
      assertEquals(4, accessLayer.getElements(project, "ImpactReport").size());
     
      linkA2_A4.setType(linkType2);
      startingImpactSet.add(changeType2);
      startingImpactSet.add(a2);
     
      impactAnalyzer.init(impactRules);
      assertEquals(1, impactAnalyzer.performImpactAnalysis(project, startingImpactSet, true, false));
      assertEquals(1, accessLayer.getElements(project, "ReportContainer").size());
      assertEquals(5, accessLayer.getElements(project, "ImpactReport").size());
     
      startingImpactSet.add(changeType2);
      startingImpactSet.add(a2);     
     
      impactAnalyzer.init(impactRules);
      assertEquals(1, impactAnalyzer.performImpactAnalysis(project, startingImpactSet, false, true));
      assertEquals(1, accessLayer.getElements(project, "ReportContainer").size());
      assertEquals(5, accessLayer.getElements(project, "ImpactReport").size());
     
      startingImpactSet.add(changeType2);
      startingImpactSet.add(a2);
     
      impactAnalyzer.init(impactRules);
      assertEquals(1, impactAnalyzer.performImpactAnalysis(project, startingImpactSet, true, true));
      assertEquals(1, accessLayer.getElements(project, "ReportContainer").size());
      assertEquals(5, accessLayer.getElements(project, "ImpactReport").size());
     
      linkA1_A2.setType(linkType3);
      linkA2_A3.setType(linkType3);
      linkA2_A4.setType(linkType3);
     
      startingImpactSet.add(changeType1);
      startingImpactSet.add(a1);
     
      impactAnalyzer.init(impactRules);
View Full Code Here

    }
   
    @Test
    public void testGetAttributeValueModelElementStringString()
    {       
        TraceLink link = LinkModelFactory.eINSTANCE.createTraceLink();
        Actor actor = URNModelFactory.eINSTANCE.createActor();
       
        actor.setId("123");
       
        link.setSource(actor);

        assertEquals("Result", "123", accessLayer.getAttributeValue(link.getSource(), "Id"));
        actor.setId("1234");
        assertEquals("Result", "1234", accessLayer.getAttributeValue(link.getSource(), "Id"));
        assertNull(accessLayer.getAttributeValue(null, (String)null, (String)null));
        assertNull(accessLayer.getAttributeValue(link.getSource(), (String)null, (String)null));
        assertNull(accessLayer.getAttributeValue(link.getSource(), (String)null, "Id"));
        assertNull(accessLayer.getAttributeValue(link.getSource(), (String)null));
        assertNull(accessLayer.getAttributeValue(null, "Id"));
        assertNull(accessLayer.getAttributeValue(link.getSource(), "test"));
    }
View Full Code Here

      {
        boolean sourceRelated = false;
       
        for(int j = 0; j < target.size(); j++)
        { 
          TraceLink link = null;
         
          do
          {
            if( link == null )
            {
              for(int k = 0; k < links.size(); k++)
              {
                if( links.get(k).getSource() == source.get(i) )
                {
                  link = links.get(k);
                  break;
                }
              }
             
              if( link == null ) break;
            }
                         
              if( link.getTarget() == target.get(j) )
              {
              ConditionProcessorHelper.addToTuples(source.get(i), target.get(j), tuples);
              sourceRelated = true;
              destCount[j]++;
              break;
              }

              int count = 0;
            for(int k = 0; k < links.size(); k++)
            {
              if( links.get(k).getSource() == link.getTarget() )
              {
                link = links.get(k);
                break;
              }
              else count++;
View Full Code Here

        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);
        accessLayer.addElement(project, actor);
             
        link.setSource(actor);
       
        result.get(0).clear();
        result.get(1).clear();
        result.get(0).add(link);
        result.get(1).add(actor);
View Full Code Here

TOP

Related Classes of org.emftrace.metamodel.LinkModel.TraceLink

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.