Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 337074

Summary: [Legacy] Bugzilla_247141_Test.testContentAdapterBehavior fails in Legacy
Product: [Modeling] EMF Reporter: Martin Fluegge <martin.fluegge>
Component: cdo.legacyAssignee: Martin Fluegge <martin.fluegge>
Status: CLOSED FIXED QA Contact: Eike Stepper <stepper>
Severity: normal    
Priority: P3 CC: vroldanbet
Version: 4.0Flags: stepper: review+
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch v1 none

Description Martin Fluegge CLA 2011-02-13 13:02:19 EST
There is an failure when executing Bugzilla_247141_Test.testContentAdapterBehavior. This only occurs in legacy.

junit.framework.AssertionFailedError: expected:<true> but was:<false>
	at junit.framework.Assert.fail(Assert.java:47)
	at junit.framework.Assert.failNotEquals(Assert.java:283)
	at junit.framework.Assert.assertEquals(Assert.java:64)
	at junit.framework.Assert.assertEquals(Assert.java:143)
	at junit.framework.Assert.assertEquals(Assert.java:149)
	at org.eclipse.emf.cdo.tests.bugzilla.Bugzilla_247141_Test.testContentAdapterBehaviour(Bugzilla_247141_Test.java:81)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at org.eclipse.net4j.util.tests.AbstractOMTest.runBare(AbstractOMTest.java:200)
	at org.eclipse.emf.cdo.tests.config.impl.ConfigTest.runBare(ConfigTest.java:467)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at org.eclipse.net4j.util.tests.AbstractOMTest.run(AbstractOMTest.java:246)
	at junit.framework.TestSuite.runTest(TestSuite.java:232)
	at org.eclipse.emf.cdo.tests.config.impl.ConfigTestSuite$TestWrapper.runTest(ConfigTestSuite.java:126)
	at junit.framework.TestSuite.run(TestSuite.java:227)
	at junit.framework.TestSuite.runTest(TestSuite.java:232)
	at junit.framework.TestSuite.run(TestSuite.java:227)
	at junit.framework.TestSuite.runTest(TestSuite.java:232)
	at junit.framework.TestSuite.run(TestSuite.java:227)
	at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Comment 1 Martin Fluegge CLA 2011-02-13 16:29:38 EST
Created attachment 188857 [details]
Patch v1

The problem was that the CDOLazyContentAdapter check the object's resource to find out whether the object is contained or not. But this check is done before cdoInternalPostLoad() is called on the object and hence the internal instance is not filled with the correct value. So the resource is not set and calling object.cdoResource() always delivers null.
I enhanced the method to make sure that the resource is always set when this method is called.
Comment 2 Victor Roldan Betancort CLA 2011-02-14 05:38:16 EST
Thanks Martin, it seems to pass now :)

If Eike agrees, this shall be committed.

Cheers!
Comment 3 Martin Fluegge CLA 2011-02-14 16:10:28 EST
Committed revision 7077
Comment 4 Eike Stepper CLA 2011-06-23 03:42:25 EDT
Available in R20110608-1407