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
}
}
});
}
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;
}
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());
}
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;
}
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());
}
Aggregations