Bug 149972

Summary: getTargetDirectedRelationships(EClass eClass) does not return correct values on repeated calls due to cache effects
Product: [Modeling] MDT.UML2 Reporter: Alexander Nyßen <alexander>
Component: CoreAssignee: Kenn Hussey <Kenn.Hussey>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0.0   
Target Milestone: 2.0.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Alexander Nyßen CLA 2006-07-07 09:39:53 EDT
Hallo,

the following easy JUnit TestCase demonstrates that a second call to getTargetDirectedRelationships(EClass eClass) on an org.eclipse.uml2.uml.Interface Impl-Class may return wrong values (no values). I suppose this also holds for other classes who use the same implementation and is caused to a caching effect. What do you think?


import java.util.List;

import junit.framework.TestCase;

import org.eclipse.uml2.uml.UMLFactory;
import org.eclipse.uml2.uml.UMLPackage;

public class TargetDirectedRelationshipsTest extends TestCase {

	
	public void testTargetDirectedRelationships(){

		org.eclipse.uml2.uml.Class class_ = UMLFactory.eINSTANCE.createClass();
		org.eclipse.uml2.uml.Interface interface_ = UMLFactory.eINSTANCE.createInterface();
		
		class_.createInterfaceRealization("interfaceRealizatio", interface_);
		
		//!! IMPORTANT: if the following line is uncommented, test case failes due to cache effect!
		// interface_.getTargetDirectedRelationships(UMLPackage.eINSTANCE.getGeneralization());
		
		List targetRelationships = interface_.getTargetDirectedRelationships();
		List interfaceRealizationTargetRelationships = interface_.getTargetDirectedRelationships(UMLPackage.eINSTANCE.getInterfaceRealization());
		
		assertTrue(targetRelationships.size() == interfaceRealizationTargetRelationships.size());
	}
}
Comment 1 Kenn Hussey CLA 2006-07-10 09:46:37 EDT
The fix has been committed to CVS.
Comment 2 Kenn Hussey CLA 2006-07-13 14:08:10 EDT
Fixed in M200607131314.
Comment 3 Nick Boldt CLA 2008-01-28 16:36:01 EST
Move to verified as per bug 206558.