diff options
8 files changed, 44 insertions, 25 deletions
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineActivator.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineActivator.java index 5fc0e73b5..8106718c8 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineActivator.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineActivator.java @@ -14,6 +14,7 @@ package org.eclipse.equinox.internal.p2.engine; import java.io.*; import java.net.URI; import java.net.URISyntaxException; +import java.nio.file.Files; import java.util.*; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; @@ -135,7 +136,7 @@ public class EngineActivator implements BundleActivator { } if (extension.isDirectory()) { - if (extension.canWrite()) { + if (Files.isWritable(extension.toPath())) { synchronized (reportedExtensions) { if (!reportedExtensions.contains(extension)) { reportedExtensions.add(extension); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AllTests.java index 938d6cbb5..a3fe6af53 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AllTests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AllTests.java @@ -12,7 +12,6 @@ package org.eclipse.equinox.p2.tests.reconciler.dropins; import junit.framework.*; -import org.eclipse.equinox.p2.tests.sharedinstall.AbstractSharedInstallTest; /** * To run the reconciler tests, you must perform some manual setup steps: @@ -30,9 +29,7 @@ public class AllTests extends TestCase { suite.addTest(FeaturePatchTest.suite()); suite.addTest(SharedInstallTests.suite()); suite.addTest(SharedInstallTestsProfileSpoofEnabled.suite()); - if (!AbstractSharedInstallTest.WINDOWS) { - suite.addTest(SharedInstallTestsProfileSpoofEnabledConfigured.suite()); - } + suite.addTest(SharedInstallTestsProfileSpoofEnabledConfigured.suite()); suite.addTest(Bug362692.suite()); return suite; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/AbstractSharedInstallTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/AbstractSharedInstallTest.java index e31bd1f3b..119f0a766 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/AbstractSharedInstallTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/AbstractSharedInstallTest.java @@ -193,6 +193,21 @@ public abstract class AbstractSharedInstallTest extends AbstractReconcilerTest { realExecuteVerifier(verificationProperties, true); } + public static void reallyReadOnly(File folder, boolean recurse) { + reallyReadOnly(folder); + if (folder.exists() && recurse) { + File[] dirs = folder.listFiles(new FileFilter() { + @Override + public boolean accept(File pathname) { + return pathname.isDirectory(); + } + }); + for (File dir : dirs) { + reallyReadOnly(dir, true); + } + } + } + public static void reallyReadOnly(File folder) { if (!Platform.getOS().equals(Platform.OS_WIN32)) return; @@ -210,6 +225,21 @@ public abstract class AbstractSharedInstallTest extends AbstractReconcilerTest { } } + public static void removeReallyReadOnly(File folder, boolean recurse) { + removeReallyReadOnly(folder); + if (folder.exists() && recurse) { + File[] dirs = folder.listFiles(new FileFilter() { + @Override + public boolean accept(File pathname) { + return pathname.isDirectory(); + } + }); + for (File dir : dirs) { + removeReallyReadOnly(dir, true); + } + } + } + public static void removeReallyReadOnly(File folder) { if (!Platform.getOS().equals(Platform.OS_WIN32)) return; diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/BundlesTxtTestExtendedConfigured.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/BundlesTxtTestExtendedConfigured.java index 2e08c5467..c75bb75ac 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/BundlesTxtTestExtendedConfigured.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/BundlesTxtTestExtendedConfigured.java @@ -29,7 +29,7 @@ public class BundlesTxtTestExtendedConfigured extends BundlesTxtTestExtended { Activator.EXTENSIONS = testData.toString(); System.setProperty("p2.fragments", Activator.EXTENSIONS); AbstractSharedInstallTest.setReadOnly(testData, true); - AbstractSharedInstallTest.reallyReadOnly(testData); + AbstractSharedInstallTest.reallyReadOnly(testData, true); } @Override @@ -45,7 +45,7 @@ public class BundlesTxtTestExtendedConfigured extends BundlesTxtTestExtended { @Override protected void tearDown() throws Exception { Activator.EXTENSIONS = null; - AbstractSharedInstallTest.removeReallyReadOnly(testData); + AbstractSharedInstallTest.removeReallyReadOnly(testData, true); AbstractSharedInstallTest.setReadOnly(testData, false); testData.delete(); super.tearDown(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/SimpleConfiguratorTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/SimpleConfiguratorTests.java index ece7ba749..4eccacd1f 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/SimpleConfiguratorTests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/SimpleConfiguratorTests.java @@ -10,7 +10,6 @@ package org.eclipse.equinox.p2.tests.simpleconfigurator; import junit.framework.Test; import junit.framework.TestSuite; -import org.eclipse.equinox.p2.tests.sharedinstall.AbstractSharedInstallTest; public class SimpleConfiguratorTests { @@ -21,21 +20,15 @@ public class SimpleConfiguratorTests { suite.addTestSuite(SimpleConfiguratorTest.class); suite.addTestSuite(SimpleConfiguratorTestExtended.class); - if (!AbstractSharedInstallTest.WINDOWS) { - suite.addTestSuite(SimpleConfiguratorTestExtendedConfigured.class); - } + suite.addTestSuite(SimpleConfiguratorTestExtendedConfigured.class); suite.addTestSuite(SimpleConfiguratorUtilsTest.class); suite.addTestSuite(SimpleConfiguratorUtilsExtendedTest.class); - if (!AbstractSharedInstallTest.WINDOWS) { - suite.addTestSuite(SimpleConfiguratorUtilsExtendedConfiguredTest.class); - } + suite.addTestSuite(SimpleConfiguratorUtilsExtendedConfiguredTest.class); suite.addTestSuite(BundlesTxtTest.class); suite.addTestSuite(BundlesTxtTestExtended.class); - if (!AbstractSharedInstallTest.WINDOWS) { - suite.addTestSuite(BundlesTxtTestExtendedConfigured.class); - } + suite.addTestSuite(BundlesTxtTestExtendedConfigured.class); suite.addTestSuite(NonExclusiveMode.class); suite.addTestSuite(NonExclusiveModeExtended.class); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/SimpleConfiguratorUtilsExtendedConfiguredTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/SimpleConfiguratorUtilsExtendedConfiguredTest.java index efba8732f..814667553 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/SimpleConfiguratorUtilsExtendedConfiguredTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/SimpleConfiguratorUtilsExtendedConfiguredTest.java @@ -33,7 +33,7 @@ public class SimpleConfiguratorUtilsExtendedConfiguredTest extends SimpleConfigu copy("preparing readonly data", getTestData("simpleconfigurator extensions", "testData/simpleConfiguratorExtendedTest"), testData); testData = new File(testData, "extensions"); AbstractSharedInstallTest.setReadOnly(testData.getParentFile(), true); - AbstractSharedInstallTest.reallyReadOnly(testData.getParentFile()); + AbstractSharedInstallTest.reallyReadOnly(testData.getParentFile(), true); Activator.EXTENSIONS = testData.toString(); mainBundlesInfo = getTestData("simpleconfigurator extensions - main bundles.info", "testData/simpleConfiguratorExtendedTest/main/bundles.info"); @@ -42,7 +42,7 @@ public class SimpleConfiguratorUtilsExtendedConfiguredTest extends SimpleConfigu @Override protected void tearDown() throws Exception { Activator.EXTENSIONS = null; - AbstractSharedInstallTest.removeReallyReadOnly(testData.getParentFile()); + AbstractSharedInstallTest.removeReallyReadOnly(testData.getParentFile(), true); AbstractSharedInstallTest.setReadOnly(testData.getParentFile(), false); testData.getParentFile().delete(); super.tearDown(); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorTests.java index 1e22b03f5..c46209f3f 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorTests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/manipulator/SimpleConfiguratorManipulatorTests.java @@ -88,11 +88,6 @@ public class SimpleConfiguratorManipulatorTests extends AbstractProvisioningTest } public void testLoadConfigurationExtended() throws Exception { - // See org.eclipse.equinox.p2.tests.simpleconfigurator.SimpleConfiguratorTests - if (AbstractSharedInstallTest.WINDOWS) { - return; - } - // installation info URI installArea = EquinoxUtils.getInstallLocationURI(TestActivator.getContext()); @@ -108,6 +103,7 @@ public class SimpleConfiguratorManipulatorTests extends AbstractProvisioningTest File fragDir = getTempFolder(); copy("Copying ..", fragTestData, fragDir); SharedInstallTests.setReadOnly(fragDir, true); + AbstractSharedInstallTest.reallyReadOnly(fragDir, true); Activator.EXTENDED = true; Activator.EXTENSIONS = fragDir.getAbsolutePath(); @@ -132,6 +128,7 @@ public class SimpleConfiguratorManipulatorTests extends AbstractProvisioningTest } } + AbstractSharedInstallTest.removeReallyReadOnly(fragDir, true); SharedInstallTests.setReadOnly(fragDir, false); } } diff --git a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/SimpleConfiguratorUtils.java b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/SimpleConfiguratorUtils.java index e5ceced3b..a210530d3 100644 --- a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/SimpleConfiguratorUtils.java +++ b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/SimpleConfiguratorUtils.java @@ -13,6 +13,7 @@ package org.eclipse.equinox.internal.simpleconfigurator.utils; import java.io.*; import java.net.*; +import java.nio.file.Files; import java.util.*; import org.eclipse.equinox.internal.simpleconfigurator.Activator; import org.osgi.framework.Version; @@ -141,7 +142,7 @@ public class SimpleConfiguratorUtils { } if (extension.isDirectory()) { - if (extension.canWrite()) { + if (Files.isWritable(extension.toPath())) { synchronized (reportedExtensions) { if (!reportedExtensions.contains(extension)) { reportedExtensions.add(extension); |