Search in sources :

Example 16 with EntitlementRefusedException

use of org.candlepin.policy.EntitlementRefusedException in project candlepin by candlepin.

the class EntitlerTest method bindByProductErrorTest.

private void bindByProductErrorTest(String msg) throws Exception {
    try {
        String[] pids = { "prod1", "prod2", "prod3" };
        Map<String, ValidationResult> fakeResult = new HashMap<>();
        fakeResult.put("blah", fakeOutResult(msg));
        EntitlementRefusedException ere = new EntitlementRefusedException(fakeResult);
        AutobindData data = AutobindData.create(consumer, owner).forProducts(pids);
        when(pm.entitleByProducts(data)).thenThrow(ere);
        entitler.bindByProducts(data);
    } catch (EntitlementRefusedException e) {
        fail(msg + ": threw unexpected error");
    }
}
Also used : HashMap(java.util.HashMap) EntitlementRefusedException(org.candlepin.policy.EntitlementRefusedException) AutobindData(org.candlepin.resource.dto.AutobindData) ValidationResult(org.candlepin.policy.ValidationResult)

Aggregations

EntitlementRefusedException (org.candlepin.policy.EntitlementRefusedException)16 Pool (org.candlepin.model.Pool)13 HashMap (java.util.HashMap)10 ValidationResult (org.candlepin.policy.ValidationResult)8 Entitlement (org.candlepin.model.Entitlement)7 PoolQuantity (org.candlepin.model.PoolQuantity)7 ArrayList (java.util.ArrayList)5 ForbiddenException (org.candlepin.common.exceptions.ForbiddenException)4 Transactional (com.google.inject.persist.Transactional)3 Date (java.util.Date)3 HashSet (java.util.HashSet)3 LinkedList (java.util.LinkedList)3 List (java.util.List)3 Set (java.util.Set)3 Consumer (org.candlepin.model.Consumer)3 Owner (org.candlepin.model.Owner)3 PoolFilterBuilder (org.candlepin.model.PoolFilterBuilder)3 Product (org.candlepin.model.Product)3 ValidationError (org.candlepin.policy.ValidationError)3 ComplianceStatus (org.candlepin.policy.js.compliance.ComplianceStatus)3