Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 337074 - [Legacy] Bugzilla_247141_Test.testContentAdapterBehavior fails in Legacy
Summary: [Legacy] Bugzilla_247141_Test.testContentAdapterBehavior fails in Legacy
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.legacy (show other bugs)
Version: 4.0   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Martin Fluegge CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-13 13:02 EST by Martin Fluegge CLA
Modified: 2012-06-19 07:08 EDT (History)
1 user (show)

See Also:
stepper: review+


Attachments
Patch v1 (1.59 KB, patch)
2011-02-13 16:29 EST, Martin Fluegge CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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