use of org.candlepin.policy.ValidationResult in project candlepin by candlepin.
the class PreEntitlementRulesTest method fewerThanMaximumNumberOfSocketsShouldNotGenerateWarning.
@Test
public void fewerThanMaximumNumberOfSocketsShouldNotGenerateWarning() {
Pool pool = setupArchTest("sockets", "128", "cpu.cpu_socket(s)", "2");
ValidationResult result = enforcer.preEntitlement(consumer, pool, 1);
assertFalse(result.hasErrors());
assertFalse(result.hasWarnings());
}
use of org.candlepin.policy.ValidationResult in project candlepin by candlepin.
the class PreEntitlementRulesTest method devPoolConsumerDoesNotMatch.
@Test
public void devPoolConsumerDoesNotMatch() {
// Another consumer we'll make a dev pool for:
ConsumerType ctype = this.mockConsumerType(new ConsumerType(ConsumerTypeEnum.SYSTEM));
Consumer otherConsumer = new Consumer("test consumer", "test user", owner, ctype);
Pool pool = setupDevConsumerRestrictedPool(otherConsumer);
ValidationResult result = enforcer.preEntitlement(consumer, pool, 1);
assertFalse(result.hasWarnings());
assertEquals(1, result.getErrors().size());
assertEquals("consumer.does.not.match.pool.consumer.requirement", result.getErrors().get(0).getResourceKey());
}
use of org.candlepin.policy.ValidationResult in project candlepin by candlepin.
the class PreEntitlementRulesTest method matchingNumberOfSocketsShouldNotGenerateWarning.
@Test
public void matchingNumberOfSocketsShouldNotGenerateWarning() {
Pool pool = setupArchTest("sockets", "2", "cpu.cpu_socket(s)", "2");
ValidationResult result = enforcer.preEntitlement(consumer, pool, 1);
assertFalse(result.hasErrors());
assertFalse(result.hasWarnings());
}
use of org.candlepin.policy.ValidationResult in project candlepin by candlepin.
the class PreEntitlementRulesTest method physOnlyVirtualConsumer.
@Test
public void physOnlyVirtualConsumer() {
Pool pool = setupPhysOnlyPool();
consumer.setFact("virt.is_guest", "true");
ValidationResult result = enforcer.preEntitlement(consumer, pool, 1);
assertTrue(result.hasWarnings());
assertEquals(1, result.getWarnings().size());
assertEquals("rulewarning.physical.only", result.getWarnings().get(0).getResourceKey());
}
use of org.candlepin.policy.ValidationResult in project candlepin by candlepin.
the class PreEntitlementRulesTest method architectureALLShouldNotGenerateWarnings.
@Test
public void architectureALLShouldNotGenerateWarnings() {
Pool pool = setupArchTest("arch", "ALL", "arch", "i686");
pool.setId("fakeid" + TestUtil.randomInt());
ValidationResult result = enforcer.preEntitlement(consumer, pool, 1);
assertFalse(result.hasErrors());
assertFalse(result.hasWarnings());
}
Aggregations