use of org.candlepin.policy.ValidationResult in project candlepin by candlepin.
the class ActivationKeyRulesTest method testActivationKeyRulesNoPools.
@Test
public void testActivationKeyRulesNoPools() {
ActivationKey key = new ActivationKey();
Pool pool = genPool();
ValidationResult result = actKeyRules.runPreActKey(key, pool, new Long(1));
assertTrue(result.getErrors().isEmpty());
assertTrue(result.getWarnings().isEmpty());
}
use of org.candlepin.policy.ValidationResult in project candlepin by candlepin.
the class ActivationKeyRulesTest method testDoesAllowSameConsumerTypePools.
@Test
public void testDoesAllowSameConsumerTypePools() {
ActivationKey key = new ActivationKey();
key.addPool(genPoolForType("system"), 1L);
Pool pool = genPoolForType("system");
ValidationResult result = actKeyRules.runPreActKey(key, pool, new Long(1));
assertTrue(result.getWarnings().isEmpty());
assertTrue(result.getErrors().isEmpty());
}
use of org.candlepin.policy.ValidationResult in project candlepin by candlepin.
the class ActivationKeyRulesTest method testNonMultientMultipleQuantity.
@Test
public void testNonMultientMultipleQuantity() {
ActivationKey key = new ActivationKey();
Pool pool = genNonMultiEnt();
ValidationResult result = actKeyRules.runPreActKey(key, pool, new Long(2));
assertTrue(result.getWarnings().isEmpty());
assertEquals(1, result.getErrors().size());
String expected = "rulefailed.invalid.nonmultient.quantity";
assertEquals(expected, result.getErrors().get(0).getResourceKey());
}
use of org.candlepin.policy.ValidationResult in project candlepin by candlepin.
the class ActivationKeyRulesTest method testNonMultientOne.
@Test
public void testNonMultientOne() {
ActivationKey key = new ActivationKey();
Pool pool = genNonMultiEnt();
ValidationResult result = actKeyRules.runPreActKey(key, pool, new Long(1));
assertTrue(result.getWarnings().isEmpty());
assertTrue(result.getErrors().isEmpty());
}
use of org.candlepin.policy.ValidationResult in project candlepin by candlepin.
the class ManifestEntitlementRulesTest method preEntitlementSuccessInstanceCapable.
@Test
public void preEntitlementSuccessInstanceCapable() {
// Test with sockets to make sure that they are skipped.
Consumer c = this.createMockConsumer(true);
Set<ConsumerCapability> caps = new HashSet<>();
ConsumerCapability cc = new ConsumerCapability(c, "instance_multiplier");
caps.add(cc);
c.setCapabilities(caps);
Product prod = TestUtil.createProduct();
prod.setAttribute(Product.Attributes.INSTANCE_MULTIPLIER, "2");
Pool p = TestUtil.createPool(prod);
ValidationResult results = enforcer.preEntitlement(c, p, 1, CallerType.BEST_POOLS);
assertNotNull(results);
assertEquals(0, results.getErrors().size());
assertEquals(0, results.getWarnings().size());
}
Aggregations