use of org.eclipse.epp.mpc.core.model.ICategory 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.ICategory in project epp.mpc by eclipse.
the class DefaultMarketplaceServiceTest method findCategory.
private ICategory findCategory(IMarket toolsMarket, String categoryName) {
ICategory namedCategory = null;
for (ICategory category : toolsMarket.getCategory()) {
if (categoryName.equals(category.getName())) {
namedCategory = category;
break;
}
}
assertNotNull(namedCategory);
return namedCategory;
}
use of org.eclipse.epp.mpc.core.model.ICategory in project epp.mpc by eclipse.
the class DefaultMarketplaceServiceTest method getCategory.
@Test
@org.junit.experimental.categories.Category(RemoteTests.class)
public void getCategory() throws CoreException {
List<? extends IMarket> markets = marketplaceService.listMarkets(new NullProgressMonitor());
assertNotNull(markets);
assertFalse(markets.isEmpty());
final String marketName = "Tools";
IMarket market = null;
for (IMarket m : markets) {
if (marketName.equals(m.getName())) {
market = m;
break;
}
}
assertNotNull("Expected market " + marketName, market);
assertFalse(market.getCategory().isEmpty());
final String categoryName = "Mylyn Connectors";
ICategory category = null;
for (ICategory c : market.getCategory()) {
if (categoryName.equals(c.getName())) {
category = c;
break;
}
}
assertNotNull("Expected category " + categoryName, category);
ICategory result = marketplaceService.getCategory(category, new NullProgressMonitor());
assertNotNull(result);
// FIXME: pending bug 302671
// assertEquals(category.getId(),result.getId());
// FIXME: pending bug 497242
// assertEquals(category.getName(), result.getName());
// assertEquals(category.getUrl(), result.getUrl());
}
use of org.eclipse.epp.mpc.core.model.ICategory 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());
}
use of org.eclipse.epp.mpc.core.model.ICategory 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());
}
Aggregations