summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKrzysztof Daniel2013-11-21 08:00:19 (EST)
committerKrzysztof Daniel2013-11-28 04:25:27 (EST)
commit67335698684e47ddd46d2f2997f04325e6745f35 (patch)
treecf48ca37e864756c39af8d2d005bf44f21cd6377
parente1f95889539f3cc8d09e51dfb0d21ea04aceb5d8 (diff)
downloadrt.equinox.p2-67335698684e47ddd46d2f2997f04325e6745f35.zip
rt.equinox.p2-67335698684e47ddd46d2f2997f04325e6745f35.tar.gz
rt.equinox.p2-67335698684e47ddd46d2f2997f04325e6745f35.tar.bz2
bug 422043 - 7 ConfigurationTests failed in official buildM20131204-0800refs/changes/44/19044/1
Squash of commits 10bcad9, b776de6, 1413f8a, 0dae0e9, ab3a3cd: * usage of canonical paths in the configuration tests. This is a real fix for this bug, as Configuration could write Windows specific paths, which were not handled properly in tests (java paths were using Unix-like convention - "/" and lower-case drive letters, while tests were adopting Windows convention - "\" when the tmp path was configured via command line. * I've also left changes responsible for improved deleting of work directories - current clean up method couldn't delete readonly children, so every child is now being made readable, writeable and executable before being deleted. Signed-off-by: Krzysztof Daniel <kdaniel@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ConfigurationTests.java32
3 files changed, 32 insertions, 21 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java
index 15ff547..738d6aa 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/AbstractProvisioningTest.java
@@ -607,11 +607,19 @@ public abstract class AbstractProvisioningTest extends TestCase {
if (!file.exists())
return true;
if (file.isDirectory()) {
+ file.setWritable(true);
+ file.setReadable(true);
+ file.setExecutable(true);
File[] children = file.listFiles();
for (int i = 0; i < children.length; i++)
delete(children[i]);
}
- return file.delete();
+ if (!file.delete()) {
+ file.setWritable(true);
+ file.setReadable(true);
+ file.delete();
+ }
+ return !file.exists();
}
/**
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java
index 8f530f0..ef88cc3 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/AbstractReconcilerTest.java
@@ -12,8 +12,7 @@
package org.eclipse.equinox.p2.tests.reconciler.dropins;
import java.io.*;
-import java.net.MalformedURLException;
-import java.net.URL;
+import java.net.*;
import java.util.*;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.frameworkadmin.BundleInfo;
@@ -488,14 +487,16 @@ public class AbstractReconcilerTest extends AbstractProvisioningTest {
* Iterate over the sites in the given configuration and remove the one which
* has a url matching the given location.
*/
- public boolean removeSite(Configuration configuration, String location) {
- IPath path = new Path(location);
+ public boolean removeSite(Configuration configuration, String location) throws IOException, URISyntaxException {
+ File left = new File(new URI(location)).getCanonicalFile();
List sites = configuration.getSites();
for (Iterator iter = sites.iterator(); iter.hasNext();) {
Site tempSite = (Site) iter.next();
String siteURL = tempSite.getUrl();
- if (path.equals(new Path(siteURL)))
+ File right = new File(new URI(siteURL)).getCanonicalFile();
+ if (left.equals(right)) {
return configuration.removeSite(tempSite);
+ }
}
return false;
}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ConfigurationTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ConfigurationTests.java
index ff70468..5092581 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ConfigurationTests.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/ConfigurationTests.java
@@ -11,6 +11,8 @@
package org.eclipse.equinox.p2.tests.reconciler.dropins;
import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
import java.util.Iterator;
import junit.framework.Test;
import junit.framework.TestSuite;
@@ -85,12 +87,12 @@ public class ConfigurationTests extends AbstractReconcilerTest {
* Test discovering a site in a platform.xml file and installing the bundles from it.
* Then change the site to be disabled and then re-reconcile.
*/
- public void testSiteEnabled() {
+ public void testSiteEnabled() throws IOException, URISyntaxException {
assertInitialized();
File temp = getTempFolder();
toRemove.add(temp);
Configuration configuration = getConfiguration();
- String siteLocation = new File(temp, "eclipse").toURI().toString();
+ String siteLocation = new File(temp, "eclipse").getCanonicalFile().toURI().toString();
File source = getTestData("2.0", "testData/reconciler/ext.jar");
copy("2.1", source, temp);
@@ -139,13 +141,13 @@ public class ConfigurationTests extends AbstractReconcilerTest {
* a sub-element of the site. When the feature and its plug-ins are removed
* from the site we need to ensure the plug-ins are removed from the install.
*/
- public void test_247095() {
+ public void test_247095() throws IOException, URISyntaxException {
assertInitialized();
Configuration configuration = getConfiguration();
File temp = getTempFolder();
toRemove.add(temp);
String siteLocation = null;
- siteLocation = new File(temp, "eclipse").toURI().toString();
+ siteLocation = new File(temp, "eclipse").getCanonicalFile().toURI().toString();
// copy the data to the temp folder
File source = getTestData("1.0", "testData/reconciler/247095");
@@ -195,13 +197,13 @@ public class ConfigurationTests extends AbstractReconcilerTest {
* Same but delete the files from disk. (other test cases doesn't delete the files... simulates
* the use of a shared bundle pool)
*/
- public void test_247095b() {
+ public void test_247095b() throws IOException, URISyntaxException {
assertInitialized();
Configuration configuration = getConfiguration();
File temp = getTempFolder();
toRemove.add(temp);
String siteLocation = null;
- siteLocation = new File(temp, "eclipse").toURI().toString();
+ siteLocation = new File(temp, "eclipse").getCanonicalFile().toURI().toString();
// copy the data to the temp folder
File source = getTestData("1.0", "testData/reconciler/247095");
@@ -255,13 +257,13 @@ public class ConfigurationTests extends AbstractReconcilerTest {
* features, we were always adding the features to the excludes list and
* therefore they were never installed.
*/
- public void test_249607() {
+ public void test_249607() throws IOException, URISyntaxException {
assertInitialized();
Configuration configuration = getConfiguration();
File temp = getTempFolder();
toRemove.add(temp);
String siteLocation = null;
- siteLocation = new File(temp, "eclipse").toURI().toString();
+ siteLocation = new File(temp, "eclipse").getCanonicalFile().toURI().toString();
// copy the data to the temp folder
File source = getTestData("1.0", "testData/reconciler/247095");
@@ -296,12 +298,12 @@ public class ConfigurationTests extends AbstractReconcilerTest {
* Add a site to the platform.xml, reconcile, ensure its contents are installed, remove the site,
* reconcile, ensure the contents are uninstalled.
*/
- public void test_249898() {
+ public void test_249898() throws IOException, URISyntaxException {
assertInitialized();
Configuration configuration = getConfiguration();
File temp = getTempFolder();
toRemove.add(temp);
- String siteLocation = new File(temp, "eclipse").toURI().toString();
+ String siteLocation = new File(temp, "eclipse").getCanonicalFile().toURI().toString();
// copy the data to the temp folder
File source = getTestData("1.0", "testData/reconciler/247095");
@@ -334,12 +336,12 @@ public class ConfigurationTests extends AbstractReconcilerTest {
/*
* Test extension locations that have both JAR'd bundles and directory-based bundles.
*/
- public void test_232094a() {
+ public void test_232094a() throws IOException {
assertInitialized();
internal_test_232094(getTestData("1.0", "testData/reconciler/ext.dir"));
}
- public void test_232094b() {
+ public void test_232094b() throws IOException {
assertInitialized();
internal_test_232094(getTestData("1.0", "testData/reconciler/ext.jar"));
}
@@ -349,14 +351,14 @@ public class ConfigurationTests extends AbstractReconcilerTest {
* by the user putting a .link file in the links/ folder. Then they delete the link file
* and the features and plug-ins should be uninstalled.
*/
- private void internal_test_232094(File source) {
+ private void internal_test_232094(File source) throws IOException {
File temp = getTempFolder();
toRemove.add(temp);
// copy the data to an extension location
copy("1.1", source, temp);
// create the file in the links/ folder
- createLinkFile("2.0", "myLink", temp.getAbsolutePath());
+ createLinkFile("2.0", "myLink", temp.getCanonicalFile().getAbsolutePath());
// reconcile
reconcile("3.0");
@@ -395,7 +397,7 @@ public class ConfigurationTests extends AbstractReconcilerTest {
* Add a new site to the platform.xml file which points to a location that contains
* a p2 repository. (content.jar and artifacts.jar + bundles)
*/
- public void test_p2Site() {
+ public void test_p2Site() throws IOException, URISyntaxException {
assertInitialized();
// initial reconciliation to create platform.xml