| Summary: | [DB] Complete core mappings for Ecore data types | ||
|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Eike Stepper <stepper> |
| Component: | cdo.db | Assignee: | Eike Stepper <stepper> |
| Status: | CLOSED FIXED | QA Contact: | Eike Stepper <stepper> |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | give.a.damus |
| Version: | 4.2 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | Appealing to a Broader Community | ||
|
Description
Eike Stepper
Moving all open issues to 4.2. Open bugs can be ported to 4.1 maintenance after they've been fixed in master. This bug was raised to follow up a discussion on the newsgroup: http://www.eclipse.org/forums/index.php/m/717956/#msg_717956 The same problem happens for attributes of type EJavaObject. There are a few of these in the EMF Facet models that Papyrus uses and would need to be persisted in a CDO Repository if and when it implements support for sharing models via CDO. I see that this item is marked as an enhancement. It was admitted in the newsgroup discussion as a regression from the 3.0 release. Shouldn't that at least make the severity "normal"? I added these test cases to AttributeTest: /** * Bug 355787. */ public void testJavaClass() throws Exception { CDOSession session = openSession(); CDOTransaction transaction = session.openTransaction(); CDOResource resource = transaction.createResource(getResourcePath("/my/resource")); resource.getContents().add(createClassWithJavaClassAttribute(CDOTransaction.class)); resource.getContents().add(createClassWithJavaClassAttribute(boolean.class)); resource.getContents().add(createClassWithJavaClassAttribute(byte.class)); resource.getContents().add(createClassWithJavaClassAttribute(char.class)); resource.getContents().add(createClassWithJavaClassAttribute(double.class)); resource.getContents().add(createClassWithJavaClassAttribute(float.class)); resource.getContents().add(createClassWithJavaClassAttribute(int.class)); resource.getContents().add(createClassWithJavaClassAttribute(long.class)); resource.getContents().add(createClassWithJavaClassAttribute(short.class)); transaction.commit(); session.close(); session = openSession(); transaction = session.openTransaction(); resource = transaction.getResource(getResourcePath("/my/resource")); EList<EObject> contents = resource.getContents(); assertEquals(CDOTransaction.class, ((ClassWithJavaClassAttribute)contents.get(0)).getJavaClass()); assertEquals(boolean.class, ((ClassWithJavaClassAttribute)contents.get(1)).getJavaClass()); assertEquals(byte.class, ((ClassWithJavaClassAttribute)contents.get(2)).getJavaClass()); assertEquals(char.class, ((ClassWithJavaClassAttribute)contents.get(3)).getJavaClass()); assertEquals(double.class, ((ClassWithJavaClassAttribute)contents.get(4)).getJavaClass()); assertEquals(float.class, ((ClassWithJavaClassAttribute)contents.get(5)).getJavaClass()); assertEquals(int.class, ((ClassWithJavaClassAttribute)contents.get(6)).getJavaClass()); assertEquals(long.class, ((ClassWithJavaClassAttribute)contents.get(7)).getJavaClass()); assertEquals(short.class, ((ClassWithJavaClassAttribute)contents.get(8)).getJavaClass()); } private ClassWithJavaClassAttribute createClassWithJavaClassAttribute(Class<?> javaClass) { ClassWithJavaClassAttribute object = getModel3Factory().createClassWithJavaClassAttribute(); object.setJavaClass(javaClass); return object; } /** * Bug 355787. */ public void testJavaObject() throws Exception { Map<String, Number> salaries = new HashMap<String, Number>(); salaries.put("Eike", 5000); salaries.put("Martin", 6000.99); salaries.put("Ed", 7000f); CDOSession session = openSession(); CDOTransaction transaction = session.openTransaction(); CDOResource resource = transaction.createResource(getResourcePath("/my/resource")); resource.getContents().add(createClassWithJavaObjectAttribute(salaries)); transaction.commit(); session.close(); session = openSession(); transaction = session.openTransaction(); resource = transaction.getResource(getResourcePath("/my/resource")); EList<EObject> contents = resource.getContents(); assertEquals(salaries, ((ClassWithJavaObjectAttribute)contents.get(0)).getJavaObject()); } private ClassWithJavaObjectAttribute createClassWithJavaObjectAttribute(Object javaObject) { ClassWithJavaObjectAttribute object = getModel3Factory().createClassWithJavaObjectAttribute(); object.setJavaObject(javaObject); return object; } Working on support for EJavaClass and EJavaObject now... I see that the new tests for EJavaClass and EJavaObject are integrated into the test suite and pass. Does that mean that this bug is fixed? If so, why is it in assigned state? Is there anything left to be done? I added: org.eclipse.emf.cdo.common.model.CDOType.JAVA_CLASS org.eclipse.emf.cdo.common.model.CDOType.JAVA_OBJECT org.eclipse.emf.cdo.server.internal.db.mapping.CoreTypeMappings.TMJavaClass (maps to VARCHAR) org.eclipse.emf.cdo.server.internal.db.mapping.CoreTypeMappings.TMJavaObject (maps to BLOB) All tests are passing now. commit e1ffd285ca47297325024e329de6546b4993f376 (In reply to comment #4) > I see that the new tests for EJavaClass and EJavaObject are integrated into the > test suite and pass. Does that mean that this bug is fixed? If so, why is it > in assigned state? Is there anything left to be done? Strange. Now that I looked at this Mylyn task again, I even had the final resolution comment in place locally, just not submitted it. I can't imagine of another reason than just having forgotten about it. Thanks for the ping ;-) Available in R20130613-1157 (4.2) |