Search in sources :

Example 1 with ICatalogs

use of org.eclipse.epp.mpc.core.model.ICatalogs in project epp.mpc by eclipse.

the class UnmarshallerTest method marketplaceCatalogs.

@Test
public void marketplaceCatalogs() throws IOException, UnmarshalException {
    Object model = processResource("resources/catalogs.xml");
    assertNotNull(model);
    assertTrue(model instanceof ICatalogs);
    ICatalogs catalogs = (ICatalogs) model;
    assertEquals(3, catalogs.getCatalogs().size());
    // <catalog id="35656" title="Marketplace Catalog" url="http://marketplace.eclipse.org" selfContained="1"  dependencyRepository="http://download.eclipse.org/releases/helios">
    // <description>Here is a description</description>
    // <icon>http://marketplace.eclipse.org/sites/default/files/jacket.jpg</icon>
    // <wizard title="Eclipse Marketplace Catalog">
    // <icon>http://marketplace.eclipse.org/sites/default/files/giant-rabbit2.jpg</icon>
    // <searchtab enabled='1'>Search</searchtab>
    // <populartab enabled='1'>Popular</populartab>
    // <recenttab enabled='1'>Recent</recenttab>
    // </wizard>
    // </catalog>
    ICatalog catalog = catalogs.getCatalogs().get(0);
    assertEquals("35656", catalog.getId());
    assertEquals("Marketplace Catalog", catalog.getName());
    assertEquals("http://marketplace.eclipse.org", catalog.getUrl());
    assertEquals("Here is a description", catalog.getDescription());
    assertTrue(catalog.isSelfContained());
    assertEquals("http://marketplace.eclipse.org/sites/default/files/marketplace32.png", catalog.getImageUrl());
    assertEquals("http://download.eclipse.org/releases/helios", catalog.getDependencyRepository());
    ICatalogBranding branding = catalog.getBranding();
    assertNotNull(branding);
    assertEquals("Eclipse Marketplace Catalog", branding.getWizardTitle());
    assertEquals("http://marketplace.eclipse.org/sites/default/files/giant-rabbit2.jpg", branding.getWizardIcon());
    assertEquals("Search", branding.getSearchTabName());
    assertEquals("Popular", branding.getPopularTabName());
    assertEquals("Recent", branding.getRecentTabName());
    assertTrue(branding.hasSearchTab());
    assertFalse(branding.hasPopularTab());
    assertTrue(branding.hasRecentTab());
    INews news = catalog.getNews();
    assertNotNull(news);
    assertEquals("http://marketplace.eclipse.org/news", news.getUrl());
    assertEquals("News", news.getShortTitle());
    assertEquals(Long.valueOf(1363181064000l), news.getTimestamp());
    assertNull(catalogs.getCatalogs().get(1).getNews());
    assertNull(catalogs.getCatalogs().get(2).getNews());
}
Also used : INews(org.eclipse.epp.mpc.core.model.INews) ICatalogs(org.eclipse.epp.mpc.core.model.ICatalogs) ICatalogBranding(org.eclipse.epp.mpc.core.model.ICatalogBranding) ICatalog(org.eclipse.epp.mpc.core.model.ICatalog) Test(org.junit.Test)

Aggregations

ICatalog (org.eclipse.epp.mpc.core.model.ICatalog)1 ICatalogBranding (org.eclipse.epp.mpc.core.model.ICatalogBranding)1 ICatalogs (org.eclipse.epp.mpc.core.model.ICatalogs)1 INews (org.eclipse.epp.mpc.core.model.INews)1 Test (org.junit.Test)1