use of org.candlepin.policy.ValidationWarning in project candlepin by candlepin.
the class ManifestEntitlementRulesTest method preEntitlementNoInstanceCapableListWarn.
@Test
public void preEntitlementNoInstanceCapableListWarn() {
// Test with sockets to make sure that they are skipped.
Consumer c = this.createMockConsumer(true);
Set<ConsumerCapability> caps = new HashSet<>();
c.setCapabilities(caps);
Product prod = TestUtil.createProduct();
prod.setAttribute(Product.Attributes.INSTANCE_MULTIPLIER, "2");
Pool p = TestUtil.createPool(prod);
p.setId("poolId");
ValidationResult results = enforcer.preEntitlement(c, p, 1, CallerType.LIST_POOLS);
assertNotNull(results);
assertEquals(0, results.getErrors().size());
ValidationWarning warning = results.getWarnings().get(0);
assertEquals("rulewarning.instance.unsupported.by.consumer", warning.getResourceKey());
}
use of org.candlepin.policy.ValidationWarning in project candlepin by candlepin.
the class ManifestEntitlementRulesTest method preEntitlementNoDerivedProductCapabilityProducesWarningOnList.
@Test
public void preEntitlementNoDerivedProductCapabilityProducesWarningOnList() {
Consumer c = this.createMockConsumer(true);
c.setCapabilities(new HashSet<>());
Product prod = TestUtil.createProduct();
Product derived = TestUtil.createProduct("sub-prod-id");
Pool p = TestUtil.createPool(prod);
p.setDerivedProduct(derived);
p.setId("poolId");
ValidationResult results = enforcer.preEntitlement(c, p, 1, CallerType.LIST_POOLS);
assertNotNull(results);
assertEquals(1, results.getWarnings().size());
assertTrue(results.getErrors().isEmpty());
ValidationWarning warning = results.getWarnings().get(0);
assertEquals("rulewarning.derivedproduct.unsupported.by.consumer", warning.getResourceKey());
}
use of org.candlepin.policy.ValidationWarning in project candlepin by candlepin.
the class ManifestEntitlementRulesTest method preEntitlementNoRamCapableListWarn.
@Test
public void preEntitlementNoRamCapableListWarn() {
// Test with sockets to make sure that they are skipped.
Consumer c = this.createMockConsumer(true);
c.setFact("memory.memtotal", "2000000");
Set<ConsumerCapability> caps = new HashSet<>();
c.setCapabilities(caps);
Product prod = TestUtil.createProduct();
prod.setAttribute(Product.Attributes.RAM, "2");
Pool p = TestUtil.createPool(prod);
p.setId("poolId");
ValidationResult results = enforcer.preEntitlement(c, p, 1, CallerType.LIST_POOLS);
assertNotNull(results);
assertEquals(0, results.getErrors().size());
ValidationWarning warning = results.getWarnings().get(0);
assertEquals("rulewarning.ram.unsupported.by.consumer", warning.getResourceKey());
}
use of org.candlepin.policy.ValidationWarning in project candlepin by candlepin.
the class ManifestEntitlementRulesTest method preEntitlementNoCoreCapableListWarn.
@Test
public void preEntitlementNoCoreCapableListWarn() {
// Test with sockets to make sure that they are skipped.
Consumer c = this.createMockConsumer(true);
c.setFact("cpu.core(s)_per_socket", "2");
Set<ConsumerCapability> caps = new HashSet<>();
c.setCapabilities(caps);
Product prod = TestUtil.createProduct();
prod.setAttribute(Product.Attributes.CORES, "2");
Pool p = TestUtil.createPool(prod);
p.setId("poolId");
ValidationResult results = enforcer.preEntitlement(c, p, 1, CallerType.LIST_POOLS);
assertNotNull(results);
assertEquals(0, results.getErrors().size());
ValidationWarning warning = results.getWarnings().get(0);
assertEquals("rulewarning.cores.unsupported.by.consumer", warning.getResourceKey());
}
Aggregations