use of org.eclipse.epp.internal.mpc.ui.CatalogRegistry 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.internal.mpc.ui.CatalogRegistry 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.internal.mpc.ui.CatalogRegistry 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.internal.mpc.ui.CatalogRegistry in project epp.mpc by eclipse.
the class CatalogDescriptorTest method testFindCatalogDescriptorWithCommonPrefixDifferentProtocol2.
/**
* @throws Exception
* @see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=488436">bug 488436</a>
*/
@Test
public void testFindCatalogDescriptorWithCommonPrefixDifferentProtocol2() throws Exception {
CatalogRegistry registry = CatalogRegistry.getInstance();
String marketplace = "https://marketplace.eclipse.org";
String marketplaceHttp = URLUtil.toggleHttps(marketplace);
String hostedMarketplace = "http://marketplace.eclipse.org/hosted_catalog/test";
String hostedMarketplaceHttps = URLUtil.toggleHttps(hostedMarketplace);
CatalogDescriptor marketplaceDescriptor = new CatalogDescriptor(new URL(marketplace), null);
CatalogDescriptor hostedMarketplaceDescriptor = new CatalogDescriptor(new URL(hostedMarketplace), null);
registry.register(marketplaceDescriptor);
registry.register(hostedMarketplaceDescriptor);
CatalogDescriptor found = registry.findCatalogDescriptor(marketplaceHttp);
assertThat(found, is(marketplaceDescriptor));
found = registry.findCatalogDescriptor(hostedMarketplaceHttps);
assertThat(found, is(hostedMarketplaceDescriptor));
}
use of org.eclipse.epp.internal.mpc.ui.CatalogRegistry in project epp.mpc by eclipse.
the class CatalogDescriptorTest method testFindCatalogDescriptorWithCommonPrefixDifferentProtocol1.
/**
* @throws Exception
* @see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=488436">bug 488436</a>
*/
@Test
public void testFindCatalogDescriptorWithCommonPrefixDifferentProtocol1() throws Exception {
CatalogRegistry registry = CatalogRegistry.getInstance();
String marketplace = "http://marketplace.eclipse.org";
String marketplaceHttps = URLUtil.toggleHttps(marketplace);
String hostedMarketplace = "https://marketplace.eclipse.org/hosted_catalog/test";
String hostedMarketplaceHttp = URLUtil.toggleHttps(hostedMarketplace);
CatalogDescriptor marketplaceDescriptor = new CatalogDescriptor(new URL(marketplace), null);
CatalogDescriptor hostedMarketplaceDescriptor = new CatalogDescriptor(new URL(hostedMarketplace), null);
registry.register(marketplaceDescriptor);
registry.register(hostedMarketplaceDescriptor);
CatalogDescriptor found = registry.findCatalogDescriptor(marketplaceHttps);
assertThat(found, is(marketplaceDescriptor));
found = registry.findCatalogDescriptor(hostedMarketplaceHttp);
assertThat(found, is(hostedMarketplaceDescriptor));
}
Aggregations