Search in sources :

Example 1 with Recent

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

the class UnmarshallerTest method recent.

@Test
public void recent() throws IOException, UnmarshalException {
    // from http://www.eclipseplugincentral.net/featured/top/api/p
    Object model = processResource("resources/recent.xml");
    assertNotNull(model);
    assertTrue(model instanceof Marketplace);
    Marketplace marketplace = (Marketplace) model;
    Recent recent = marketplace.getRecent();
    assertNotNull(recent);
    assertEquals(Integer.valueOf(6), recent.getCount());
    assertEquals(6, recent.getNode().size());
    INode node = recent.getNode().get(0);
    assertEquals("1091", node.getId());
    assertEquals("API Demonstration Listing", node.getName());
    assertEquals("http://www.eclipseplugincentral.net/content/api-demonstration-listing", node.getUrl());
    assertEquals("resource", node.getType());
    ICategories categories = node.getCategories();
    assertNotNull(categories);
    assertEquals(6, categories.getCategory().size());
    ICategory category = categories.getCategory().get(0);
    assertEquals("3", category.getId());
    assertEquals("Database", category.getName());
    assertEquals("http://www.eclipseplugincentral.net/taxonomy/term/3", category.getUrl());
    category = categories.getCategory().get(5);
    assertEquals("38", category.getId());
    assertEquals("Mylyn Connectors", category.getName());
    assertEquals("http://www.eclipseplugincentral.net/category/categories/mylyn-connectors", category.getUrl());
    assertEquals("admin", node.getOwner());
    assertEquals(Integer.valueOf(0), node.getFavorited());
    assertNotNull(node.getBody());
    assertTrue(node.getBody().startsWith("Lorem ipsum dolor"));
    assertTrue(node.getBody().endsWith("vitae aliquam lectus."));
    assertTrue(node.getFoundationmember());
    assertEquals("http://marketplace.eclipse.org/xmlapi", node.getHomepageurl());
    assertEquals("http://marketplace.eclipse.org/sites/default/files/equinox.png", node.getImage());
    assertEquals("1.0", node.getVersion());
    assertEquals("EPL", node.getLicense());
    assertEquals("Eclipse Foundation Inc.", node.getCompanyname());
    assertEquals("Mature", node.getStatus());
    assertEquals("3.5", node.getEclipseversion());
    assertEquals("http://marketplace.eclipse.org/support", node.getSupporturl());
    assertEquals("http://update.eclipse.org/marketplace", node.getUpdateurl());
    {
        String[] expectedIus = new String[] { "org.eclipse.one.one", "org.eclipse.one.two", "org.eclipse.two.one", "org.eclipse.three.one" };
        assertNotNull(node.getIus());
        assertEquals(expectedIus.length, node.getIus().getIu().size());
        for (int x = 0; x < expectedIus.length; ++x) {
            assertEquals(expectedIus[x], node.getIus().getIu().get(x));
        }
    }
    {
        String[] expectedPlatforms = new String[] { "Windows", "Mac", "Linux/GTK" };
        assertNotNull(node.getPlatforms());
        assertEquals(expectedPlatforms.length, node.getPlatforms().getPlatform().size());
        for (int x = 0; x < expectedPlatforms.length; ++x) {
            assertEquals(expectedPlatforms[x], node.getPlatforms().getPlatform().get(x));
        }
    }
}
Also used : Recent(org.eclipse.epp.internal.mpc.core.model.Recent) Marketplace(org.eclipse.epp.internal.mpc.core.model.Marketplace) INode(org.eclipse.epp.mpc.core.model.INode) ICategories(org.eclipse.epp.mpc.core.model.ICategories) ICategory(org.eclipse.epp.mpc.core.model.ICategory) Test(org.junit.Test)

Aggregations

Marketplace (org.eclipse.epp.internal.mpc.core.model.Marketplace)1 Recent (org.eclipse.epp.internal.mpc.core.model.Recent)1 ICategories (org.eclipse.epp.mpc.core.model.ICategories)1 ICategory (org.eclipse.epp.mpc.core.model.ICategory)1 INode (org.eclipse.epp.mpc.core.model.INode)1 Test (org.junit.Test)1