From 9a19f67ab9627abe35eb9eced7040e072b787ac5 Mon Sep 17 00:00:00 2001 From: Krzysztof Daniel Date: Tue, 15 Oct 2013 11:55:02 +0200 Subject: Bug 419418: testSimpleRepositoryPerformanceOnLoadReadonlyLocalRepository fails when invoked with maven surefire Tests rely on changing privileges, which cannot be changed without platform. Platform can't be installed into surefire, because it depends on bundles in the reactor, and would cause circular dependencies. So, the proper way is to use File API to manage file attributes. Change-Id: I93ab9eaaf9891b265e0ef4fbabe3f22a66616738 Signed-off-by: Krzysztof Daniel --- .../equinox/p2/tests/artifact/repository/Bug351944.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug351944.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug351944.java index f5a9171e0..ee795e22c 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug351944.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/artifact/repository/Bug351944.java @@ -14,8 +14,8 @@ import java.io.File; import java.net.URI; import java.net.URISyntaxException; import java.util.*; -import org.eclipse.core.filesystem.*; -import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Platform; import org.eclipse.equinox.p2.core.ProvisionException; import org.eclipse.equinox.p2.metadata.IArtifactKey; import org.eclipse.equinox.p2.query.IQueryResult; @@ -39,16 +39,13 @@ public class Bug351944 extends AbstractProvisioningTest { * it doesn't work on Windows to make a folder read-only then can't create * new file in it */ - private void changeWritePermission(File target, boolean canWrite) throws CoreException { + private void changeWritePermission(File target, boolean canWrite) { if (target.exists()) { - IFileStore fileStore = EFS.getLocalFileSystem().getStore(target.toURI()); - IFileInfo fileInfo = fileStore.fetchInfo(); - fileInfo.setAttribute(EFS.ATTRIBUTE_GROUP_WRITE, canWrite); - fileInfo.setAttribute(EFS.ATTRIBUTE_OWNER_WRITE, canWrite); - fileStore.putInfo(fileInfo, EFS.SET_ATTRIBUTES, new NullProgressMonitor()); + target.setWritable(canWrite); if (target.isDirectory()) { - for (File child : target.listFiles()) - changeWritePermission(child, canWrite); + for (File child : target.listFiles()) { + child.setWritable(canWrite); + } } } } -- cgit v1.2.3