use of org.eclipse.epp.mpc.core.model.INode in project epp.mpc by eclipse.
the class DefaultMarketplaceServiceTest method assertSearchResultSanity.
protected void assertSearchResultSanity(ISearchResult result) {
assertNotNull(result);
assertNotNull(result.getNodes());
assertNotNull(result.getMatchCount());
int promotedCount = 0;
for (INode node : result.getNodes()) {
if (node.getShortdescription() != null && node.getShortdescription().startsWith("**Promoted**")) {
promotedCount++;
}
}
assertTrue(result.getMatchCount() >= result.getNodes().size() - promotedCount);
assertTrue(result.getNodes().size() > 0);
Set<String> ids = new HashSet<String>();
for (INode node : result.getNodes()) {
assertNotNull(node.getId());
assertTrue(ids.add(node.getId()));
assertNotNull(node.getName());
}
}
use of org.eclipse.epp.mpc.core.model.INode in project epp.mpc by eclipse.
the class SolutionCompatibilityFilterTest method format.
private static String format(String message, Object... details) {
if (details == null || details.length == 0) {
return message;
}
String contentPrefix = BASE_URL + "/content/";
for (int i = 0; i < details.length; i++) {
Object detail = details[i];
if (detail instanceof INode) {
INode node = (INode) detail;
String url = node.getUrl();
if (url != null) {
if (url.startsWith(contentPrefix)) {
String shortName = url.substring(contentPrefix.length());
detail = shortName;
} else {
detail = url;
}
} else {
detail = node.getId();
}
} else if (detail instanceof Solution) {
Solution solution = (Solution) detail;
detail = solution.shortName();
}
details[i] = detail;
}
return MessageFormat.format(message, details);
}
use of org.eclipse.epp.mpc.core.model.INode in project epp.mpc by eclipse.
the class SolutionCompatibilityFilterTest method queryNode.
protected INode queryNode() throws CoreException {
INode node = marketplaceService.getNode(QueryHelper.nodeByUrl(solution.url()), new NullProgressMonitor());
assertNotNull("Node {0} not found", node);
if (solution.id() != null) {
assertEquals("Node {2} returned with wrong id {1}", solution.id(), node.getId(), solution);
}
if (solution.url() != null) {
assertEquals("Node {2} returned with wrong url {1}", solution.url(), node.getUrl(), solution);
}
return node;
}
use of org.eclipse.epp.mpc.core.model.INode in project epp.mpc by eclipse.
the class SolutionCompatibilityFilterTest method testCompatibleInstallableNode.
public void testCompatibleInstallableNode() throws CoreException {
assumeTrue("Skipping test - this solution and Eclipse/OS are incompatible", compatible);
assumeTrue("Skipping test - this solution is not installable", solution.installable());
INode node = queryNode();
String updateurl = node.getUpdateurl();
assertThat("Node {1} has no update url", updateurl, not(isEmptyOrNullString()), node);
IIus ius = node.getIus();
assertNotNull("Node {1} is missing <ius> element", ius, node);
List<IIu> iuElements = ius.getIuElements();
assertNotNull(iuElements);
assertThat("Node {1} has no IUs", iuElements, not(empty()), node);
if (version != null) {
assertEquals("Node {2} has wrong version", version, node.getVersion(), node);
}
if (site != null) {
assertEquals("Node {2} has wrong update site", site, node.getUpdateurl(), node);
}
if (features != null) {
Set<String> allIUs = new HashSet<String>();
for (IIu iu : iuElements) {
allIUs.add(iu.getId());
}
assertThat("Node {1} is missing some features", allIUs, hasItems(features), node);
assertThat("Node {1} has some unexpected features", allIUs, hasSize(features.length), node);
}
}
use of org.eclipse.epp.mpc.core.model.INode in project epp.mpc by eclipse.
the class SolutionCompatibilityFilterTest method testCompatibleSearchResult.
public void testCompatibleSearchResult() throws CoreException {
assumeTrue("Skipping test - this solution and Eclipse/OS are incompatible", compatible);
INode foundNode = searchForNode();
assertNotNull("Compatible node {1} not found in search", foundNode, solution);
}
Aggregations