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

Bug 336817

Summary: [Legacy] OCLQueryTest fails in all LEGACY scenarios
Product: [Modeling] EMF Reporter: Eike Stepper <stepper>
Component: cdo.legacyAssignee: Martin Fluegge <martin.fluegge>
Status: CLOSED FIXED QA Contact: Eike Stepper <stepper>
Severity: normal    
Priority: P3 CC: caspar_d
Version: 4.0Flags: stepper: review+
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Patch v1
none
Patch B v1
none
Patch v2
none
Patch v3 - all in one
none
Patch v4 - only legacy
none
Patch v5 none

Description Eike Stepper CLA 2011-02-10 08:24:42 EST
-- Error Log from JUnit --
Class: org.eclipse.emf.cdo.tests.OCLQueryTest
Method: testAllProducts
Actual: null
Expected: null
Stack Trace:
org.eclipse.emf.cdo.tests.config.impl.ConfigTestException: Error in OCLQueryTest.testAllProducts [Combined, MEMBranches, JVM, Legacy]
	at org.eclipse.emf.cdo.tests.config.impl.ConfigTest.runBare(ConfigTest.java:476)
	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)
Caused by: org.eclipse.net4j.signal.RemoteException: org.eclipse.net4j.util.WrappedException: Problem executing OCL query: Product1.allInstances()
	at org.eclipse.net4j.signal.RequestWithConfirmation.setRemoteException(RequestWithConfirmation.java:128)
	at org.eclipse.net4j.signal.SignalProtocol.handleRemoteException(SignalProtocol.java:423)
	at org.eclipse.net4j.signal.RemoteExceptionIndication.indicating(RemoteExceptionIndication.java:63)
	at org.eclipse.net4j.signal.Indication.doExtendedInput(Indication.java:55)
	at org.eclipse.net4j.signal.Signal.doInput(Signal.java:326)
	at org.eclipse.net4j.signal.Indication.execute(Indication.java:49)
	at org.eclipse.net4j.signal.Signal.runSync(Signal.java:251)
	at org.eclipse.net4j.signal.Signal.run(Signal.java:147)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
	at java.lang.Thread.run(Thread.java:595)
Caused by: org.eclipse.net4j.util.WrappedException: Problem executing OCL query: Product1.allInstances()
	at org.eclipse.net4j.util.WrappedException.wrap(WrappedException.java:40)
	at org.eclipse.emf.cdo.server.ocl.OCLQueryHandler.executeQuery(OCLQueryHandler.java:180)
	at org.eclipse.emf.cdo.internal.server.QueryManager$QueryContext.run(QueryManager.java:284)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
	at java.util.concurrent.FutureTask.run(FutureTask.java:123)
	... 3 more
Caused by: java.lang.IllegalStateException: Invalid result: org.eclipse.emf.ecore.impl.DynamicEObjectImpl@cce92a5 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@4dfd9534 (name: OclInvalid_Class) (instanceClassName: null) (abstract: false, interface: false))
	at org.eclipse.emf.cdo.server.ocl.OCLQueryHandler.executeQuery(OCLQueryHandler.java:175)
	... 7 more
Comment 1 Eike Stepper CLA 2011-02-10 08:25:26 EST
Maybe some configuration of the server side is missing?
Comment 2 Eike Stepper CLA 2011-02-10 08:26:14 EST
I added skipConfig(LEGACY);

Please investigate when you have time...
Comment 3 Martin Fluegge CLA 2011-02-11 11:29:09 EST
The problem was introduced with the changes from Bug 334995. The AbstractCDOView (789) throws an exception when it tries to set the name, which should happen because this change is triggered from the view which actually does not allow modification of objects.
Comment 4 Martin Fluegge CLA 2011-02-11 11:32:34 EST
Created attachment 188793 [details]
Patch v1

I attached a patch which fixes the problem by checking if the modification could work. Unfortunately this introduces a reference to CDOTransaction to the AbstractCDOView which I think is not a good design. But since this check is already done in the class this could be ok. 

I would prefer a method like *isTranactional()* in the CDOView which would provide a cleaner seperation between Views and Transactions. 

Eike, please let us discuss this.
Comment 5 Martin Fluegge CLA 2011-02-11 14:10:23 EST
Created attachment 188808 [details]
Patch B v1

I hit the road again and had a closer look why legacy tries to create the resource multiple times. 

Finally found it in the recursion of legacy itself. The old problem that a legacy object is not registered to the view before the whole tree is build up popped up again. Actually legacy has mechanisms to prevent this but these failed since a CDOResource is no legacy object. I do not want to deliver a to detailed description since my had is still acing from all this recursive stuff ;)

I attached a patch to solve the problem. Named it "Patch B v1". Eike, I hope the naming is correct this time ;)

But I still believe the former patch should be discussed as well as the creation of a isTransactional() method. I cc'ed Caspar. maybe he has some opinions on this.
Comment 6 Martin Fluegge CLA 2011-02-11 15:27:05 EST
Created attachment 188813 [details]
Patch v2

Attached patch which uses isReadOnly() as increment for patch v1.
Comment 7 Eike Stepper CLA 2011-02-12 03:06:22 EST
Martin, the patches are both not workspace relative. Note that Subversive does not remember the last patch format choice ;-(

AbstractCDOView.newResourceInstance(InternalCDORevision):
I'm not sure if simply ignoring the situation that is discovered by Caspar's new check is a good idea. Caspar, can you please review Martin's change?
Comment 8 Eike Stepper CLA 2011-02-12 03:07:11 EST
Created attachment 188827 [details]
Patch v3 - all in one
Comment 9 Martin Fluegge CLA 2011-02-12 07:33:16 EST
I'd suggest to split up the patches again so we can solve this issue with the legacy patch and move the other patch as base for a discussion to Bug 334995.
Comment 10 Eike Stepper CLA 2011-02-12 09:06:57 EST
Ok ;-)
Comment 11 Martin Fluegge CLA 2011-02-12 10:41:59 EST
Created attachment 188835 [details]
Patch v4 - only legacy

Only the legacy changes. Please review.
Comment 12 Martin Fluegge CLA 2011-02-13 12:49:45 EST
Created attachment 188851 [details]
Patch v5

Forgot do include the re-enabling of the testrun for legacy in the patch. It's now included in the patch.
Comment 13 Martin Fluegge CLA 2011-02-13 15:38:11 EST
Committed revision 7070:
- trunk/plugins/org.eclipse.emf.cdo
- trunk/plugins/org.eclipse.emf.cdo.tests
Comment 14 Martin Fluegge CLA 2011-02-13 16:22:43 EST
Resolved fixed.
Comment 15 Eike Stepper CLA 2011-06-23 03:38:25 EDT
Available in R20110608-1407