Examples of TraceLink


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

Examples of org.emftrace.metamodel.LinkModel.TraceLink

      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

Examples of org.emftrace.metamodel.LinkModel.TraceLink

      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

Examples of org.emftrace.metamodel.LinkModel.TraceLink

             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

Examples of org.emftrace.metamodel.LinkModel.TraceLink

            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

Examples of sg.edu.nus.comp.simTL.engine.tracing.TraceLink

     
     
      template.addChildTo(tParent, tParent2tChildRef, tChild, position, context);
      //introduce trace link!!
      modelCorrespondence.add(
          new TraceLink(
            (StaticContext)context, //neighbor has the same context presumably
            new TraceLinkNode(
              template,
              tChild
            ),
View Full Code Here

Examples of sg.edu.nus.comp.simTL.engine.tracing.TraceLink

   * @return
   * @throws SimTLException
   */
  private EObjectTraceLinkReturnContainer findTObject(EObject tiObject) throws SimTLException{
    EObject tObject = null;
    TraceLink tl = null;
    int i = 0;
    for(TraceLinkNode tObjectTLN : modelCorrespondence.getCorrespondingElement(tiObject)){
      if(tObjectTLN.getModel().getModelType()!=ModelType.TEMPLATE_MODEL){
        throw new SynchronizingException("ME2MELink pointed from template instance to " + tObjectTLN.getModel().getModelType().toString());
      }
View Full Code Here

Examples of sg.edu.nus.comp.simTL.engine.tracing.TraceLink

        //negate if condition
        parameterModelHandler.negateCondition(new TIfStatement(tObject,context,template), true);
       
        //introduce trace link
        modelCorrespondence.add(
            new TraceLink(
              (StaticContext)context, //context is been adapted
              new TraceLinkNode(
                template,
                tChild
              ),
              new TraceLinkNode(
                instance,
                tiChild
              )
            ));
       
      } else if(TForLoop.isTForLoop(tObject)){
        TForLoop forLoop = new TForLoop(tObject, context, template);
        EObject neighborInputElement = context.getVariableValue(forLoop.getName());
       
        Reference2Element pPointerToList = (Reference2Element)forLoop.getSetToBeIterated().getReferenceFromParent();
        List<EObject> parameterList = (List<EObject>)pPointerToList.getReferencedValue();
        if(parameterList.size()>0
            && (neighborInputElement==null
              ||!parameterList.contains(neighborInputElement))){
          throw new SimTLException("InputModel collection doesn't contain neighbor input element. It does contain other elements though");
         
        }
       
        Reference2Element pPointerToListElement = (Reference2Element)pPointerToList;
        EClass pClass = pPointerToListElement.getReferenceToChildren().getEReferenceType();
        //create new inputElement
        EObject pElement = pClass.getEPackage().getEFactoryInstance().create(pClass);
       
       
        if(pElement==null) throw new SimTLException("Couldn't instantiate parameter element type " + pClass.getName());
       
        //Add element to parameter model
        if(parameterList.size()>1){
          //It must be a new iteration => Existing is covered in position above
          boolean insertToRightOfParam = ((NewIterationAddAllocation)grayElementAddAllocation).isInsertToRightOfParam();
          int neighborIndex = parameterList.indexOf(neighborInputElement);
          int pIndex =
            insertToRightOfParam
              ?neighborIndex+1
              :neighborIndex;
          parameterModelHandler.addElement(pElement, pIndex, pPointerToList);
        } else {
          parameterModelHandler.addElement(pElement, Util.NO_POSITION, pPointerToList);
        }
       
        //Update context
        context = addVariableToContext(context, forLoop.getName(), pElement);
        //introduce trace link
        modelCorrespondence.add(
            new TraceLink(
              (StaticContext)context, //context is been adapted
              new TraceLinkNode(
                template,
                tChild
              ),
View Full Code Here

Examples of sg.edu.nus.comp.simTL.engine.tracing.TraceLink

//        }
//      }
    }
   
    modelCorrespondence.add(
        new TraceLink(
          currentContext.saveToStaticContext(),
          new TraceLinkNode(
            template,
            tObject
          ),
View Full Code Here

Examples of sg.edu.nus.comp.simTL.engine.tracing.TraceLink

    }
    //TODO validate that not both attribute and placeholder are set
   
    if(checkActualAttribute(tAttributeClass,iAttributeClass,tObject,iObject)){
      modelCorrespondence.add(
          new TraceLink(
            currentContext.saveToStaticContext(),
            new TraceLinkNode(
              template,
              new Reference2Attribute(
                tObject,
                tAttributeClass
              )
            ),
            new TraceLinkNode(
              instance,
              new Reference2Attribute(
                iObject,
                iAttributeClass
              )
            )
          ));
    } else{
      ReferenceFromParent refFromParent =
        checkPlaceholder(tAttributeClass,iAttributeClass,tObject,iObject);
      if(refFromParent!=null){
        //HANDLE TRACELINK
        //1) importedModel - resultModel
        StaticContext staticContext = currentContext.saveToStaticContext();
        modelCorrespondence.add(
          new TraceLink(
            staticContext,
            new TraceLinkNode(
              getImportedModel(refFromParent.getParent().eResource()),
              (Reference2Attribute)refFromParent
            ),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.