use of org.commonjava.indy.autoprox.rest.dto.RuleDTO in project indy by Commonjava.
the class ReparsePicksUpNewRuleFileTest method writeRuleFileThenReparseCatalogAndVerifyRulePresence.
@Test
public void writeRuleFileThenReparseCatalogAndVerifyRulePresence() throws Exception {
final CatalogDTO catalog = module.getCatalog();
assertThat(catalog.isEnabled(), equalTo(true));
assertThat(catalog.getRules().isEmpty(), equalTo(true));
final RuleDTO rule = getRule("0001-simple-rule.groovy", "rules/simple-rule.groovy");
final File script = new File(fixture.getBootOptions().getIndyHome(), "var/lib/indy/data/autoprox/0001-simple-rule.groovy");
FileUtils.write(script, rule.getSpec());
module.reparseCatalog();
final CatalogDTO resultCatalog = module.getCatalog();
final List<RuleDTO> rules = resultCatalog.getRules();
assertThat(rules.size(), equalTo(1));
final RuleDTO dto = rules.get(0);
assertThat(dto.getName(), equalTo(FilenameUtils.removeExtension(rule.getName())));
assertThat(dto.getSpec(), equalTo(rule.getSpec()));
}
use of org.commonjava.indy.autoprox.rest.dto.RuleDTO in project indy by Commonjava.
the class CreateRuleAndVerifyInListingTest method createRuleAndVerifyListingReflectsIt.
@Test
public void createRuleAndVerifyListingReflectsIt() throws Exception {
final CatalogDTO catalog = module.getCatalog();
assertThat(catalog.isEnabled(), equalTo(true));
assertThat(catalog.getRules().isEmpty(), equalTo(true));
final RuleDTO rule = getRule("0001-simple-rule", "rules/simple-rule.groovy");
final RuleDTO dto = module.storeRule(rule);
assertThat(dto, notNullValue());
final CatalogDTO resultCatalog = module.getCatalog();
final List<RuleDTO> rules = resultCatalog.getRules();
assertThat(rules.size(), equalTo(1));
assertThat(rules.get(0), equalTo(dto));
}
Aggregations