Search in sources :

Example 31 with INode

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

the class AbstractMarketplaceWizardBotTest method launchMarketplaceWizard.

protected void launchMarketplaceWizard() {
    final MarketplaceWizardCommand marketplaceWizardCommand = new MarketplaceWizardCommand();
    WizardState wizardState = new WizardState();
    wizardState.setContent(new LinkedHashSet<INode>(Arrays.asList(TEST_NODES)));
    wizardState.setProceedWithInstallation(false);
    marketplaceWizardCommand.setWizardDialogState(wizardState);
    UIThreadRunnable.asyncExec(new VoidResult() {

        public void run() {
            try {
                marketplaceWizardCommand.execute(new ExecutionEvent());
            } catch (ExecutionException e) {
                fail("ExecutionException: " + e.getMessage());
            // otherwise ignore, we'll notice in the test thread when we don't get the wizard dialog in time
            }
        }
    });
}
Also used : INode(org.eclipse.epp.mpc.core.model.INode) VoidResult(org.eclipse.swtbot.swt.finder.results.VoidResult) ExecutionEvent(org.eclipse.core.commands.ExecutionEvent) ExecutionException(org.eclipse.core.commands.ExecutionException) MarketplaceWizardCommand(org.eclipse.epp.internal.mpc.ui.commands.MarketplaceWizardCommand) WizardState(org.eclipse.epp.internal.mpc.ui.wizards.MarketplaceWizard.WizardState)

Example 32 with INode

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

the class AbstractMarketplaceWizardBotTest method testNode.

private static INode testNode(String id, String url, String name) {
    Node node = (Node) QueryHelper.nodeById(id);
    node.setUrl(url);
    node.setName(name);
    return node;
}
Also used : Node(org.eclipse.epp.internal.mpc.core.model.Node) INode(org.eclipse.epp.mpc.core.model.INode)

Example 33 with INode

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

the class MarketplaceDiscoveryStrategyTest method testSearchByNodeUrl.

@Test
public void testSearchByNodeUrl() throws Exception {
    final INode[] testNode = new INode[1];
    final IMarketplaceService marketplaceService = new DefaultMarketplaceService(catalogUrl) {

        @Override
        public Node getNode(INode node, IProgressMonitor monitor) throws CoreException {
            testNode[0] = node;
            return (Node) node;
        }

        @Override
        public SearchResult search(IMarket market, ICategory category, String queryText, IProgressMonitor monitor) throws CoreException {
            Assert.fail("Unexpected invocation");
            // dead code
            return null;
        }
    };
    setupCatalog(marketplaceService);
    testNode[0] = null;
    catalog.performQuery(null, null, new URL(catalogUrl, "content/test").toExternalForm(), new NullProgressMonitor());
    assertNotNull(testNode[0]);
    assertNotNull(testNode[0].getUrl());
    testNode[0] = null;
    catalog.performQuery(null, null, new URL(catalogUrl, "node/12345").toExternalForm(), new NullProgressMonitor());
    assertNotNull(testNode[0]);
    assertNotNull(testNode[0].getId());
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) INode(org.eclipse.epp.mpc.core.model.INode) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) DefaultMarketplaceService(org.eclipse.epp.internal.mpc.core.service.DefaultMarketplaceService) Node(org.eclipse.epp.internal.mpc.core.model.Node) INode(org.eclipse.epp.mpc.core.model.INode) ICategory(org.eclipse.epp.mpc.core.model.ICategory) IMarketplaceService(org.eclipse.epp.mpc.core.service.IMarketplaceService) IMarket(org.eclipse.epp.mpc.core.model.IMarket) URL(java.net.URL) Test(org.junit.Test)

Example 34 with INode

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

the class NodeMatcher method doMatch.

@Override
protected boolean doMatch(Object obj) {
    if (obj instanceof Widget) {
        Widget w = (Widget) obj;
        Object data = w.getData();
        INode node = null;
        if (data instanceof CatalogItem) {
            data = ((CatalogItem) data).getData();
        }
        if (data instanceof INode) {
            node = (INode) data;
        }
        return node != null && matcher.matches(node);
    }
    return false;
}
Also used : CatalogItem(org.eclipse.equinox.internal.p2.discovery.model.CatalogItem) INode(org.eclipse.epp.mpc.core.model.INode) Widget(org.eclipse.swt.widgets.Widget)

Example 35 with INode

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

the class DefaultMarketplaceServiceTest method search.

@Test
@org.junit.experimental.categories.Category(RemoteTests.class)
public void search() throws CoreException {
    ISearchResult result = search("Tools", "Editor", "snipmatch");
    assertNotNull(result);
    assertNotNull(result.getNodes());
    assertEquals(Integer.valueOf(1), result.getMatchCount());
    assertEquals(1, result.getNodes().size());
    INode node = result.getNodes().get(0);
    assertTrue(node.getName().startsWith("Snipmatch"));
    assertEquals("1743547", node.getId());
}
Also used : ISearchResult(org.eclipse.epp.mpc.core.model.ISearchResult) INode(org.eclipse.epp.mpc.core.model.INode) Test(org.junit.Test)

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