use of org.candlepin.policy.ValidationResult in project candlepin by candlepin.
the class PreEntitlementRulesTest method virtOnlyPoolGuestNoHostIsPhysical.
@Test
public void virtOnlyPoolGuestNoHostIsPhysical() {
Pool pool = setupVirtOnlyPool();
ValidationResult result = enforcer.preEntitlement(consumer, pool, 1);
assertTrue(result.hasWarnings());
assertEquals(1, result.getWarnings().size());
assertEquals("rulewarning.virt.only", result.getWarnings().get(0).getResourceKey());
}
use of org.candlepin.policy.ValidationResult in project candlepin by candlepin.
the class PreEntitlementRulesTest method testListForSufficientSockets.
@Test
public void testListForSufficientSockets() {
Product product = TestUtil.createProduct(productId, "A product for testing");
product.setAttribute(Product.Attributes.SOCKETS, "2");
Pool pool = createPool(owner, product);
consumer.setFacts(new HashMap<>());
consumer.setFact("cpu.cpu_socket(s)", "1");
ValidationResult result = enforcer.preEntitlement(consumer, pool, 1);
assertFalse(result.hasErrors());
assertFalse(result.hasWarnings());
assertTrue(result.isSuccessful());
}
use of org.candlepin.policy.ValidationResult in project candlepin by candlepin.
the class PreEntitlementRulesTest method architectureMismatchShouldGenerateWarning.
@Test
public void architectureMismatchShouldGenerateWarning() {
Pool pool = setupArchTest("arch", "x86_64", "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 unmappedGuestGoodDate.
@Test
public void unmappedGuestGoodDate() {
ConsumerType ctype = this.mockConsumerType(new ConsumerType(ConsumerTypeEnum.SYSTEM));
Pool pool = setupUnmappedGuestPool();
Consumer newborn = new Consumer("test newborn consumer", "test user", owner, ctype);
newborn.setFact("virt.is_guest", "true");
newborn.setCreated(new Date());
ValidationResult result = enforcer.preEntitlement(newborn, pool, 1);
assertFalse(result.hasErrors());
assertFalse(result.hasWarnings());
}
use of org.candlepin.policy.ValidationResult in project candlepin by candlepin.
the class PreEntitlementRulesTest method x86ArchitectureProvidesI586.
@Test
public void x86ArchitectureProvidesI586() {
Pool pool = setupArchTest("arch", "x86", "uname.machine", "i586");
ValidationResult result = enforcer.preEntitlement(consumer, pool, 1);
assertFalse(result.hasErrors());
assertFalse(result.hasWarnings());
}
Aggregations