Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 111080 Details for
Bug 245393
Allow transaction reuse in direct command execution
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
JUnit to demonstrate the desired behaviour.
245393_junit_patch.txt (text/plain), 2.66 KB, created by
Linda Damus
on 2008-08-27 11:06:55 EDT
(
hide
)
Description:
JUnit to demonstrate the desired behaviour.
Filename:
MIME Type:
Creator:
Linda Damus
Created:
2008-08-27 11:06:55 EDT
Size:
2.66 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.emf.workspace.tests >Index: src/org/eclipse/emf/workspace/tests/AbstractEMFOperationTest.java >=================================================================== >RCS file: /cvsroot/modeling/org.eclipse.emf/org.eclipse.emf.transaction/tests/org.eclipse.emf.workspace.tests/src/org/eclipse/emf/workspace/tests/AbstractEMFOperationTest.java,v >retrieving revision 1.9 >diff -u -r1.9 AbstractEMFOperationTest.java >--- src/org/eclipse/emf/workspace/tests/AbstractEMFOperationTest.java 13 Aug 2008 13:24:47 -0000 1.9 >+++ src/org/eclipse/emf/workspace/tests/AbstractEMFOperationTest.java 27 Aug 2008 15:05:23 -0000 >@@ -45,6 +45,7 @@ > import org.eclipse.emf.transaction.Transaction; > import org.eclipse.emf.transaction.TransactionalEditingDomain; > import org.eclipse.emf.transaction.TriggerListener; >+import org.eclipse.emf.transaction.impl.InternalTransaction; > import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain; > import org.eclipse.emf.workspace.AbstractEMFOperation; > import org.eclipse.emf.workspace.CompositeEMFOperation; >@@ -787,6 +788,47 @@ > domain.removeResourceSetListener(listener); > } > } >+ >+ /** >+ * Tests that execution of an AbstractEMFOperation can be made to reuse the >+ * active transaction. >+ */ >+ public void test_executeInActiveTransaction_245343() { >+ IUndoableOperation operation = new AbstractEMFOperation(domain, >+ "Test_executeInActiveTransaction") { //$NON-NLS-1$ >+ >+ @Override >+ protected IStatus doExecute(IProgressMonitor monitor, >+ IAdaptable info) throws ExecutionException { >+ >+ final InternalTransaction outer = ((InternalTransactionalEditingDomain) domain).getActiveTransaction(); >+ AbstractEMFOperation delegate = new AbstractEMFOperation( >+ domain, "Test_executeInActiveTransaction_delegate") { //$NON-NLS-1$ >+ >+ @Override >+ protected IStatus doExecute(IProgressMonitor monitor, >+ IAdaptable info) throws ExecutionException { >+ >+ return (outer == ((InternalTransactionalEditingDomain) domain).getActiveTransaction()) ? Status.OK_STATUS >+ : Status.CANCEL_STATUS; >+ } >+ }; >+ >+ // Invoke some API here to indicate reuse of the parent transaction, for example: >+ // delegate.setReuseParentTransaction(true); >+ >+ IStatus status = delegate.execute(monitor, info); >+ assertTrue("Should have reused the parent transaction", status.isOK()); >+ return Status.OK_STATUS; >+ } >+ }; >+ >+ try { >+ operation.execute(new NullProgressMonitor(), null); >+ } catch (Exception e) { >+ fail("Unexpected exception: " + e.getLocalizedMessage()); //$NON-NLS-1$ >+ } >+ } > > // > // Fixtures
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
give.a.damus
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 245393
: 111080