use of org.apache.neethi.PolicyOperator in project cxf by apache.
the class PolicyEngineImpl method addAssertions.
void addAssertions(PolicyComponent pc, boolean includeOptional, Collection<Assertion> assertions) {
if (Constants.TYPE_ASSERTION == pc.getType()) {
Assertion a = (Assertion) pc;
if (includeOptional || !a.isOptional()) {
assertions.add((Assertion) pc);
}
return;
}
if (Constants.TYPE_POLICY_REF == pc.getType()) {
PolicyReference pr = (PolicyReference) pc;
pc = pr.normalize(registry, false);
}
PolicyOperator po = (PolicyOperator) pc;
List<PolicyComponent> pcs = CastUtils.cast(po.getPolicyComponents(), PolicyComponent.class);
for (PolicyComponent child : pcs) {
addAssertions(child, includeOptional, assertions);
}
}
use of org.apache.neethi.PolicyOperator in project cxf by apache.
the class EndpointPolicyImplTest method testUpdatePolicyWithEmptyExactlyOneAndAll.
@Test
public void testUpdatePolicyWithEmptyExactlyOneAndAll() {
Policy emptyPolicy = new Policy();
PolicyOperator exactlyOne = new ExactlyOne();
exactlyOne.addPolicyComponent(new All());
exactlyOne.addPolicyComponent(new All());
emptyPolicy.addPolicyComponent(exactlyOne);
emptyPolicy.addPolicyComponent(new All());
emptyPolicy.addPolicyComponent(new All());
doTestUpdateWithEmptyPolicy(emptyPolicy);
}
Aggregations