use of org.candlepin.bind.ComplianceOp in project candlepin by candlepin.
the class PoolManagerTest method setupBindChain.
private void setupBindChain() {
final HandleEntitlementsOp entitlementsOp = new HandleEntitlementsOp(mockPoolCurator, entitlementCurator);
final PostBindBonusPoolsOp postBindBonusPoolsOp = new PostBindBonusPoolsOp(manager);
final HandleCertificatesOp certificatesOp = new HandleCertificatesOp(mockECGenerator, certCuratorMock, entitlementCurator);
final ComplianceOp complianceOp = new ComplianceOp(complianceRules);
when(mockPreEntitlementRulesCheckFactory.create(any(CallerType.class))).thenAnswer(new Answer<PreEntitlementRulesCheckOp>() {
@Override
public PreEntitlementRulesCheckOp answer(InvocationOnMock invocation) throws Throwable {
Object[] args = invocation.getArguments();
CallerType type = (CallerType) args[0];
return new PreEntitlementRulesCheckOp(enforcerMock, type);
}
});
when(mockBindContextFactory.create(any(Consumer.class), anyMapOf(String.class, Integer.class))).thenAnswer(new Answer<BindContext>() {
@Override
public BindContext answer(InvocationOnMock invocation) throws Throwable {
Object[] args = invocation.getArguments();
Consumer consumer = (Consumer) args[0];
Map<String, Integer> pQ = (Map<String, Integer>) args[1];
return new BindContext(mockPoolCurator, consumerCuratorMock, consumerTypeCuratorMock, mockOwnerCurator, i18n, consumer, pQ);
}
});
when(mockBindChainFactory.create(any(Consumer.class), anyMapOf(String.class, Integer.class), any(CallerType.class))).thenAnswer(new Answer<BindChain>() {
@Override
public BindChain answer(InvocationOnMock invocation) throws Throwable {
Object[] args = invocation.getArguments();
Consumer consumer = (Consumer) args[0];
Map<String, Integer> pQ = (Map<String, Integer>) args[1];
CallerType type = (CallerType) args[2];
return new BindChain(mockBindContextFactory, mockPreEntitlementRulesCheckFactory, entitlementsOp, postBindBonusPoolsOp, certificatesOp, complianceOp, consumer, pQ, type);
}
});
}
Aggregations