use of org.eclipse.epp.internal.mpc.core.service.DefaultCatalogService in project epp.mpc by eclipse.
the class ServiceLocator method getCatalogService.
public synchronized ICatalogService getCatalogService() {
if (catalogServiceTracker != null) {
ICatalogService registeredService = catalogServiceTracker.getService();
if (registeredService != null) {
// we don't cache this on our own, since it might become invalid
return registeredService;
}
}
if (catalogService != null) {
return catalogService;
}
ICatalogService catalogService = new DefaultCatalogService(defaultCatalogUrl);
registerService(null, ICatalogService.class, catalogService);
return catalogService;
}
use of org.eclipse.epp.internal.mpc.core.service.DefaultCatalogService 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