use of org.eclipse.epp.internal.mpc.ui.commands.MarketplaceWizardCommand in project epp.mpc by eclipse.
the class MarketplaceClientUiTest method testOfflineCatalogServiceErrors.
@Test
public void testOfflineCatalogServiceErrors() throws Exception {
// since NoRouteToHost and ConnectExceptions are hard to fake and happen at pretty much the same place,
// we only simulate the UnknownHostException case here (by actually using an invalid host address)
final DefaultCatalogService catalogService = (DefaultCatalogService) ServiceLocator.getInstance().getCatalogService();
catalogService.setBaseUrl(new URL(UNREACHABLE_MARKETPLACE_URL));
try {
ServiceLocator.setInstance(new ServiceLocator() {
@Override
public ICatalogService getCatalogService() {
return catalogService;
}
});
IStatus status = new MarketplaceWizardCommand().installRemoteCatalogs();
assertEquals(IStatus.ERROR, status.getSeverity());
assertTrue(status.getMessage().contains(": " + OFFLINE_HINT_TEXT));
} finally {
ServiceLocator.setInstance(new ServiceLocator());
}
}
Aggregations