Search in sources :

Example 41 with INode

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

the class SolutionCompatibilityFilterTest method testIncompatibleSearchResult.

public void testIncompatibleSearchResult() throws CoreException {
    assumeFalse("Skipping test - this solution and Eclipse/OS are compatible", compatible);
    INode foundNode = searchForNode();
    assertNull("Incompatible node {0} found in search", foundNode);
}
Also used : INode(org.eclipse.epp.mpc.core.model.INode)

Example 42 with INode

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

the class UnmarshallerTest method featured.

@Test
public void featured() throws IOException, UnmarshalException {
    // from http://www.eclipseplugincentral.net/api/v2/featured
    Object model = processResource("resources/featured.xml");
    assertNotNull(model);
    assertTrue(model instanceof Marketplace);
    Marketplace marketplace = (Marketplace) model;
    Featured featured = marketplace.getFeatured();
    assertNotNull(featured);
    assertEquals(Integer.valueOf(6), featured.getCount());
    assertEquals(6, featured.getNode().size());
    INode node = featured.getNode().get(0);
    assertEquals("248", node.getId());
    assertEquals("eUML2 free edition", node.getName());
    assertEquals("http://www.eclipseplugincentral.net/content/euml2-free-edition", node.getUrl());
    assertEquals("resource", node.getType());
    ICategories categories = node.getCategories();
    assertNotNull(categories);
    assertEquals(1, categories.getCategory().size());
    ICategory category = categories.getCategory().get(0);
    assertEquals("19", category.getId());
    assertEquals("UML", category.getName());
    assertEquals("http://www.eclipseplugincentral.net/taxonomy/term/19", category.getUrl());
    assertEquals("Yves YANG", node.getOwner());
    assertEquals(Integer.valueOf(0), node.getFavorited());
    assertNotNull(node.getBody());
    // bug 303149		assertTrue(node.getBody().startsWith("<P><STRONG>eUML2 for Java<"));
    // bug 303149		assertTrue(node.getBody().endsWith("</LI></UL>"));
    assertTrue(node.getFoundationmember());
    assertEquals("http://www.soyatec.com/", node.getHomepageurl());
    assertEquals("http://www.soyatec.com/euml2/images/product_euml2_110x80.png", node.getImage());
    assertEquals("3.4", node.getVersion());
    assertEquals("Free for non-commercial use", node.getLicense());
    assertEquals("Soyatec", node.getCompanyname());
    assertEquals("Mature", node.getStatus());
    assertEquals("3.4.x/3.5.x", node.getEclipseversion());
    assertEquals("http://www.soyatec.com/forum", node.getSupporturl());
    assertEquals("http://www.soyatec.com/update", 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) Featured(org.eclipse.epp.internal.mpc.core.model.Featured) Test(org.junit.Test)

Example 43 with INode

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

the class UnmarshallerTest method node.

@Test
public void node() throws IOException, UnmarshalException {
    // from http://www.eclipseplugincentral.net/content/mylyn-wikitext-lightweight-markup-editing-tools-and-framework/xml
    Object model = processResource("resources/node.xml");
    assertNotNull(model);
    assertTrue(model instanceof Marketplace);
    Marketplace marketplace = (Marketplace) model;
    assertEquals(1, marketplace.getNode().size());
    INode node = marketplace.getNode().get(0);
    assertEquals("1065", node.getId());
    assertEquals("Mylyn WikiText - Lightweight Markup Editing, Tools and Framework", node.getName());
    assertEquals("http://www.eclipseplugincentral.net/content/mylyn-wikitext-lightweight-markup-editing-tools-and-framework", node.getUrl());
    assertNotNull(node.getBody());
    assertTrue(node.getBody().startsWith("Mylyn WikiText is a"));
    assertTrue(node.getBody().endsWith("FAQ</a>."));
    assertNotNull(node.getCategories());
    assertEquals(5, node.getCategories().getCategory().size());
    ICategory category = node.getCategories().getCategory().get(1);
    // <category name='Tools'>/taxonomy/term/17</category>
    assertEquals("Tools", category.getName());
    // FIXME category id.
    assertNotNull(node.getCreated());
    assertEquals(1259955243L, node.getCreated().getTime() / 1000);
    assertEquals(new Integer(3), node.getFavorited());
    assertEquals(Boolean.TRUE, node.getFoundationmember());
    assertNotNull(node.getChanged());
    assertEquals(1259964722L, node.getChanged().getTime() / 1000);
    assertEquals("David Green", node.getOwner());
    assertEquals("resource", node.getType());
}
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 44 with INode

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

the class UserFavoritesService method createFavoritesBlobData.

protected String createFavoritesBlobData(Collection<? extends INode> nodes) {
    if (nodes.isEmpty()) {
        return null;
    }
    List<String> nodeIds = new ArrayList<String>(nodes.size());
    for (INode node : nodes) {
        nodeIds.add(node.getId());
    }
    Collections.sort(nodeIds);
    StringBuilder builder = new StringBuilder();
    boolean first = true;
    for (String nodeId : nodeIds) {
        if (first) {
            first = false;
        } else {
            builder.append(SEPARATOR);
        }
        builder.append(nodeId);
    }
    return builder.toString();
}
Also used : INode(org.eclipse.epp.mpc.core.model.INode) ArrayList(java.util.ArrayList)

Example 45 with INode

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

the class UserFavoritesService method toNodes.

private static List<INode> toNodes(Collection<String> favoriteIds) {
    List<INode> favoriteNodes = new ArrayList<INode>(favoriteIds.size());
    for (String nodeId : favoriteIds) {
        INode node = QueryHelper.nodeById(nodeId);
        favoriteNodes.add(node);
    }
    return favoriteNodes;
}
Also used : INode(org.eclipse.epp.mpc.core.model.INode) ArrayList(java.util.ArrayList)

Aggregations

INode (org.eclipse.epp.mpc.core.model.INode)63 Node (org.eclipse.epp.internal.mpc.core.model.Node)13 ArrayList (java.util.ArrayList)12 CoreException (org.eclipse.core.runtime.CoreException)12 SubMonitor (org.eclipse.core.runtime.SubMonitor)12 Test (org.junit.Test)12 HashMap (java.util.HashMap)10 HashSet (java.util.HashSet)10 Marketplace (org.eclipse.epp.internal.mpc.core.model.Marketplace)10 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)8 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)8 ICategory (org.eclipse.epp.mpc.core.model.ICategory)8 URISyntaxException (java.net.URISyntaxException)7 NotAuthorizedException (org.eclipse.epp.internal.mpc.core.service.AbstractDataStorageService.NotAuthorizedException)7 ISearchResult (org.eclipse.epp.mpc.core.model.ISearchResult)7 IOException (java.io.IOException)6 MalformedURLException (java.net.MalformedURLException)6 List (java.util.List)6 IUserFavoritesService (org.eclipse.epp.mpc.core.service.IUserFavoritesService)6 CatalogItem (org.eclipse.equinox.internal.p2.discovery.model.CatalogItem)6