linkManager.validateTrace(project, (Trace)null);
assertEquals(1, accessLayer.getElements(project, "Trace").size());
linkManager.validateTrace(null, (Trace)null);
assertEquals(1, accessLayer.getElements(project, "Trace").size());
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);
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);