use of org.commonjava.indy.model.spi.IndyAddOnID in project indy by Commonjava.
the class IndyAddOnIDTest method roundTripSerialize.
@Test
public void roundTripSerialize() throws Exception {
final UIRoute route = new UIRoute("/foo", "/partials/foo.html");
final UISection section = new UISection("Foo (Add-On)", route.getRoute());
final IndyAddOnID id = new IndyAddOnID().withName("foo").withInitJavascriptHref("js/foo.js").withRoute(route).withSection(section);
final String json = mapper.writeValueAsString(id);
logger.info(json);
final IndyAddOnID result = mapper.readValue(json, IndyAddOnID.class);
assertThat(result.getName(), equalTo(id.getName()));
assertThat(result.getInitJavascriptHref(), equalTo(id.getInitJavascriptHref()));
final List<UIRoute> rRoutes = result.getRoutes();
assertThat(rRoutes, notNullValue());
assertThat(rRoutes.size(), equalTo(1));
final UIRoute rRoute = rRoutes.get(0);
assertThat(rRoute.getTemplateHref(), equalTo(route.getTemplateHref()));
assertThat(rRoute.getRoute(), equalTo(route.getRoute()));
final List<UISection> rSections = result.getSections();
assertThat(rSections, notNullValue());
assertThat(rSections.size(), equalTo(1));
final UISection rSection = rSections.get(0);
assertThat(rSection.getName(), equalTo(section.getName()));
assertThat(rSection.getRoute(), equalTo(section.getRoute()));
}
use of org.commonjava.indy.model.spi.IndyAddOnID in project indy by Commonjava.
the class StatsController method getActiveAddOns.
public AddOnListing getActiveAddOns() {
final List<IndyAddOnID> ids = new ArrayList<IndyAddOnID>();
if (addons != null) {
logger.info("Getting list of installed add-ons...");
for (final IndyAddOn addon : addons) {
final IndyAddOnID id = addon.getId();
logger.info("Adding {}", id);
ids.add(id);
}
}
return new AddOnListing(ids);
}
Aggregations