use of org.candlepin.model.Rules in project candlepin by candlepin.
the class RulesImporterTest method importSkipsOlderRulesDifferentApi.
@Test
public void importSkipsOlderRulesDifferentApi() throws IOException {
Rules currentRules = new Rules("// Version: 2.1");
when(curator.getRules()).thenReturn(currentRules);
importer.importObject(new StringReader("//Version: 1.0\n//rules"));
verify(curator, never()).update(any(Rules.class));
}
use of org.candlepin.model.Rules in project candlepin by candlepin.
the class ContentOverrideValidatorTest method setupTest.
@Before
public void setupTest() {
InputStream is = this.getClass().getResourceAsStream(RulesCurator.DEFAULT_RULES_FILE);
rulesCuratorMock = mock(RulesCurator.class);
config = mock(Configuration.class);
cacheProvider = mock(Provider.class);
cache = mock(JsRunnerRequestCache.class);
Rules rules = new Rules(Util.readFile(is));
when(rulesCuratorMock.getUpdated()).thenReturn(new Date());
when(rulesCuratorMock.getRules()).thenReturn(rules);
when(cacheProvider.get()).thenReturn(cache);
provider = new JsRunnerProvider(rulesCuratorMock, cacheProvider);
overrideRules = new OverrideRules(provider.get(), config, new RulesObjectMapper(new ProductCachedSerializationModule(mockProductCurator)));
validator = new ContentOverrideValidator(i18n, overrideRules);
}
use of org.candlepin.model.Rules in project candlepin by candlepin.
the class EventSinkImplTest method rulesUpdatedShouldEmitSuccessfully.
@Test
public void rulesUpdatedShouldEmitSuccessfully() throws Exception {
Rules oldRules = new Rules(TestUtil.createRulesBlob(1));
Rules newRules = new Rules(TestUtil.createRulesBlob(2));
eventSinkImpl.emitRulesModified(oldRules, newRules);
eventSinkImpl.sendEvents();
verify(mockClientProducer).send(any(ClientMessage.class));
}
use of org.candlepin.model.Rules in project candlepin by candlepin.
the class EventSinkImplTest method rulesDeletedShouldEmitSuccessfully.
@Test
public void rulesDeletedShouldEmitSuccessfully() throws Exception {
Rules oldRules = new Rules(TestUtil.createRulesBlob(1));
eventSinkImpl.emitRulesDeleted(oldRules);
eventSinkImpl.sendEvents();
verify(mockClientProducer).send(any(ClientMessage.class));
}
use of org.candlepin.model.Rules in project candlepin by candlepin.
the class VersionUtilTest method writeoutVersion.
public static void writeoutVersion(String version, String release) throws Exception {
PrintStream ps = new PrintStream(new File(new Rules().getClass().getClassLoader().getResource("version.properties").toURI()));
ps.println("version=" + version);
ps.println("release=" + release);
ps.close();
}
Aggregations