예제 #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());
 }
예제 #3
0
  @Before
  public void setUp() {
    MockitoAnnotations.initMocks(this);

    // Load the default production rules:
    InputStream is = this.getClass().getResourceAsStream(RULES_FILE);
    Rules rules = new Rules(Util.readFile(is));
    when(rulesCuratorMock.getUpdated()).thenReturn(new Date());
    when(rulesCuratorMock.getRules()).thenReturn(rules);
    provider = new JsRulesProvider(rulesCuratorMock);
    compliance = new ComplianceRules(provider.get(), entCurator);
    owner = new Owner("test");
  }
예제 #4
0
 private Rules rulesFromFile(String path) {
   InputStream is = this.getClass().getResourceAsStream(path);
   Rules result = new Rules(Util.readFile(is));
   result.setRulesSource(Rules.RulesSourceEnum.DEFAULT);
   return result;
 }