Bug 564749 - AbstractReconcilerTest does not work on macOS

Update the build so that the correct dropin is found for the platform
that the build is executing on.

Fix an issue when unzipping on macOS such that the executable isn't
executable.

Change-Id: If74f038ab96d36620296a92d0ab6ff4b5564fac1
Signed-off-by: Alex Blewitt <alex.blewitt@gmail.com>
diff --git a/bundles/org.eclipse.equinox.p2.tests/pom.xml b/bundles/org.eclipse.equinox.p2.tests/pom.xml
index 952bfe1..11570c4 100644
--- a/bundles/org.eclipse.equinox.p2.tests/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.tests/pom.xml
@@ -22,9 +22,6 @@
 	<properties>
 		<testSuite>${project.artifactId}</testSuite>
 		<testClass>org.eclipse.equinox.p2.tests.AutomatedTests</testClass>
-		<!-- despite best inentions I was not able to add automatiz detection here -->
-		<!-- Linux is default because Hudson runs those tests on Linux -->
-		<dropinsProduct>org.eclipse.equinox.p2.reconciler-linux.gtk.x86_64.tar.gz</dropinsProduct>
 	</properties>
 
 	<build>
@@ -49,4 +46,54 @@
 			</plugin>
 		</plugins>
 	</build>
+	<profiles>
+		<profile>
+			<id>mac_x86_64</id>
+			<activation>
+				<os>
+					<family>mac</family>
+					<arch>x86_64</arch>
+				</os>
+			</activation>
+			<properties>
+					<dropinsProduct>org.eclipse.equinox.p2.reconciler-macosx.cocoa.x86_64.zip</dropinsProduct>
+			</properties>
+		</profile>
+		<profile>
+			<id>linux_amd64</id>
+			<activation>
+				<os>
+					<family>linux</family>
+					<arch>amd64</arch>
+				</os>
+			</activation>
+			<properties>
+					<dropinsProduct>org.eclipse.equinox.p2.reconciler-linux.gtk.x86_64.tar.gz</dropinsProduct>
+			</properties>
+		</profile>
+		<profile>
+			<id>linux_ppc64le</id>
+			<activation>
+				<os>
+					<family>linux</family>
+					<arch>ppc64le</arch>
+				</os>
+			</activation>
+			<properties>
+					<dropinsProduct>org.eclipse.equinox.p2.reconciler-linux.gtk.ppc64le.tar.gz</dropinsProduct>
+			</properties>
+		</profile>
+		<profile>
+			<id>win_x86_64</id>
+			<activation>
+				<os>
+					<family>win</family>
+					<arch>x86_64</arch>
+				</os>
+			</activation>
+			<properties>
+					<dropinsProduct>org.eclipse.equinox.p2.reconciler-win32.win32.x86_64.zip</dropinsProduct>
+			</properties>
+		</profile>
+	</profiles>
 </project>
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 7c54ec0..620c68a 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
@@ -120,6 +120,12 @@
 			exe = new File(output, getExeFolder() + "eclipse");
 			if (!exe.exists())
 				fail("Executable file: " + exe.getAbsolutePath() + "(or .exe) not found after extracting: " + file.getAbsolutePath() + " to: " + output);
+			if (!exe.canExecute()) {
+				// Try first to set --x--x--x, then --x------ if we can't do the former
+				if (!exe.setExecutable(true, false) || !exe.setExecutable(true, true)) {
+					fail("Executable file: " + exe.getAbsolutePath() + " is not executable");
+				}
+			}
 		}
 		initialized = true;
 	}
@@ -476,7 +482,7 @@
 
 	public Configuration loadConfiguration(File configLocation, File installLocation) {
 		try {
-			return Configuration.load(configLocation, installLocation.toURL());
+			return Configuration.load(configLocation, installLocation.toURI().toURL());
 		} catch (ProvisionException e) {
 			fail("Error while reading configuration from " + configLocation);
 		} catch (MalformedURLException e) {
@@ -494,7 +500,7 @@
 		File configLocation = new File(output, getRootFolder() + "configuration/org.eclipse.update/platform.xml");
 		File installLocation = new File(output, getRootFolder());
 		try {
-			configuration.save(configLocation, installLocation.toURL());
+			configuration.save(configLocation, installLocation.toURI().toURL());
 		} catch (ProvisionException e) {
 			fail(message, e);
 		} catch (MalformedURLException e) {