diff options
author | kdaniel | 2013-12-29 16:13:22 +0000 |
---|---|---|
committer | kdaniel | 2013-12-29 16:13:22 +0000 |
commit | 2af3ee8aeff2425c25cb1de7cb4b96b4fdca9751 (patch) | |
tree | 4db00b64437048777f83ad0f5e050ed5ebac674b /bundles | |
parent | 823ee46606c19d6c7fe5dcd2d89f7be4cf50b629 (diff) | |
download | rt.equinox.p2-2af3ee8aeff2425c25cb1de7cb4b96b4fdca9751.tar.gz rt.equinox.p2-2af3ee8aeff2425c25cb1de7cb4b96b4fdca9751.tar.xz rt.equinox.p2-2af3ee8aeff2425c25cb1de7cb4b96b4fdca9751.zip |
Change-Id: Idf26bb7de89f08eb0224667f24b9b649629f6475
Signed-off-by: Krzysztof Daniel <krzysztof.daniel@gmail.com>
Diffstat (limited to 'bundles')
9 files changed, 57 insertions, 54 deletions
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 dc8d26640..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 @@ -21,6 +21,7 @@ import junit.framework.*; * -Dorg.eclipse.equinox.p2.reconciler.tests.platform.archive=c:/tmp/eclipse-platform-3.4-win32.zip */ public class AllTests extends TestCase { + public static Test suite() { TestSuite suite = new TestSuite(AllTests.class.getName()); suite.addTest(BasicTests.suite()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/SharedInstallTestsProfileSpoofEnabledConfigured.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/SharedInstallTestsProfileSpoofEnabledConfigured.java index a47c0a007..07b085e4d 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/SharedInstallTestsProfileSpoofEnabledConfigured.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/SharedInstallTestsProfileSpoofEnabledConfigured.java @@ -16,6 +16,7 @@ import junit.framework.Test; import junit.framework.TestSuite; import org.eclipse.core.runtime.Platform; import org.eclipse.equinox.internal.p2.updatesite.Activator; +import org.eclipse.equinox.p2.tests.sharedinstall.AbstractSharedInstallTest; public class SharedInstallTestsProfileSpoofEnabledConfigured extends SharedInstallTestsProfileSpoofEnabled { @@ -132,9 +133,11 @@ public class SharedInstallTestsProfileSpoofEnabledConfigured extends SharedInsta // remove the bundle from the dropins and reconcile setReadOnly(readOnlyBase, false); + AbstractSharedInstallTest.removeReallyReadOnly(readOnlyBase); assertTrue("0.7", readOnlyBase.canWrite()); remove("1.0", "dropins", "myBundle_1.0.0.jar"); setReadOnly(readOnlyBase, true); + AbstractSharedInstallTest.reallyReadOnly(readOnlyBase); reconcileReadOnly("0.21", extensions, false); @@ -152,9 +155,11 @@ public class SharedInstallTestsProfileSpoofEnabledConfigured extends SharedInsta // only dropin change (or any other p2 operations) causes p2 to write a // new, up-to-date bundles.info setReadOnly(readOnlyBase, false); + AbstractSharedInstallTest.removeReallyReadOnly(readOnlyBase); assertTrue("0.7", readOnlyBase.canWrite()); add("0.211", "dropins", jar); setReadOnly(readOnlyBase, true); + AbstractSharedInstallTest.reallyReadOnly(readOnlyBase); //no extension - new bundles.info should be written reconcileReadOnly("0.22", null, false); 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 e0efd9a6a..fd797ee77 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 @@ -20,7 +20,7 @@ import org.eclipse.equinox.internal.p2.engine.SimpleProfileRegistry; import org.eclipse.equinox.p2.tests.reconciler.dropins.AbstractReconcilerTest; public abstract class AbstractSharedInstallTest extends AbstractReconcilerTest { - static final boolean WINDOWS = java.io.File.separatorChar == '\\'; + public static final boolean WINDOWS = java.io.File.separatorChar == '\\'; protected static File readOnlyBase; protected static File userBase; protected static String profileId; @@ -193,7 +193,7 @@ public abstract class AbstractSharedInstallTest extends AbstractReconcilerTest { realExecuteVerifier(verificationProperties, true); } - protected void reallyReadOnly(File folder) { + public static void reallyReadOnly(File folder) { if (!Platform.getOS().equals(Platform.OS_WIN32)) return; @@ -210,7 +210,7 @@ public abstract class AbstractSharedInstallTest extends AbstractReconcilerTest { } } - protected void removeReallyReadOnly(File folder) { + 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/sharedinstall/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/AllTests.java index fea2aa386..b95a8143a 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/AllTests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/sharedinstall/AllTests.java @@ -20,11 +20,15 @@ import junit.framework.*; * -Dorg.eclipse.equinox.p2.reconciler.tests.platform.archive=c:/tmp/eclipse-platform-3.4-win32.zip */ public class AllTests extends TestCase { + protected static final boolean WINDOWS = java.io.File.separatorChar == '\\'; + public static Test suite() { TestSuite suite = new TestSuite(AllTests.class.getName()); suite.addTest(BaseChange.suite()); - suite.addTest(BaseChangeExtendedConfigured.suite()); - suite.addTest(BaseChangeExtendedConflicts.suite()); + if (!WINDOWS) { //don't run on windows until I will get windows machine. + suite.addTest(BaseChangeExtendedConfigured.suite()); + suite.addTest(BaseChangeExtendedConflicts.suite()); + } suite.addTest(BaseChangeWithoutUserChange.suite()); suite.addTest(Cancellation.suite()); suite.addTest(DoubleBaseChange.suite()); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/AbstractSimpleConfiguratorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/AbstractSimpleConfiguratorTest.java index fae517eaf..aed5bf148 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/AbstractSimpleConfiguratorTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/AbstractSimpleConfiguratorTest.java @@ -189,13 +189,4 @@ public abstract class AbstractSimpleConfiguratorTest extends AbstractProvisionin }; return directory.listFiles(bundleFilter); } - - public void readOnly(File f, boolean readonly) { - if (f.isDirectory()) { - for (File f2 : f.listFiles()) { - readOnly(f2, readonly); - } - } - f.setWritable(!readonly); - } } 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 b6a49dc81..0230a1bcb 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 @@ -13,6 +13,7 @@ package org.eclipse.equinox.p2.tests.simpleconfigurator; import java.io.File; import org.eclipse.equinox.internal.simpleconfigurator.Activator; +import org.eclipse.equinox.p2.tests.sharedinstall.AbstractSharedInstallTest; import org.osgi.framework.BundleContext; public class BundlesTxtTestExtendedConfigured extends BundlesTxtTestExtended { @@ -27,7 +28,7 @@ public class BundlesTxtTestExtendedConfigured extends BundlesTxtTestExtended { copy("preparing testData", getTestData("simpleconfigurator extensions", "testData/simpleConfiguratorTest"), testData); Activator.EXTENSIONS = testData.toString(); System.setProperty("p2.fragments", Activator.EXTENSIONS); - readOnly(testData, true); + AbstractSharedInstallTest.setReadOnly(testData, true); } @Override @@ -43,7 +44,7 @@ public class BundlesTxtTestExtendedConfigured extends BundlesTxtTestExtended { @Override protected void tearDown() throws Exception { Activator.EXTENSIONS = null; - readOnly(testData, false); + AbstractSharedInstallTest.setReadOnly(testData, false); testData.delete(); super.tearDown(); System.setProperty("p2.fragments", ""); diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/NonExclusiveModeExtendedConfigured.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/NonExclusiveModeExtendedConfigured.java index bf411f654..275827ce6 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/NonExclusiveModeExtendedConfigured.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/NonExclusiveModeExtendedConfigured.java @@ -13,6 +13,7 @@ package org.eclipse.equinox.p2.tests.simpleconfigurator; import java.io.File; import org.eclipse.equinox.internal.simpleconfigurator.Activator; +import org.eclipse.equinox.p2.tests.sharedinstall.AbstractSharedInstallTest; public class NonExclusiveModeExtendedConfigured extends NonExclusiveModeExtended { @@ -24,13 +25,13 @@ public class NonExclusiveModeExtendedConfigured extends NonExclusiveModeExtended testData = getTempFolder(); copy("preparing testData", getTestData("simpleconfigurator extensions", "testData/simpleConfiguratorExtendedTest/extensions"), testData); Activator.EXTENSIONS = testData.toString(); - readOnly(testData, true); + AbstractSharedInstallTest.setReadOnly(testData, true); } @Override protected void tearDown() throws Exception { Activator.EXTENSIONS = null; - readOnly(testData, false); + AbstractSharedInstallTest.setReadOnly(testData, false); testData.delete(); super.tearDown(); } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/SimpleConfiguratorTestExtendedConfigured.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/SimpleConfiguratorTestExtendedConfigured.java index 5de86bea9..c73173842 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/SimpleConfiguratorTestExtendedConfigured.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/simpleconfigurator/SimpleConfiguratorTestExtendedConfigured.java @@ -15,6 +15,7 @@ import java.net.URISyntaxException; import java.util.ArrayList; import org.eclipse.equinox.internal.simpleconfigurator.Activator; import org.eclipse.equinox.internal.simpleconfigurator.utils.SimpleConfiguratorUtils; +import org.eclipse.equinox.p2.tests.sharedinstall.AbstractSharedInstallTest; public class SimpleConfiguratorTestExtendedConfigured extends SimpleConfiguratorTestExtended { @@ -37,14 +38,14 @@ public class SimpleConfiguratorTestExtendedConfigured extends SimpleConfigurator ext3Info = new File(ext3Parent, "ext3.info"); ext3Info.createNewFile(); ext1Info.setLastModified(System.currentTimeMillis() + 1000); - ext1Parent.setWritable(false); + AbstractSharedInstallTest.setReadOnly(ext1Parent, true); ext3Info.setLastModified(System.currentTimeMillis() + 1000); } @Override protected void tearDown() throws Exception { Activator.EXTENSIONS = null; - ext1Parent.setWritable(true); + AbstractSharedInstallTest.setReadOnly(ext1Parent, false); super.tearDown(); } 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 5e9450631..b1a00291a 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 @@ -19,6 +19,7 @@ import java.util.List; import org.eclipse.equinox.internal.simpleconfigurator.Activator; import org.eclipse.equinox.internal.simpleconfigurator.utils.BundleInfo; import org.eclipse.equinox.internal.simpleconfigurator.utils.SimpleConfiguratorUtils; +import org.eclipse.equinox.p2.tests.sharedinstall.AbstractSharedInstallTest; public class SimpleConfiguratorUtilsExtendedConfiguredTest extends SimpleConfiguratorUtilsExtendedTest { @@ -31,26 +32,16 @@ public class SimpleConfiguratorUtilsExtendedConfiguredTest extends SimpleConfigu testData = getTempFolder(); copy("preparing readonly data", getTestData("simpleconfigurator extensions", "testData/simpleConfiguratorExtendedTest"), testData); testData = new File(testData, "extensions"); - readonly(testData.getParentFile(), true); + AbstractSharedInstallTest.setReadOnly(testData.getParentFile(), true); Activator.EXTENSIONS = testData.toString(); mainBundlesInfo = getTestData("simpleconfigurator extensions - main bundles.info", "testData/simpleConfiguratorExtendedTest/main/bundles.info"); } - private void readonly(File f, boolean readonly) { - if (f.isDirectory()) { - for (File subfile : f.listFiles()) { - subfile.setWritable(!readonly); - readonly(subfile, readonly); - } - f.setWritable(!readonly); - } - } - @Override protected void tearDown() throws Exception { Activator.EXTENSIONS = null; - readonly(testData.getParentFile(), false); + AbstractSharedInstallTest.setReadOnly(testData.getParentFile(), false); testData.getParentFile().delete(); super.tearDown(); } @@ -62,9 +53,11 @@ public class SimpleConfiguratorUtilsExtendedConfiguredTest extends SimpleConfigu assertNotNull("Bundle from the main list not loaded", a); assertEquals("Path not resolved properly for the main bundles.info", new File(mainBundlesInfo.getParentFile(), "plugins/a_1.0.0.jar").toURI(), getLocation(a)); - BundleInfo b = getBundle("b", readConfiguration); - assertNotNull("Bundle from the main list not loaded", b); - assertEquals("Path not resolved properly for the main bundles.info", new File("/b_1.0.0.jar").toURI(), getLocation(b)); + if (!AbstractSharedInstallTest.WINDOWS) { + BundleInfo b = getBundle("b", readConfiguration); + assertNotNull("Bundle from the main list not loaded", b); + assertEquals("Path not resolved properly for the main bundles.info", new File("/b_1.0.0.jar").toURI(), getLocation(b)); + } //check false positive BundleInfo x = getBundle("x", readConfiguration); @@ -74,17 +67,21 @@ public class SimpleConfiguratorUtilsExtendedConfiguredTest extends SimpleConfigu assertNotNull("Bundle from the direct extension not loaded", g); assertEquals("Path not resolved properly from direct extension", new File(testData, "extension1/plugins/g_1.0.0.jar").toURI(), getLocation(g)); - BundleInfo h = getBundle("h", readConfiguration); - assertNotNull("Bundle from the direct extension not loaded", h); - assertEquals("Path not resolved properly from direct extension", new File("/h_1.0.0.jar").toURI(), getLocation(h)); + if (!AbstractSharedInstallTest.WINDOWS) { + BundleInfo h = getBundle("h", readConfiguration); + assertNotNull("Bundle from the direct extension not loaded", h); + assertEquals("Path not resolved properly from direct extension", new File("/h_1.0.0.jar").toURI(), getLocation(h)); + } BundleInfo m = getBundle("m", readConfiguration); assertNotNull("Bundle from the linked extension not loaded", m); assertEquals("Path not resolved properly from linked extension", new File(testData.getParentFile(), "extension2/m_1.0.0.jar").toURI(), getLocation(m)); - BundleInfo n = getBundle("n", readConfiguration); - assertNotNull("Bundle from the linked extension not loaded", n); - assertEquals("Path not resolved properly from linked extension", new File("/n_1.0.0.jar").toURI(), getLocation(n)); + if (!AbstractSharedInstallTest.WINDOWS) { + BundleInfo n = getBundle("n", readConfiguration); + assertNotNull("Bundle from the linked extension not loaded", n); + assertEquals("Path not resolved properly from linked extension", new File("/n_1.0.0.jar").toURI(), getLocation(n)); + } } @SuppressWarnings("deprecation") @@ -96,9 +93,11 @@ public class SimpleConfiguratorUtilsExtendedConfiguredTest extends SimpleConfigu assertNotNull("Bundle from the main list not loaded", a); assertEquals("Path not resolved properly for the main bundles.info", new File(mainBundlesInfo.getParentFile(), "plugins/a_1.0.0.jar").toURI(), getLocation(a)); - BundleInfo b = getBundle("b", readConfiguration); - assertNotNull("Bundle from the main list not loaded", b); - assertEquals("Path not resolved properly for the main bundles.info", new File("/b_1.0.0.jar").toURI(), getLocation(b)); + if (!AbstractSharedInstallTest.WINDOWS) { //test use linux absolute paths + BundleInfo b = getBundle("b", readConfiguration); + assertNotNull("Bundle from the main list not loaded", b); + assertEquals("Path not resolved properly for the main bundles.info", new File("/b_1.0.0.jar").toURI(), getLocation(b)); + } //check false positive BundleInfo x = getBundle("x", readConfiguration); @@ -108,21 +107,21 @@ public class SimpleConfiguratorUtilsExtendedConfiguredTest extends SimpleConfigu assertNotNull("Bundle from the direct extension not loaded", g); assertEquals("Path not resolved properly from direct extension", new File(testData, "extension1/plugins/g_1.0.0.jar").toURI(), getLocation(g)); - BundleInfo h = getBundle("h", readConfiguration); - assertNotNull("Bundle from the direct extension not loaded", h); - assertEquals("Path not resolved properly from direct extension", new File("/h_1.0.0.jar").toURI(), getLocation(h)); + if (!AbstractSharedInstallTest.WINDOWS) { //test use linux absolute paths + BundleInfo h = getBundle("h", readConfiguration); + assertNotNull("Bundle from the direct extension not loaded", h); + assertEquals("Path not resolved properly from direct extension", new File("/h_1.0.0.jar").toURI(), getLocation(h)); + } BundleInfo m = getBundle("m", readConfiguration); assertNotNull("Bundle from the linked extension not loaded", m); assertEquals("Path not resolved properly from linked extension", new File(testData.getParentFile(), "extension2/m_1.0.0.jar").toURI(), getLocation(m)); - BundleInfo n = getBundle("n", readConfiguration); - assertNotNull("Bundle from the linked extension not loaded", n); - assertEquals("Path not resolved properly from linked extension", new File("/n_1.0.0.jar").toURI(), getLocation(n)); - - BundleInfo aBundle = getBundle("aBundle", readConfiguration); - assertNotNull("Bundle from the linked extension not loaded", aBundle); - assertEquals("Path not resolved properly from linked extension", new File("/n_1.0.0.jar").toURI(), getLocation(n)); + if (!AbstractSharedInstallTest.WINDOWS) { //test use linux absolute paths + BundleInfo n = getBundle("n", readConfiguration); + assertNotNull("Bundle from the linked extension not loaded", n); + assertEquals("Path not resolved properly from linked extension", new File("/n_1.0.0.jar").toURI(), getLocation(n)); + } } //on adding extension master must be selected in order to create new profile with extensions! |