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 49417 Details for
Bug 156234
CompositeTransactionalCommandTest under-specifies test criteria for undo/redo
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch to update the test case
bug156234.patch (text/plain), 5.17 KB, created by
Christian Damus
on 2006-09-05 13:56:18 EDT
(
hide
)
Description:
Patch to update the test case
Filename:
MIME Type:
Creator:
Christian Damus
Created:
2006-09-05 13:56:18 EDT
Size:
5.17 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.gmf.tests.runtime.emf.commands.core >Index: src/org/eclipse/gmf/tests/runtime/emf/commands/core/command/CompositeTransactionalCommandTest.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/tests/org.eclipse.gmf.tests.runtime.emf.commands.core/src/org/eclipse/gmf/tests/runtime/emf/commands/core/command/CompositeTransactionalCommandTest.java,v >retrieving revision 1.1 >diff -u -r1.1 CompositeTransactionalCommandTest.java >--- src/org/eclipse/gmf/tests/runtime/emf/commands/core/command/CompositeTransactionalCommandTest.java 13 Feb 2006 19:11:10 -0000 1.1 >+++ src/org/eclipse/gmf/tests/runtime/emf/commands/core/command/CompositeTransactionalCommandTest.java 5 Sep 2006 17:57:36 -0000 >@@ -32,6 +32,10 @@ > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.NullProgressMonitor; >+import org.eclipse.emf.ecore.EObject; >+import org.eclipse.emf.ecore.EcoreFactory; >+import org.eclipse.emf.ecore.resource.Resource; >+import org.eclipse.emf.ecore.resource.impl.ResourceImpl; > import org.eclipse.emf.transaction.TransactionalEditingDomain; > import org.eclipse.gmf.runtime.common.core.command.AbstractCommand; > import org.eclipse.gmf.runtime.common.core.command.CommandResult; >@@ -82,9 +86,13 @@ > TransactionalEditingDomain domain = TransactionalEditingDomain.Factory.INSTANCE > .createEditingDomain(); > >- TransactionalTestCommand child1 = new TransactionalTestCommand(domain); >+ // create a resource to modify >+ Resource res = new ResourceImpl(org.eclipse.emf.common.util.URI.createURI("file:/foo")); //$NON-NLS-1$ >+ domain.getResourceSet().getResources().add(res); >+ >+ TransactionalTestCommand child1 = new TransactionalTestCommand(domain, res); > TestCommand child2 = new TestCommand(); >- TransactionalTestCommand child3 = new TransactionalTestCommand(domain); >+ TransactionalTestCommand child3 = new TransactionalTestCommand(domain, res); > > IUndoContext ctx = new UndoContext(); > >@@ -189,7 +197,7 @@ > > composite.remove(child); > >- child = new TransactionalTestCommand(domain); >+ child = new TransactionalTestCommand(domain, null); > composite.compose(child); > reduction = composite.reduce(); > >@@ -205,29 +213,42 @@ > > private static final String EXECUTED = "executed"; //$NON-NLS-1$ > >+ private final Resource resource; >+ private EObject testObject; >+ > private boolean executed; > > private boolean undone; > > private boolean redone; > >- public TransactionalTestCommand(TransactionalEditingDomain domain) { >+ public TransactionalTestCommand(TransactionalEditingDomain domain, Resource resource) { > super(domain, "CompositeTransactionalCommandTest", //$NON-NLS-1$ > null); >+ this.resource = resource; > } > > public TransactionalTestCommand(List affectedFiles) { > super(TransactionalEditingDomain.Factory.INSTANCE > .createEditingDomain(), "CompositeTransactionalCommandTest", //$NON-NLS-1$ > affectedFiles); >+ this.resource = null; > } > > protected CommandResult doExecuteWithResult( > IProgressMonitor progressMonitor, IAdaptable info) > throws ExecutionException { >+ >+ if (resource != null) { >+ // change my resource >+ testObject = EcoreFactory.eINSTANCE.createEPackage(); >+ resource.getContents().add(testObject); >+ } >+ > executed = true; > undone = false; > redone = false; >+ > return CommandResult.newOKCommandResult(EXECUTED); > } > >@@ -238,18 +259,35 @@ > assertEquals(IStatus.OK, getCommandResult().getStatus() > .getSeverity()); > assertSame(EXECUTED, getCommandResult().getReturnValue()); >+ >+ if (resource != null) { >+ // check that the model change was committed >+ assertTrue(resource.getContents().contains(testObject)); >+ } > } > > public void assertUndone() { > assertEquals(IStatus.OK, getCommandResult().getStatus() > .getSeverity()); >- assertNull(getCommandResult().getReturnValue()); >+ >+ if (resource != null) { >+ // check that the model change was undone >+ assertFalse(resource.getContents().contains(testObject)); >+ } else { >+ assertNull(getCommandResult().getReturnValue()); >+ } > } > > public void assertRedone() { > assertEquals(IStatus.OK, getCommandResult().getStatus() > .getSeverity()); >- assertNull(getCommandResult().getReturnValue()); >+ >+ if (resource != null) { >+ // check that the model change was redone >+ assertTrue(resource.getContents().contains(testObject)); >+ } else { >+ assertNull(getCommandResult().getReturnValue()); >+ } > } > } >
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
Actions:
View
|
Diff
Attachments on
bug 156234
: 49417