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 216914 Details for
Bug 381832
Concurrent workspace save operations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Test case
patch.txt (text/plain), 3.35 KB, created by
Szymon Ptaszkiewicz
on 2012-06-06 05:20:48 EDT
(
hide
)
Description:
Test case
Filename:
MIME Type:
Creator:
Szymon Ptaszkiewicz
Created:
2012-06-06 05:20:48 EDT
Size:
3.35 KB
patch
obsolete
>diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestConcurrentWorkspaceSave.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestConcurrentWorkspaceSave.java >new file mode 100644 >index 0000000..95eebe7 >--- /dev/null >+++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestConcurrentWorkspaceSave.java >@@ -0,0 +1,98 @@ >+/******************************************************************************* >+ * Copyright (c) 2012 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.core.tests.resources.session; >+ >+import org.eclipse.core.resources.*; >+import org.eclipse.core.runtime.*; >+import org.eclipse.core.runtime.jobs.ISchedulingRule; >+import org.eclipse.core.runtime.jobs.Job; >+import org.eclipse.core.tests.resources.ResourceTest; >+ >+/** >+ * Test for concurrent workspace save >+ */ >+public class TestConcurrentWorkspaceSave extends ResourceTest { >+ private static class BadSaveParticipant implements ISaveParticipant { >+ public BadSaveParticipant() { >+ } >+ >+ private void runWorkspaceOperation() { >+ try { >+ getWorkspace().run(new IWorkspaceRunnable() { >+ public void run(IProgressMonitor monitor) { >+ // noop >+ } >+ }, null, 0, null); >+ } catch (CoreException e) { >+ fail("1.0", e); >+ } >+ } >+ >+ public void prepareToSave(ISaveContext context) { >+ runWorkspaceOperation(); >+ } >+ >+ public void saving(ISaveContext context) { >+ runWorkspaceOperation(); >+ } >+ >+ public void doneSaving(ISaveContext context) { >+ runWorkspaceOperation(); >+ } >+ >+ public void rollback(ISaveContext context) { >+ runWorkspaceOperation(); >+ } >+ } >+ >+ private static class InvalidRule implements ISchedulingRule { >+ public InvalidRule() { >+ } >+ >+ public boolean isConflicting(ISchedulingRule rule) { >+ return this == rule; >+ } >+ >+ public boolean contains(ISchedulingRule rule) { >+ return this == rule || getWorkspace().getRoot().contains(rule); >+ } >+ } >+ >+ public void testBug() throws CoreException, InterruptedException { >+ final IWorkspace workspace = getWorkspace(); >+ String pluginId = "org.eclipse.core.tests.resources.session.TestBug149121"; >+ try { >+ workspace.addSaveParticipant(pluginId, new BadSaveParticipant()); >+ >+ // ask for snapshot >+ workspace.save(false, getMonitor()); >+ >+ // run full save with invalid rule (bug 381724) >+ Job job = new Job("full save") { >+ protected IStatus run(IProgressMonitor monitor) { >+ ISchedulingRule rule = new InvalidRule(); >+ Job.getJobManager().beginRule(rule, getMonitor()); >+ try { >+ workspace.save(true, getMonitor()); >+ } catch (CoreException e) { >+ fail("1.0", e); >+ } >+ Job.getJobManager().endRule(rule); >+ return Status.OK_STATUS; >+ } >+ }; >+ job.schedule(); >+ job.join(); >+ } finally { >+ workspace.removeSaveParticipant(pluginId); >+ } >+ } >+}
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 381832
:
216914
|
217025