Search in sources :

Example 1 with OverrideRules

use of org.candlepin.policy.js.override.OverrideRules 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);
}
Also used : ProductCachedSerializationModule(org.candlepin.jackson.ProductCachedSerializationModule) RulesCurator(org.candlepin.model.RulesCurator) Configuration(org.candlepin.common.config.Configuration) InputStream(java.io.InputStream) JsRunnerProvider(org.candlepin.policy.js.JsRunnerProvider) RulesObjectMapper(org.candlepin.policy.js.RulesObjectMapper) OverrideRules(org.candlepin.policy.js.override.OverrideRules) Rules(org.candlepin.model.Rules) OverrideRules(org.candlepin.policy.js.override.OverrideRules) Date(java.util.Date) Provider(com.google.inject.Provider) JsRunnerProvider(org.candlepin.policy.js.JsRunnerProvider) JsRunnerRequestCache(org.candlepin.policy.js.JsRunnerRequestCache) Before(org.junit.Before)

Aggregations

Provider (com.google.inject.Provider)1 InputStream (java.io.InputStream)1 Date (java.util.Date)1 Configuration (org.candlepin.common.config.Configuration)1 ProductCachedSerializationModule (org.candlepin.jackson.ProductCachedSerializationModule)1 Rules (org.candlepin.model.Rules)1 RulesCurator (org.candlepin.model.RulesCurator)1 JsRunnerProvider (org.candlepin.policy.js.JsRunnerProvider)1 JsRunnerRequestCache (org.candlepin.policy.js.JsRunnerRequestCache)1 RulesObjectMapper (org.candlepin.policy.js.RulesObjectMapper)1 OverrideRules (org.candlepin.policy.js.override.OverrideRules)1 Before (org.junit.Before)1