use of org.eclipse.epp.mpc.ui.CatalogDescriptor in project epp.mpc by eclipse.
the class CatalogDescriptorTest method testCatalogDescriptor.
@Test
public void testCatalogDescriptor() throws Exception {
URL dependenciesRepository = new URL("http://marketplace.eclipse.org/repo/");
String description = "some description";
ImageDescriptor icon = ImageDescriptor.getMissingImageDescriptor();
boolean installFromAllRepositories = true;
String label = "some label";
URL url = new URL("http://marketplace.eclipse.org");
CatalogDescriptor descriptor = new CatalogDescriptor();
descriptor.setDependenciesRepository(dependenciesRepository);
descriptor.setDescription(description);
descriptor.setIcon(icon);
descriptor.setInstallFromAllRepositories(installFromAllRepositories);
descriptor.setLabel(label);
descriptor.setUrl(url);
assertEquals(dependenciesRepository.toString(), descriptor.getDependenciesRepository().toString());
assertEquals(description, descriptor.getDescription());
assertEquals(icon, descriptor.getIcon());
assertEquals(installFromAllRepositories, descriptor.isInstallFromAllRepositories());
assertEquals(label, descriptor.getLabel());
assertEquals(url.toString(), descriptor.getUrl().toString());
CatalogDescriptor copyDescriptor = new CatalogDescriptor(descriptor);
assertEquals(dependenciesRepository.toString(), copyDescriptor.getDependenciesRepository().toString());
assertEquals(description, copyDescriptor.getDescription());
assertEquals(icon, copyDescriptor.getIcon());
assertEquals(installFromAllRepositories, copyDescriptor.isInstallFromAllRepositories());
assertEquals(label, copyDescriptor.getLabel());
assertEquals(url.toString(), copyDescriptor.getUrl().toString());
assertTrue(descriptor.equals(copyDescriptor));
assertEquals(descriptor.hashCode(), copyDescriptor.hashCode());
}
use of org.eclipse.epp.mpc.ui.CatalogDescriptor in project epp.mpc by eclipse.
the class CatalogDescriptorTest method testFindCatalogDescriptorMatchingProtocol.
@Test
public void testFindCatalogDescriptorMatchingProtocol() throws Exception {
CatalogRegistry registry = CatalogRegistry.getInstance();
String marketplace = "http://marketplace.eclipse.org";
String marketplaceHttps = URLUtil.toggleHttps(marketplace);
CatalogDescriptor marketplaceDescriptor = new CatalogDescriptor(new URL(marketplace), null);
CatalogDescriptor marketplaceHttpsDescriptor = new CatalogDescriptor(new URL(marketplaceHttps), null);
registry.register(marketplaceHttpsDescriptor);
registry.register(marketplaceDescriptor);
CatalogDescriptor found = registry.findCatalogDescriptor(marketplace);
assertThat(found, is(marketplaceDescriptor));
found = registry.findCatalogDescriptor(marketplaceHttps);
assertThat(found, is(marketplaceHttpsDescriptor));
}
use of org.eclipse.epp.mpc.ui.CatalogDescriptor in project epp.mpc by eclipse.
the class CatalogDescriptorTest method testIgnoreCatalogDescriptorWithDedicatedHostingSuffix.
@Test
public void testIgnoreCatalogDescriptorWithDedicatedHostingSuffix() throws Exception {
CatalogRegistry registry = CatalogRegistry.getInstance();
String marketplace = "http://marketplace.eclipse.org";
String dedicatedHostingMarketplace = marketplace + "/" + ICatalogService.DEDICATED_CATALOG_HOSTING_SEGMENT + "test";
CatalogDescriptor dedicatedHostingDescriptor = new CatalogDescriptor(new URL(dedicatedHostingMarketplace), null);
registry.register(dedicatedHostingDescriptor);
CatalogDescriptor found = registry.findCatalogDescriptor(marketplace);
assertNull(found);
found = registry.findCatalogDescriptor(dedicatedHostingMarketplace);
assertThat(found, is(dedicatedHostingDescriptor));
}
use of org.eclipse.epp.mpc.ui.CatalogDescriptor in project epp.mpc by eclipse.
the class CatalogDescriptorTest method cleanRegistry.
@Before
@After
public void cleanRegistry() {
CatalogRegistry registry = CatalogRegistry.getInstance();
List<CatalogDescriptor> catalogs = new ArrayList<>(registry.getCatalogDescriptors());
for (CatalogDescriptor descriptor : catalogs) {
registry.unregister(descriptor);
}
}
use of org.eclipse.epp.mpc.ui.CatalogDescriptor in project epp.mpc by eclipse.
the class MarketplaceClientUiTest method testOfflineCatalogErrors.
@Test
public void testOfflineCatalogErrors() throws Exception {
final MarketplaceCatalog catalog = new MarketplaceCatalog();
catalog.getDiscoveryStrategies().add(new MarketplaceDiscoveryStrategy(new CatalogDescriptor(new URL(UNREACHABLE_MARKETPLACE_URL), "Unreachable Marketplace")));
IStatus status = catalog.performDiscovery(new NullProgressMonitor());
assertEquals(IStatus.ERROR, status.getSeverity());
assertTrue(status.getMessage().startsWith(OFFLINE_HINT_TEXT));
}
Aggregations