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 217025 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]
Updated test case
patch381832.txt (text/plain), 3.25 KB, created by
Szymon Ptaszkiewicz
on 2012-06-07 10:14:01 EDT
(
hide
)
Description:
Updated test case
Filename:
MIME Type:
Creator:
Szymon Ptaszkiewicz
Created:
2012-06-07 10:14:01 EDT
Size:
3.25 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..cf17d24 >--- /dev/null >+++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestConcurrentWorkspaceSave.java >@@ -0,0 +1,93 @@ >+/******************************************************************************* >+ * 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.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(); >+ } >+ } >+ >+ public void testBug() throws CoreException, InterruptedException { >+ final IWorkspace workspace = getWorkspace(); >+ String pluginId = "org.eclipse.core.tests.resources.session.TestConcurrentWorkspaceSave"; >+ try { >+ workspace.addSaveParticipant(pluginId, new BadSaveParticipant()); >+ >+ final IProject project1 = workspace.getRoot().getProject("project1"); >+ final IProject project2 = workspace.getRoot().getProject("project2"); >+ ensureExistsInWorkspace(new IResource[] {project1, project2}, true); >+ >+ Job job1 = new Job("project1 close") { >+ protected IStatus run(IProgressMonitor monitor) { >+ try { >+ project1.close(null); >+ } catch (CoreException e) { >+ return e.getStatus(); >+ } >+ return Status.OK_STATUS; >+ } >+ }; >+ Job job2 = new Job("project2 close") { >+ protected IStatus run(IProgressMonitor monitor) { >+ try { >+ project2.close(null); >+ } catch (CoreException e) { >+ return e.getStatus(); >+ } >+ return Status.OK_STATUS; >+ } >+ }; >+ job1.schedule(); >+ job2.schedule(); >+ job1.join(); >+ job2.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