Package org.emftrace.metamodel.LinkModel

Examples of org.emftrace.metamodel.LinkModel.TraceLink


          Concern a6 = URNModelFactory.eINSTANCE.createConcern();
          Concern a7 = URNModelFactory.eINSTANCE.createConcern();
          Concern a8 = URNModelFactory.eINSTANCE.createConcern();
          Concern a9 = URNModelFactory.eINSTANCE.createConcern();
         
          TraceLink linkA1_A2 = LinkModelFactory.eINSTANCE.createTraceLink();
          TraceLink linkA1_A6 = LinkModelFactory.eINSTANCE.createTraceLink();
          TraceLink linkA1_A5 = LinkModelFactory.eINSTANCE.createTraceLink();
          TraceLink linkA2_A3 = LinkModelFactory.eINSTANCE.createTraceLink();
          TraceLink linkA2_A4 = LinkModelFactory.eINSTANCE.createTraceLink();
          TraceLink linkA3_A9 = LinkModelFactory.eINSTANCE.createTraceLink();
          TraceLink linkA6_A7 = LinkModelFactory.eINSTANCE.createTraceLink();
          TraceLink linkA7_A8 = LinkModelFactory.eINSTANCE.createTraceLink();
         
          linkA1_A2.setSource(a1);
          linkA1_A2.setTarget(a2);
          linkA1_A6.setSource(a1);
          linkA1_A6.setTarget(a6);
          linkA1_A5.setSource(a1);
          linkA1_A5.setTarget(a5);
          linkA2_A3.setSource(a2);
          linkA2_A3.setTarget(a3);
          linkA2_A4.setSource(a2);
          linkA2_A4.setTarget(a4);
          linkA3_A9.setSource(a3);
          linkA3_A9.setTarget(a9);
          linkA6_A7.setSource(a6);
          linkA6_A7.setTarget(a7);
          linkA7_A8.setSource(a7);
          linkA7_A8.setTarget(a8);
         
          accessLayer.addElement(project, a1);
          accessLayer.addElement(project, a2);
          accessLayer.addElement(project, a3);
          accessLayer.addElement(project, a4);
View Full Code Here


  {
    List<EObject> relatedObjects = new ArrayList<EObject>();
   
    for(int i = 0; i < dependencyGraph.size(); i++)
    {
      TraceLink link = (TraceLink) dependencyGraph.get(i);
      if( link.getSource() == object && !relatedObjects.contains(link.getTarget()) ) relatedObjects.add(link.getTarget());
      if( link.getTarget() == object && !relatedObjects.contains(link.getSource()) ) relatedObjects.add(link.getSource());
    }
   
    return relatedObjects;
  }
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

      Callable<Void> call = new Callable<Void>()
      {
      @Override
      public Void call() throws Exception
      {
            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"));
        return null;
      }
    };
   
    RunESCommand.run(call);
View Full Code Here

      Callable<Void> call = new Callable<Void>()
      {
      @Override
      public Void call() throws Exception
      {
            TraceLink link = LinkModelFactory.eINSTANCE.createTraceLink();
            Trace trace = LinkModelFactory.eINSTANCE.createTrace();
           
            accessLayer.addElement(project, link);
            accessLayer.addElement(project, trace);
           
View Full Code Here

      Callable<Void> call = new Callable<Void>()
      {
      @Override
      public Void call() throws Exception
      {
          TraceLink link = LinkModelFactory.eINSTANCE.createTraceLink();
          List<TraceLink> list = new ArrayList<TraceLink>();
          list.add(link);
         
          assertEquals(0, accessLayer.getElements(project, "LinkContainer").size());
          assertNotNull(linkManager.createTrace(project, list, "42"));      
View Full Code Here

      Callable<Void> call = new Callable<Void>()
      {
      @Override
      public Void call() throws Exception
      {
            TraceLink link = LinkModelFactory.eINSTANCE.createTraceLink();
           
            accessLayer.addElement(project, link);
            assertEquals(1, accessLayer.getElements(project, "TraceLink").size());
            linkManager.deleteLink(null, link);
            assertEquals(1, accessLayer.getElements(project, "TraceLink").size());
View Full Code Here

      {
      @Override
      public Void call() throws Exception
      {
            Trace trace = LinkModelFactory.eINSTANCE.createTrace();
            TraceLink link = LinkModelFactory.eINSTANCE.createTraceLink();
           
            accessLayer.addElement(project, trace);
            accessLayer.addElement(project, link);
            trace.setCreatedByUser(true);
           
View Full Code Here

            linkManager.performTransitivityAnalysis(null);
            assertEquals(1, accessLayer.getElements(project, "Trace").size());
            linkManager.performTransitivityAnalysis(project);
            assertEquals(0, accessLayer.getElements(project, "Trace").size());
           
            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:       
            link1.setSource(concern1);
            link1.setTarget(concern2);
            link2.setSource(concern2);
            link2.setTarget(concern3);
           
            // this should result in one trace being created:
            linkManager.performTransitivityAnalysis(project);
            assertEquals(1, accessLayer.getElements(project, "Trace").size());
            assertEquals(2, ((Trace) (accessLayer.getElements(project, "Trace").get(0))).getTraceabilityLinks().size());
View Full Code Here

      Callable<Void> call = new Callable<Void>()
      {
      @Override
      public Void call() throws Exception
      {
            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);
            assertEquals(1, accessLayer.getElements(project, "TraceLink").size());
            linkManager.validateLink(null, link);
            assertEquals(1, accessLayer.getElements(project, "TraceLink").size());
            linkManager.validateLink(null, (TraceLink)null);
            assertEquals(1, accessLayer.getElements(project, "TraceLink").size());
           
            // test removing links with no content:
            linkManager.validateLink(project, link);
            assertEquals(0, accessLayer.getElements(project, "TraceLink").size());
                  
            // test removing links without source:
            accessLayer.addElement(project, link);
            link.setTarget(c1);
            linkManager.validateLink(project, link);
            assertEquals(0, accessLayer.getElements(project, "TraceLink").size());
           
            // test removing links without target:
            accessLayer.addElement(project, link);
            link.setSource(c1);
            linkManager.validateLink(project, link);
            assertEquals(0, accessLayer.getElements(project, "TraceLink").size());
           
            // test validation of valid link:
            accessLayer.addElement(project, link);
            link.setSource(c1);
            link.setTarget(c2);
            linkManager.validateLink(project, link);
            assertEquals(1, accessLayer.getElements(project, "TraceLink").size());
        return null;
      }       
      };
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.