Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 232381 - Invalid tests generated when using Maps
Summary: Invalid tests generated when using Maps
Status: VERIFIED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: Tools (show other bugs)
Version: 2.4.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Dave Steinberg CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 204200
  Show dependency tree
 
Reported: 2008-05-15 14:36 EDT by Will Horn CLA
Modified: 2008-05-20 13:47 EDT (History)
2 users (show)

See Also:


Attachments
Fix to create a map entry properly. (22.05 KB, patch)
2008-05-15 19:03 EDT, Ed Merks CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Will Horn CLA 2008-05-15 14:36:52 EDT
Build ID: 3.4 M7

In 2.4M7 I am having invalid tests generated when using Maps.  Here is a sample ecore that demonstrates the issue:

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
    xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="abc"
    nsURI="http://www.example.com/abc" nsPrefix="abc">
  <eClassifiers xsi:type="ecore:EClass" name="A">
    <eStructuralFeatures xsi:type="ecore:EReference" name="B" upperBound="-1" eType="#//StringToStringMapEntry"
        containment="true"/>
  </eClassifiers>
  <eClassifiers xsi:type="ecore:EClass" name="StringToStringMapEntry" instanceClassName="java.util.Map$Entry">
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="key" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
    <eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
  </eClassifiers>
</ecore:EPackage>

When I create an EMF model from that and generate the model and the tests, I get StringToStringMapEntryTest.java created that calls
AbcFactory.eINSTANCE.createStringToStringMapEntry() which does not exist.
Comment 1 Ed Merks CLA 2008-05-15 19:03:49 EDT
Created attachment 100571 [details]
Fix to create a map entry properly.

I suppose the alternative is to not generate a test case for a map entry class...
Comment 2 Ed Merks CLA 2008-05-16 19:31:25 EDT
The fix is committed to CVS.
Comment 3 Ed Merks CLA 2008-05-16 19:31:56 EDT
Marking it fixed...
Comment 4 Ed Merks CLA 2008-05-17 10:57:35 EDT
Kenn,

This affects UML2's compiled templates.
Comment 5 Nick Boldt CLA 2008-05-20 13:47:32 EDT
Fix available in HEAD: 2.4.0RC1 (S200805201049).