536385: Marketplace client does not open when Eclipse is renamed
Improved conversion and error handling a bit more
- configured tests to always run with a space in the eclipse path
- fixed unrelated SWTBot tests that seem to got broken by new SWTBot
version
Bug: 536385
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=536385
diff --git a/org.eclipse.epp.mpc.tests/pom.xml b/org.eclipse.epp.mpc.tests/pom.xml
index 58904a1..f3daffd 100644
--- a/org.eclipse.epp.mpc.tests/pom.xml
+++ b/org.eclipse.epp.mpc.tests/pom.xml
@@ -62,8 +62,11 @@
<application>org.eclipse.ui.ide.workbench</application>
<testSuite>org.eclipse.epp.mpc.tests</testSuite>
<testClass>${test-suite}</testClass>
- <argLine>-Xmx256m -XX:MaxPermSize=128m -Djava.io.tmpdir=${project.build.directory} ${test-args} ${test-proxy}</argLine>
+ <argLine>-Xmx256m -XX:MaxPermSize=128m -Djava.io.tmpdir=${project.build.directory}/temp ${test-args} ${test-proxy}</argLine>
<appArgLine>${test-app-args}</appArgLine>
+
+ <!-- run all tests with a space in the application path (this is the osgi.install.area, but the configuration area should follow suit -->
+ <work>${project.build.directory}/work/test rcp</work>
</configuration>
</plugin>
</plugins>
diff --git a/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/ui/catalog/MarketplaceInfoSerializationTest.java b/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/ui/catalog/MarketplaceInfoSerializationTest.java
index 1adc739..f7c7834 100644
--- a/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/ui/catalog/MarketplaceInfoSerializationTest.java
+++ b/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/ui/catalog/MarketplaceInfoSerializationTest.java
@@ -47,7 +47,12 @@
@Override
protected File computeBundleRegistryFile() {
- return null;
+ return super.computeBundleRegistryFile();
+ }
+
+ @Override
+ protected File computeConfigurationAreaRegistryFile() {
+ return super.computeConfigurationAreaRegistryFile();
}
@Override
@@ -61,11 +66,31 @@
}
}
+ private class TestLegacyMarketplaceInfo extends TestMarketplaceInfo {
+
+ @Override
+ protected File computeConfigurationAreaRegistryFile() {
+ return null;
+ }
+
+ @Override
+ protected File computeBundleRegistryFile() {
+ return null;
+ }
+ }
+
+ private File configurationArea;
private File registryLocation;
private TestMarketplaceInfo catalogRegistry;
private TestMarketplaceInfo createReadOnlyBundleMarketplaceInfo() {
return new TestMarketplaceInfo() {
+
+ @Override
+ protected File computeConfigurationAreaRegistryFile() {
+ return null;
+ }
+
@Override
protected RegistryFile createRegistryFile() {
return new RegistryFile(super.createRegistryFile()) {
@@ -134,11 +159,12 @@
}
@Test
- public void loadFromUserHomeRegistryFile() {
+ public void loadFromUserHomeRegistryFile() throws Exception {
+ createEmptyRegistryFile(getUserHomeRegistryFile());
File registryFile = catalogRegistry.computeRegistryFile(false);
File saveRegistryFile = catalogRegistry.computeRegistryFile(true);
assertEquals(getUserHomeRegistryFile(), registryFile);
- assertEquals(getUserHomeRegistryFile(), saveRegistryFile);
+ assertEquals(catalogRegistry.computeConfigurationAreaRegistryFile(), saveRegistryFile);
}
@Test
@@ -158,6 +184,7 @@
@Test
public void saveToUserHomeRegistryFileWithLegacy() throws Exception {
+ catalogRegistry = new TestLegacyMarketplaceInfo();
createEmptyRegistryFile(getLegacyUserHomeRegistryFile());
File registryFile = catalogRegistry.computeRegistryFile(true);
assertEquals(getUserHomeRegistryFile(), registryFile);
@@ -167,6 +194,7 @@
@Test
public void saveToUserHomeRegistryFileWithCurrentAndLegacy() throws Exception {
+ catalogRegistry = new TestLegacyMarketplaceInfo();
createEmptyRegistryFile(getLegacyUserHomeRegistryFile());
createEmptyRegistryFile(getUserHomeRegistryFile());
File registryFile = catalogRegistry.computeRegistryFile(true);
diff --git a/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/ui/wizard/AbstractMarketplaceWizardBotTest.java b/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/ui/wizard/AbstractMarketplaceWizardBotTest.java
index 69ee5b5..d953684 100644
--- a/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/ui/wizard/AbstractMarketplaceWizardBotTest.java
+++ b/org.eclipse.epp.mpc.tests/src/org/eclipse/epp/mpc/tests/ui/wizard/AbstractMarketplaceWizardBotTest.java
@@ -214,7 +214,7 @@
try {
//check if dialog is still open
mpcShell = bot.shell("Eclipse Marketplace");
- } catch (TimeoutException e) {
+ } catch (WidgetNotFoundException | TimeoutException e) {
//no MPC wizard found - maybe a bit strange, but so be it...
return;
}
diff --git a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/MarketplaceInfo.java b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/MarketplaceInfo.java
index 2b19ac6..035cdb3 100644
--- a/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/MarketplaceInfo.java
+++ b/org.eclipse.epp.mpc.ui/src/org/eclipse/epp/internal/mpc/ui/catalog/MarketplaceInfo.java
@@ -396,7 +396,7 @@
}
} catch (Throwable t) {
// fail safe
- MarketplaceClientUi.error(t);
+ MarketplaceClientUi.error(t);
}
}
@@ -438,26 +438,34 @@
* @nooverride This method is not intended to be re-implemented or extended by clients.
*/
protected File computeConfigurationAreaRegistryFile() {
+ File configurationArea = getConfigurationArea();
+ if (configurationArea == null) {
+ return null;
+ }
+ File mpcArea = new File(configurationArea, MarketplaceClientUi.BUNDLE_ID);
+ File dataFile = new File(mpcArea, PERSISTENT_FILE);
+ return dataFile;
+ }
+
+ protected File getConfigurationArea() {
Location configurationLocation = Platform.getConfigurationLocation();
URL url = configurationLocation == null ? null : configurationLocation.getURL();
- URI uri;
if (url == null) {
return null;
}
+ File configurationArea;
try {
url = FileLocator.resolve(url);
- uri = URLUtil.toURI(url.toExternalForm());
+ if (!"file".equals(url.getProtocol())) { //$NON-NLS-1$
+ return null;
+ }
+ URI uri = new URI("file", null, url.getPath(), url.getQuery(), url.getRef()); //$NON-NLS-1$
+ configurationArea = new File(uri);
} catch (Exception e) {
+ MarketplaceClientUi.error(e);
return null;
}
- if (!"file".equals(uri.getScheme())) {
- return null;
- }
- File configurationArea = new File(uri);
- File mpcArea = new File(configurationArea, MarketplaceClientUi.BUNDLE_ID);
-
- File dataFile = new File(mpcArea, PERSISTENT_FILE);
- return dataFile;
+ return configurationArea;
}
/**