use of org.candlepin.policy.ValidationResult in project candlepin by candlepin.
the class PreEntitlementRulesTest method testEmptyUname.
@Test
public void testEmptyUname() {
Pool pool = setupArchTest("arch", "s390x,x86", "uname.machine", "");
ValidationResult result = enforcer.preEntitlement(consumer, pool, 1);
assertFalse(result.hasErrors());
assertTrue(result.hasWarnings());
}
use of org.candlepin.policy.ValidationResult in project candlepin by candlepin.
the class PreEntitlementRulesTest method testBindFromSameProductAllowedWithMultiEntitlementAttribute.
@Test
public void testBindFromSameProductAllowedWithMultiEntitlementAttribute() {
Product product = TestUtil.createProduct(productId, "A product for testing");
product.setAttribute(Pool.Attributes.MULTI_ENTITLEMENT, "yes");
Pool pool = createPool(owner, product);
Entitlement e = new Entitlement(pool, consumer, owner, 1);
consumer.addEntitlement(e);
ValidationResult result = enforcer.preEntitlement(consumer, pool, 1);
assertTrue(result.isSuccessful());
assertFalse(result.hasErrors());
assertFalse(result.hasErrors());
}
use of org.candlepin.policy.ValidationResult in project candlepin by candlepin.
the class PreEntitlementRulesTest method testListForInsufficientRAM.
@Test
public void testListForInsufficientRAM() {
Product product = TestUtil.createProduct(productId, "A product for testing");
product.setAttribute(Product.Attributes.RAM, "10");
Pool pool = createPool(owner, product);
consumer.setFacts(new HashMap<>());
consumer.setFact("memory.memtotal", "16777216");
ValidationResult result = enforcer.preEntitlement(consumer, pool, 1);
assertFalse(result.hasErrors());
assertTrue(result.hasWarnings());
assertTrue(result.isSuccessful());
assertEquals("rulewarning.unsupported.ram", result.getWarnings().get(0).getResourceKey());
}
use of org.candlepin.policy.ValidationResult in project candlepin by candlepin.
the class PreEntitlementRulesTest method multipleArchesNoMatches.
@Test
public void multipleArchesNoMatches() {
Pool pool = setupArchTest("arch", "s390x,z80,ppc64", "uname.machine", "i686");
ValidationResult result = enforcer.preEntitlement(consumer, pool, 1);
assertFalse(result.hasErrors());
assertTrue(result.hasWarnings());
}
use of org.candlepin.policy.ValidationResult in project candlepin by candlepin.
the class PreEntitlementRulesTest method goodArchNoUnameMachine.
@Test
public void goodArchNoUnameMachine() {
Pool pool = setupArchTest("arch", "x86", "something.not.uname", "i686");
ValidationResult result = enforcer.preEntitlement(consumer, pool, 1);
assertFalse(result.hasErrors());
assertTrue(result.hasWarnings());
}
Aggregations