Search in sources :

Example 1 with INode

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

the class DefaultMarketplaceServiceTest method getNodes.

@Test
@org.junit.experimental.categories.Category(RemoteTests.class)
public void getNodes() throws CoreException {
    // Mylyn
    INode idNode1 = QueryHelper.nodeById("206");
    // Subversive
    INode idNode2 = QueryHelper.nodeById("1139");
    // M2E
    INode idNode3 = QueryHelper.nodeById("252");
    INode urlNode = QueryHelper.nodeByUrl("https://marketplace.eclipse.org/content/egit-git-integration-eclipse");
    List<INode> query = Arrays.asList(idNode1, idNode2, urlNode, idNode3);
    List<INode> result = marketplaceService.getNodes(query, new NullProgressMonitor());
    assertEquals(query.size(), result.size());
    for (int i = 0; i < query.size(); i++) {
        INode queryNode = query.get(i);
        INode resultNode = query.get(i);
        if (queryNode.getId() != null) {
            assertEquals(queryNode.getId(), resultNode.getId());
        }
        if (queryNode.getUrl() != null) {
            assertEquals(queryNode.getUrl(), resultNode.getUrl());
        }
    }
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) INode(org.eclipse.epp.mpc.core.model.INode) Test(org.junit.Test)

Example 2 with INode

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

the class SolutionCompatibilityFilterTest method searchForNode.

protected INode searchForNode() throws CoreException {
    ISearchResult searchResult = marketplaceService.search(null, null, solution.query(), new NullProgressMonitor());
    assertSearchResultSanity(searchResult);
    List<? extends INode> nodes = searchResult.getNodes();
    INode foundNode = null;
    for (INode node : nodes) {
        if ((solution.id() != null && solution.id().equals(node.getId())) || (solution.url() != null && solution.url().equals(node.getUrl()))) {
            foundNode = node;
            break;
        }
    }
    return foundNode;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) ISearchResult(org.eclipse.epp.mpc.core.model.ISearchResult) INode(org.eclipse.epp.mpc.core.model.INode)

Example 3 with INode

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

the class SolutionCompatibilityFilterTest method testIncompatibleNode.

public void testIncompatibleNode() throws CoreException {
    assumeFalse("Skipping test - this solution and Eclipse/OS are compatible", compatible);
    INode node = queryNode();
    String updateurl = node.getUpdateurl();
    assertNull("Incompatible node {1} should not have an update url, but has {0}", updateurl, node);
    IIus ius = node.getIus();
    assertNull("Incompatible node {1} should not have an <ius> element", ius, node);
}
Also used : INode(org.eclipse.epp.mpc.core.model.INode) IIus(org.eclipse.epp.mpc.core.model.IIus)

Example 4 with INode

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

the class SolutionCompatibilityFilterTest method testCompatibleNonInstallableNode.

public void testCompatibleNonInstallableNode() throws CoreException {
    assumeTrue("Skipping test - this solution and Eclipse/OS are incompatible", compatible);
    assumeFalse("Skipping test - this solution is installable", solution.installable());
    INode node = queryNode();
    String updateurl = node.getUpdateurl();
    assertNull("Uninstallable node {1} should not have an update url, but has {0}", updateurl, node);
    IIus ius = node.getIus();
    assertNull("Uninstallable node {1} should not have an <ius> element", ius, node);
}
Also used : INode(org.eclipse.epp.mpc.core.model.INode) IIus(org.eclipse.epp.mpc.core.model.IIus)

Example 5 with INode

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

the class SolutionCompatibilityFilterTest method assertSearchResultSanity.

protected void assertSearchResultSanity(ISearchResult result) {
    assertNotNull("Search result is null", result);
    assertNotNull("Result node list is null (internal error)", result.getNodes());
    assertNotNull("Result match count is null ('count' attribute missing)", result.getMatchCount());
    assertTrue("Total search result count {1} has to be at least the number of returned nodes {2}", result.getMatchCount() >= result.getNodes().size(), result.getMatchCount(), result.getNodes().size());
    Set<String> ids = new HashSet<String>();
    for (INode node : result.getNodes()) {
        assertNotNull("Search result node {1} without id", node.getId(), node);
        assertTrue("Duplicate search result node {1}", ids.add(node.getId()), node);
    }
}
Also used : INode(org.eclipse.epp.mpc.core.model.INode) HashSet(java.util.HashSet)

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