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 87653 Details for
Bug 128709
Need an openRule to support concurrent project checkout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposal 02 tests
128709_20030123_tests.txt (text/plain), 8.47 KB, created by
Szymon Brandys
on 2008-01-23 10:02:11 EST
(
hide
)
Description:
Proposal 02 tests
Filename:
MIME Type:
Creator:
Szymon Brandys
Created:
2008-01-23 10:02:11 EST
Size:
8.47 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.core.tests.resources >Index: src/org/eclipse/core/tests/resources/NatureTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/NatureTest.java,v >retrieving revision 1.11 >diff -u -r1.11 NatureTest.java >--- src/org/eclipse/core/tests/resources/NatureTest.java 17 Jul 2006 15:00:15 -0000 1.11 >+++ src/org/eclipse/core/tests/resources/NatureTest.java 23 Jan 2008 15:01:47 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2005 IBM Corporation and others. >+ * Copyright (c) 2000, 2008 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 >@@ -13,7 +13,9 @@ > import junit.framework.Test; > import junit.framework.TestSuite; > import org.eclipse.core.resources.*; >-import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.*; >+import org.eclipse.core.runtime.jobs.IJobManager; >+import org.eclipse.core.runtime.jobs.Job; > import org.eclipse.core.tests.internal.resources.SimpleNature; > > /** >@@ -59,7 +61,7 @@ > try { > IProjectDescription desc = project.getDescription(); > desc.setNatureIds(natures); >- int flags = IResource.KEEP_HISTORY; >+ int flags = IResource.KEEP_HISTORY ; > if (silent) > flags |= IResource.AVOID_NATURE_CONFIG; > project.setDescription(desc, flags, getMonitor()); >@@ -214,4 +216,47 @@ > } > } > } >+ >+ /** >+ * Test addition of nature that requires the workspace root. >+ * See bugs 127562 and 128709. >+ */ >+ public void testBug127562Nature() { >+ IWorkspace ws = ResourcesPlugin.getWorkspace(); >+ IProject project = ws.getRoot().getProject("Project"); >+ ensureExistsInWorkspace(project, true); >+ >+ String[][] valid = getValidNatureSets(); >+ for (int i = 0; i < valid.length; i++) { >+ setNatures("valid: " + i, project, valid[i], false); >+ } >+ >+ // add with AVOID_NATURE_CONFIG >+ String[] currentSet = new String[] {NATURE_127562}; >+ setNatures("1.0", project, currentSet, false, true); >+ >+ // configure the nature using a conflicting scheduling rule >+ IJobManager manager = Job.getJobManager(); >+ try { >+ manager.beginRule(ws.getRuleFactory().modifyRule(project), null); >+ project.getNature(NATURE_127562).configure(); >+ fail("2.0"); >+ } catch (CoreException ex) { >+ fail("2.1"); >+ } catch (IllegalArgumentException ex) { >+ // should throw this kind of exception >+ } finally { >+ manager.endRule(ws.getRuleFactory().modifyRule(project)); >+ } >+ >+ // configure the nature using a non-conflicting scheduling rule >+ try { >+ manager.beginRule(ws.getRoot(), null); >+ project.getNature(NATURE_127562).configure(); >+ } catch (CoreException ex) { >+ fail("3.0"); >+ } finally { >+ manager.endRule(ws.getRoot()); >+ } >+ } > } >Index: src/org/eclipse/core/tests/resources/ResourceTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/ResourceTest.java,v >retrieving revision 1.23 >diff -u -r1.23 ResourceTest.java >--- src/org/eclipse/core/tests/resources/ResourceTest.java 12 Sep 2007 14:46:34 -0000 1.23 >+++ src/org/eclipse/core/tests/resources/ResourceTest.java 23 Jan 2008 15:01:47 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2007 IBM Corporation and others. >+ * Copyright (c) 2000, 2008 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 >@@ -54,6 +54,8 @@ > protected static final String NATURE_MUD = "org.eclipse.core.tests.resources.mudNature"; > //simpleNature > protected static final String NATURE_SIMPLE = "org.eclipse.core.tests.resources.simpleNature"; >+ //notNarrowNature >+ protected static final String NATURE_127562 = "org.eclipse.core.tests.resources.bug127562Nature"; > //snowNature, requires: waterNature, one-of: otherSet > protected static final String NATURE_SNOW = "org.eclipse.core.tests.resources.snowNature"; > //waterNature, one-of: stateSet >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.tests.resources/plugin.xml,v >retrieving revision 1.74 >diff -u -r1.74 plugin.xml >--- plugin.xml 17 Apr 2007 15:51:29 -0000 1.74 >+++ plugin.xml 23 Jan 2008 15:01:47 -0000 >@@ -254,5 +254,14 @@ > <enablement> > <instanceof value="org.eclipse.core.resources.IResource"/> > </enablement> >+</extension> >+<extension >+ id="bug127562Nature" >+ point="org.eclipse.core.resources.natures"> >+ <runtime> >+ <run >+ class="org.eclipse.core.tests.internal.resources.Bug127562Nature"> >+ </run> >+ </runtime> > </extension> > </plugin> >Index: src/org/eclipse/core/tests/resources/regression/Bug_127562.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/regression/Bug_127562.java,v >retrieving revision 1.3 >diff -u -r1.3 Bug_127562.java >--- src/org/eclipse/core/tests/resources/regression/Bug_127562.java 17 Jul 2006 15:00:15 -0000 1.3 >+++ src/org/eclipse/core/tests/resources/regression/Bug_127562.java 23 Jan 2008 15:01:47 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2006 IBM Corporation and others. >+ * Copyright (c) 2000, 2008 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 >@@ -47,7 +47,7 @@ > public void run(IProgressMonitor monitor) throws CoreException { > project.setDescription(finalDescription, getMonitor()); > } >- }, getWorkspace().getRuleFactory().modifyRule(project), IResource.NONE, getMonitor()); >+ }, getWorkspace().getRoot(), IResource.NONE, getMonitor()); > } catch (CoreException e) { > fail("4.99", e); > } >Index: src/org/eclipse/core/tests/internal/resources/Bug127562Nature.java >=================================================================== >RCS file: src/org/eclipse/core/tests/internal/resources/Bug127562Nature.java >diff -N src/org/eclipse/core/tests/internal/resources/Bug127562Nature.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/core/tests/internal/resources/Bug127562Nature.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,45 @@ >+/******************************************************************************* >+ * Copyright (c) 2008 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.internal.resources; >+ >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.ResourcesPlugin; >+import org.eclipse.core.runtime.CoreException; >+ >+/** >+ * This nature will try to modify resources outside the project scope. >+ */ >+public class Bug127562Nature extends TestNature { >+ /** >+ * Constructor for SimpleNature. >+ */ >+ public Bug127562Nature() { >+ super(); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.resources.IProjectNature#configure() >+ */ >+ public void configure() throws CoreException { >+ super.configure(); >+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("Project" + System.currentTimeMillis()); >+ p.create(null); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.core.resources.IProjectNature#deconfigure() >+ */ >+ public void deconfigure() throws CoreException { >+ super.deconfigure(); >+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject("Project" + System.currentTimeMillis()); >+ p.create(null); >+ } >+}
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 128709
:
87634
|
87648
|
87650
|
87653
|
87853