Search in sources :

Example 1 with DateSourceImpl

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);
}
Also used : Owner(org.candlepin.model.Owner) PoolRules(org.candlepin.policy.js.pool.PoolRules) InputStream(java.io.InputStream) RulesObjectMapper(org.candlepin.policy.js.RulesObjectMapper) JsRunner(org.candlepin.policy.js.JsRunner) Rules(org.candlepin.model.Rules) PoolRules(org.candlepin.policy.js.pool.PoolRules) StandardTranslator(org.candlepin.dto.StandardTranslator) ProductCachedSerializationModule(org.candlepin.jackson.ProductCachedSerializationModule) Consumer(org.candlepin.model.Consumer) JsRunnerProvider(org.candlepin.policy.js.JsRunnerProvider) ConsumerType(org.candlepin.model.ConsumerType) DateSourceImpl(org.candlepin.util.DateSourceImpl) Before(org.junit.Before)

Aggregations

InputStream (java.io.InputStream)1 StandardTranslator (org.candlepin.dto.StandardTranslator)1 ProductCachedSerializationModule (org.candlepin.jackson.ProductCachedSerializationModule)1 Consumer (org.candlepin.model.Consumer)1 ConsumerType (org.candlepin.model.ConsumerType)1 Owner (org.candlepin.model.Owner)1 Rules (org.candlepin.model.Rules)1 JsRunner (org.candlepin.policy.js.JsRunner)1 JsRunnerProvider (org.candlepin.policy.js.JsRunnerProvider)1 RulesObjectMapper (org.candlepin.policy.js.RulesObjectMapper)1 PoolRules (org.candlepin.policy.js.pool.PoolRules)1 DateSourceImpl (org.candlepin.util.DateSourceImpl)1 Before (org.junit.Before)1