Exemple #1
0
  @Before
  public void setUp() {
    MockitoAnnotations.initMocks(this);

    // Load the default production rules:
    InputStream is = this.getClass().getResourceAsStream(RulesCurator.DEFAULT_RULES_FILE);
    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);
    quantityRules = new QuantityRules(provider.get());

    owner = new Owner("Test Owner " + TestUtil.randomInt());
    product = TestUtil.createProduct();
    pool = TestUtil.createPool(owner, product);
    pool.setId("fakepoolid");

    consumer = TestUtil.createConsumer(owner);
    Entitlement e = TestUtil.createEntitlement(owner, consumer, pool, new EntitlementCertificate());

    Set<Entitlement> entSet = new HashSet<Entitlement>();
    entSet.add(e);

    pool.setEntitlements(entSet);
    pool.getProduct().setAttribute("multi-entitlement", "yes");
    pool.getProduct().setAttribute("stacking_id", "1");
  }
 @Before
 public void setUp() {
   MockitoAnnotations.initMocks(this);
   // Load the default production rules:
   InputStream is = this.getClass().getResourceAsStream(RulesCurator.DEFAULT_RULES_FILE);
   Rules rules = new Rules(Util.readFile(is));
   when(rulesCuratorMock.getUpdated()).thenReturn(new Date());
   when(rulesCuratorMock.getRules()).thenReturn(rules);
   provider = new JsRunnerProvider(rulesCuratorMock);
   poolTypeRules = new PoolComplianceTypeRules(provider.get());
 }
 @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);
   validator = new ContentOverrideValidator(i18n, overrideRules);
 }