use of org.candlepin.resteasy.parameter.KeyValueParameter in project candlepin by candlepin.
the class OwnerResourceTest method testCanFilterPoolsByAttribute.
@Test
public void testCanFilterPoolsByAttribute() throws Exception {
Principal principal = setupPrincipal(owner, Access.ALL);
Product p = this.createProduct(owner);
Pool pool1 = TestUtil.createPool(owner, p);
pool1.setAttribute(Product.Attributes.VIRT_ONLY, "true");
poolCurator.create(pool1);
Product p2 = this.createProduct(owner);
p2.setAttribute(Product.Attributes.CORES, "12");
productCurator.merge(p2);
Pool pool2 = TestUtil.createPool(owner, p2);
poolCurator.create(pool2);
List<KeyValueParameter> params = new ArrayList<>();
params.add(createKeyValueParam("cores", "12"));
List<PoolDTO> pools = ownerResource.listPools(owner.getKey(), null, null, null, null, true, null, null, params, false, false, null, null, principal, null);
assertEquals(1, pools.size());
assertModelEqualsDTO(pool2, pools.get(0));
params.clear();
params.add(createKeyValueParam("virt_only", "true"));
pools = ownerResource.listPools(owner.getKey(), null, null, null, null, true, null, null, params, false, false, null, null, principal, null);
assertEquals(1, pools.size());
assertModelEqualsDTO(pool1, pools.get(0));
}
Aggregations