Search in sources :

Example 1 with Marketplace

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

the class UnmarshallerTest method search.

@Test
public void search() throws IOException, UnmarshalException {
    // from http://www.eclipseplugincentral.net/api/v2/search/apachesolr_search/test?filters=tid:16%20tid:31
    Object model = processResource("resources/search.xml");
    assertNotNull(model);
    assertTrue(model instanceof Marketplace);
    Marketplace marketplace = (Marketplace) model;
    Search search = marketplace.getSearch();
    assertNotNull(search);
    assertEquals("test", search.getTerm());
    assertEquals("http://www.eclipseplugincentral.net/search/apachesolr/test?filters=tid%3A16%20tid%3A31", search.getUrl());
    assertEquals(Integer.valueOf(62), search.getCount());
    assertEquals(7, search.getNode().size());
    INode node = search.getNode().get(0);
    assertEquals("983", node.getId());
    assertEquals("Run All Tests", node.getName());
    assertEquals("http://www.eclipseplugincentral.net/content/run-all-tests", node.getUrl());
    assertEquals("resource", node.getType());
    ICategories categories = node.getCategories();
    assertNotNull(categories);
    assertEquals(1, categories.getCategory().size());
    ICategory category = categories.getCategory().get(0);
    assertEquals("16", category.getId());
    assertEquals("Testing", category.getName());
    assertEquals("http://www.eclipseplugincentral.net/taxonomy/term/16", category.getUrl());
    assertEquals("ipreuss", node.getOwner());
    assertNotNull(node.getBody());
    assertEquals("Allows the execution of JUnit tests for several projects at once.", node.getBody());
    assertTrue(!node.getFoundationmember());
    assertEquals("https://sourceforge.net/projects/e-rat/", node.getHomepageurl());
    assertNull(node.getImage());
    assertEquals("1.0.1", node.getVersion());
    assertEquals("Other", node.getLicense());
    assertEquals("Ilja Preu\u00DF", node.getCompanyname());
    assertEquals("Production/Stable", node.getStatus());
    assertEquals("3.5", node.getEclipseversion());
    assertEquals("https://sourceforge.net/projects/e-rat/support", node.getSupporturl());
    assertEquals("http://e-rat.sf.net/updatesite", node.getUpdateurl());
    assertEquals(Integer.valueOf(136), node.getFavorited());
    assertEquals(Integer.valueOf(299995), node.getInstallsTotal());
    assertEquals(Integer.valueOf(34540), node.getInstallsRecent());
    INode lastNode = search.getNode().get(search.getNode().size() - 1);
    assertEquals("1011", lastNode.getId());
    assertEquals("JUnit Flux", lastNode.getName());
    assertNull(lastNode.getFavorited());
    assertNull(lastNode.getInstallsTotal());
    assertNull(lastNode.getInstallsRecent());
}
Also used : 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) Search(org.eclipse.epp.internal.mpc.core.model.Search) ICategory(org.eclipse.epp.mpc.core.model.ICategory) Test(org.junit.Test)

Example 2 with Marketplace

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

the class UnmarshallerTest method tags.

@Test
public void tags() throws Exception {
    Object model = processResource("resources/node.xml");
    Marketplace marketplace = (Marketplace) model;
    INode node = marketplace.getNode().get(0);
    assertNotNull(node.getTags());
    assertEquals(5, node.getCategories().getCategory().size());
    ITag tag = node.getTags().getTags().get(3);
    assertEquals("mylyn", tag.getName());
    assertEquals("88", tag.getId());
    assertEquals("http://marketplace.eclipse.org/category/free-tagging/mylyn", tag.getUrl());
}
Also used : Marketplace(org.eclipse.epp.internal.mpc.core.model.Marketplace) INode(org.eclipse.epp.mpc.core.model.INode) ITag(org.eclipse.epp.mpc.core.model.ITag) Test(org.junit.Test)

Example 3 with Marketplace

use of org.eclipse.epp.internal.mpc.core.model.Marketplace 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)

Example 4 with Marketplace

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

the class UnmarshallerTest method categoryTaxonomy.

@Test
public void categoryTaxonomy() throws IOException, UnmarshalException {
    // from http://www.eclipseplugincentral.net/taxonomy/term/38,31/xml
    Object model = processResource("resources/category-taxonomy.xml");
    assertNotNull(model);
    assertTrue(model instanceof Marketplace);
    Marketplace marketplace = (Marketplace) model;
    assertEquals(1, marketplace.getCategory().size());
    ICategory category = marketplace.getCategory().get(0);
    assertEquals("38,31", category.getId());
    assertEquals("Mylyn Connectors", category.getName());
    assertEquals("http://www.eclipseplugincentral.net/taxonomy/term/38%2C31", category.getUrl());
    assertEquals(9, category.getNode().size());
    INode node = category.getNode().get(0);
    // <node id="641" name="Tasktop Pro">
    // <url>http://www.eclipseplugincentral.net/content/tasktop-pro</url>
    // <favorited>3</favorited>
    // </node>
    assertEquals("641", node.getId());
    assertEquals("Tasktop Pro", node.getName());
    assertEquals("http://www.eclipseplugincentral.net/content/tasktop-pro", node.getUrl());
}
Also used : Marketplace(org.eclipse.epp.internal.mpc.core.model.Marketplace) INode(org.eclipse.epp.mpc.core.model.INode) ICategory(org.eclipse.epp.mpc.core.model.ICategory) Test(org.junit.Test)

Example 5 with Marketplace

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

the class UnmarshallerTest method favorites.

@Test
public void favorites() throws IOException, UnmarshalException {
    // from http://www.eclipseplugincentral.net/favorites/top/api/p
    Object model = processResource("resources/favorites.xml");
    assertNotNull(model);
    assertTrue(model instanceof Marketplace);
    Marketplace marketplace = (Marketplace) model;
    Favorites favorites = marketplace.getFavorites();
    assertNotNull(favorites);
    assertEquals(Integer.valueOf(6), favorites.getCount());
    assertEquals(6, favorites.getNode().size());
    INode node = favorites.getNode().get(0);
    assertEquals("206", node.getId());
    assertEquals("Mylyn", node.getName());
    assertEquals("http://www.eclipseplugincentral.net/content/mylyn", node.getUrl());
    assertEquals("resource", node.getType());
    ICategories categories = node.getCategories();
    assertNotNull(categories);
    assertEquals(1, categories.getCategory().size());
    ICategory category = categories.getCategory().get(0);
    assertEquals("18", category.getId());
    assertEquals("UI", category.getName());
    assertEquals("http://www.eclipseplugincentral.net/taxonomy/term/18", category.getUrl());
    assertEquals("Robert Elves", node.getOwner());
    assertEquals(Integer.valueOf(16), node.getFavorited());
    assertNotNull(node.getBody());
    assertEquals("Mylyn is a task-focused interface for Eclipse that reduces information overload and makes multi-tasking easy. It does this by making tasks a first class part of Eclipse, and integrating rich and offline editing for repositories such as Bugzilla, Trac, and JIRA. Once your tasks are integrated, Mylyn monitors your work activity to identify information relevant to the task-at-hand, and uses this task context to focus the Eclipse UI on the interesting information, hide the uninteresting, and automatically find what&#039;s related. This puts the information you need to get work done at your fingertips and improves productivity by reducing searching, scrolling, and navigation. By making task context explicit Mylyn also facilitates multitasking, planning, reusing past efforts, and sharing expertise. ", node.getBody());
    assertTrue(node.getFoundationmember());
    assertEquals("http://eclipse.org/mylyn", node.getHomepageurl());
    assertEquals("http://www.eclipse.org/mylyn/images/image-epic.gif", node.getImage());
    assertEquals("3.3", node.getVersion());
    assertEquals("EPL", node.getLicense());
    assertEquals("Eclipse.org", node.getCompanyname());
    assertEquals("Production/Stable", node.getStatus());
    assertEquals("3.5, 3.4 and 3.3", node.getEclipseversion());
    assertEquals("http://eclipse.org/mylyn/community/", node.getSupporturl());
    assertEquals("http://download.eclipse.org/tools/mylyn/update/e3.4", node.getUpdateurl());
}
Also used : 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) Favorites(org.eclipse.epp.internal.mpc.core.model.Favorites) Test(org.junit.Test)

Aggregations

Marketplace (org.eclipse.epp.internal.mpc.core.model.Marketplace)18 INode (org.eclipse.epp.mpc.core.model.INode)11 ICategory (org.eclipse.epp.mpc.core.model.ICategory)9 Test (org.junit.Test)9 CoreException (org.eclipse.core.runtime.CoreException)4 ICategories (org.eclipse.epp.mpc.core.model.ICategories)4 Node (org.eclipse.epp.internal.mpc.core.model.Node)3 Category (org.eclipse.epp.internal.mpc.core.model.Category)2 Search (org.eclipse.epp.internal.mpc.core.model.Search)2 IMarket (org.eclipse.epp.mpc.core.model.IMarket)2 FileNotFoundException (java.io.FileNotFoundException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 OperationCanceledException (org.eclipse.core.runtime.OperationCanceledException)1 SubMonitor (org.eclipse.core.runtime.SubMonitor)1 Favorites (org.eclipse.epp.internal.mpc.core.model.Favorites)1 Featured (org.eclipse.epp.internal.mpc.core.model.Featured)1 Market (org.eclipse.epp.internal.mpc.core.model.Market)1 News (org.eclipse.epp.internal.mpc.core.model.News)1