Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Bull2010-03-30 22:26:28 +0000
committerIan Bull2010-03-30 22:26:28 +0000
commit3ad938e16227692213f76b5b58571cc8549eb171 (patch)
treeed632a00d3f30d7614f5a06bad2e8fc33f56bc1c /bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact
parent8ddf94526a1ff72f60b38fabfa1932c004d2d82b (diff)
downloadrt.equinox.p2-3ad938e16227692213f76b5b58571cc8549eb171.tar.gz
rt.equinox.p2-3ad938e16227692213f76b5b58571cc8549eb171.tar.xz
rt.equinox.p2-3ad938e16227692213f76b5b58571cc8549eb171.zip
bug 305237: [repository] Handle operation cancelled exception in execute batch
https://bugs.eclipse.org/bugs/show_bug.cgi?id=305237
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/BatchExecuteArtifactRepositoryTest.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/BatchExecuteArtifactRepositoryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/BatchExecuteArtifactRepositoryTest.java
index ba65a7ba9..ca1065c99 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/BatchExecuteArtifactRepositoryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/BatchExecuteArtifactRepositoryTest.java
@@ -302,6 +302,31 @@ public class BatchExecuteArtifactRepositoryTest extends AbstractProvisioningTest
/*
* This tests that exceptions are properly propagated for a CompositeRepository
*/
+ public void testBatchProcessingCancelled() {
+ try {
+ Map properties = new HashMap();
+ repositoryFile = getTempFolder();
+ repositoryURI = repositoryFile.toURI();
+ SimpleArtifactRepository repo = (SimpleArtifactRepository) getArtifactRepositoryManager().createRepository(repositoryURI, "My Repo", IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, properties);
+ IProgressMonitor monitor = new NullProgressMonitor();
+ monitor.setCanceled(true);
+
+ IStatus status = repo.executeBatch(new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) {
+ if (monitor.isCanceled())
+ throw new OperationCanceledException();
+ }
+ }, monitor);
+
+ assertTrue(status.getSeverity() == IStatus.CANCEL);
+ } catch (Exception e) {
+ fail("Test failed", e);
+ }
+ }
+
+ /*
+ * This tests that exceptions are properly propagated for a CompositeRepository
+ */
public void testBatchProcessingExceptionsComposite() {
try {
FailingCompositeArtifactRepository compositeArtifactRepository = new FailingCompositeArtifactRepository(getArtifactRepositoryManager(), "foo", new URI("http://foo.bar"), null);

Back to the top