Ejemplo n.º 1
0
  private Pool createPoolWithEntitlements() {
    Pool newPool = TestUtil.createPool(o, product);
    Entitlement e1 =
        new Entitlement(
            newPool, TestUtil.createConsumer(o), newPool.getStartDate(), newPool.getEndDate(), 1);
    e1.setId("1");

    Entitlement e2 =
        new Entitlement(
            newPool, TestUtil.createConsumer(o), newPool.getStartDate(), newPool.getEndDate(), 1);
    e2.setId("2");

    newPool.getEntitlements().add(e1);
    newPool.getEntitlements().add(e2);
    return newPool;
  }
Ejemplo n.º 2
0
  private Entitlement mockStackedEntitlement(
      Consumer consumer, String stackId, String productId, String... providedProductIds) {

    Entitlement e = mockEntitlement(consumer, productId, providedProductIds);

    Random gen = new Random();
    int id = gen.nextInt(Integer.MAX_VALUE);
    e.setId(String.valueOf(id));

    Pool p = e.getPool();

    // Setup the attributes for stacking:
    p.addProductAttribute(new ProductPoolAttribute("stacking_id", stackId, productId));
    p.addProductAttribute(new ProductPoolAttribute("sockets", "2", productId));

    return e;
  }