use of org.candlepin.util.DateSourceImpl in project candlepin by candlepin.
the class EntitlementRulesTestFixture method createEnforcer.
@Before
public void createEnforcer() throws Exception {
MockitoAnnotations.initMocks(this);
when(config.getInt(eq(ConfigProperties.PRODUCT_CACHE_MAX))).thenReturn(100);
InputStream is = this.getClass().getResourceAsStream(RulesCurator.DEFAULT_RULES_FILE);
Rules rules = new Rules(Util.readFile(is));
when(rulesCurator.getRules()).thenReturn(rules);
when(rulesCurator.getUpdated()).thenReturn(TestDateUtil.date(2010, 1, 1));
when(cacheProvider.get()).thenReturn(cache);
JsRunner jsRules = new JsRunnerProvider(rulesCurator, cacheProvider).get();
translator = new StandardTranslator(consumerTypeCurator, environmentCurator, ownerCurator);
enforcer = new EntitlementRules(new DateSourceImpl(), jsRules, I18nFactory.getI18n(getClass(), Locale.US, I18nFactory.FALLBACK), config, consumerCurator, consumerTypeCurator, productCurator, new RulesObjectMapper(new ProductCachedSerializationModule(productCurator)), ownerCurator, ownerProductCuratorMock, productShareCurator, productManager, eventSink, eventFactory, translator);
owner = new Owner();
consumerType = this.mockConsumerType(new ConsumerType(ConsumerTypeEnum.SYSTEM));
consumer = new Consumer("test consumer", "test user", owner, consumerType);
poolRules = new PoolRules(poolManagerMock, config, entCurMock, ownerProductCuratorMock, productCurator);
}
Aggregations