Package org.emftrace.metamodel.LinkModel

Examples of org.emftrace.metamodel.LinkModel.TraceLink


            accessLayer.addElement(project, concern1);
            accessLayer.addElement(project, concern2);
            accessLayer.addElement(project, concern3);
            accessLayer.addElement(project, concern4);
                   
            TraceLink link1 = LinkModelFactory.eINSTANCE.createTraceLink();
            TraceLink link2 = LinkModelFactory.eINSTANCE.createTraceLink();
            accessLayer.addElement(project, link1);
            accessLayer.addElement(project, link2);
           
            link1.setSource(concern1);
            link1.setTarget(concern2);
            link2.setSource(concern2);
            link2.setTarget(concern3);
                
            // create the transitive trace:
            linkManager.addToTrace(project, trace, link1);
            linkManager.addToTrace(project, trace, link2);
           
            assertEquals(1, accessLayer.getElements(project, "Trace").size());
            linkManager.validateTrace(project, trace);
            assertEquals(1, accessLayer.getElements(project, "Trace").size());
           
            // break the transitive relation:
            link2.setSource(null);
            link2.setSource(concern3);
           
            linkManager.validateTrace(project, trace);
            assertEquals(0, accessLayer.getElements(project, "Trace").size());
           
            // now test splitting one trace into 2 traces (first create such a trace):
            TraceLink link3 = LinkModelFactory.eINSTANCE.createTraceLink();
            TraceLink link4 = LinkModelFactory.eINSTANCE.createTraceLink();
            accessLayer.addElement(project, link3);
            accessLayer.addElement(project, link4);       
            accessLayer.addElement(project, trace);
   
            linkManager.addToTrace(project, trace, link1);
            linkManager.addToTrace(project, trace, link2);
            linkManager.addToTrace(project, trace, link3);
            linkManager.addToTrace(project, trace, link4);
           
            link2.setSource(concern2);
           
            Concern concern5 = URNModelFactory.eINSTANCE.createConcern();
            Concern concern6 = URNModelFactory.eINSTANCE.createConcern();
            accessLayer.addElement(project, concern5);
            accessLayer.addElement(project, concern6);
                   
            link3.setSource(concern4);
            link3.setTarget(concern5);
            link4.setSource(concern5);
            link4.setTarget(concern6);
           
            assertEquals(4, trace.getTraceabilityLinks().size());
            assertEquals(1, accessLayer.getElements(project, "Trace").size());
           
            // the trace consisting of 2 transitive links (each consisting of 2 links) should be splitted into
View Full Code Here


      Callable<Void> call = new Callable<Void>()
      {
      @Override
      public Void call() throws Exception
      {
            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);
           
            assertTrue(linkManager.checkForDirectRelationship(link1, link2));
           
            // destroy the transitive relation:
            Concern concern4 = URNModelFactory.eINSTANCE.createConcern();
            accessLayer.addElement(project, concern4);
            link2.setSource(null);
            link2.setSource(concern4);
           
            assertFalse(linkManager.checkForDirectRelationship(link1, link2));
        return null;
      }       
      };
View Full Code Here

      Callable<Void> call = new Callable<Void>()
      {
      @Override
      public Void call() throws Exception
      {
            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();
            Concern concern4 = URNModelFactory.eINSTANCE.createConcern();
            accessLayer.addElement(project, concern1);
            accessLayer.addElement(project, concern2);
            accessLayer.addElement(project, concern3);
            accessLayer.addElement(project, concern4);
           
            // create a transitive relation:
            link1.setSource(concern1);
            link1.setTarget(concern2);
            link2.setSource(concern2);
            link2.setTarget(concern3);
           
            List<TraceLink> list = new ArrayList<TraceLink>();
            list.clear();
            assertNull(linkManager.checkForIndirectRelationships(null));
            assertEquals(0, linkManager.checkForIndirectRelationships(list).size());
            list.add(link1);
            list.add(link2);
           
            assertEquals(2, linkManager.checkForIndirectRelationships(list).size());
            assertEquals(2, linkManager.checkForIndirectRelationships(list).get(0).size());
            assertEquals(0, linkManager.checkForIndirectRelationships(list).get(1).size());
           
            // check with non-transitive links:
            link2.setSource(null);
            link2.setSource(concern3);
       
            assertEquals(2, linkManager.checkForIndirectRelationships(list).size());
            assertEquals(1, linkManager.checkForIndirectRelationships(list).get(0).size());
            assertEquals(1, linkManager.checkForIndirectRelationships(list).get(1).size());
        return null;
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

            container = LinkModelFactory.eINSTANCE.createLinkContainer();
            accessLayer.addElement(project, container);
          } else container = (LinkContainer)tmp.get(0);
        }
       
        TraceLink link = LinkModelFactory.eINSTANCE.createTraceLink();    
         
        link.setSource(source);
        link.setTarget(target);
              
        link.setType(type);
       
        String sourceName = accessLayer.getNameOfModel(source);
        String targetName = accessLayer.getNameOfModel(target);
        String linkName = "\"" + sourceName + "\" -> " + type.getName() + " -> \"" + targetName + "\"";
        link.setName(linkName);       
       
        String tmp = Calendar.getInstance().getTime().toString();
        link.setLastModified(tmp);
        link.setLastVisited(tmp);
               
        if( rule != null ) link.setCreatedByRule(rule);
       
        accessLayer.addElement(project, link);
        container.getLinks().add(link);       
                            
        if( isLoggingEnabled )
View Full Code Here

            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

      Callable<Void> call = new Callable<Void>()
      {
      @Override
      public Void call() throws Exception
      {
            TraceLink link = LinkModelFactory.eINSTANCE.createTraceLink();
            accessLayer.addElement(project, link);
                   
            List<EObject> list = new ArrayList<EObject>();
            list.clear();
           
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);
           
            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

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.