From f83e5aa85897c109caee089ad5cf06237b860f01 Mon Sep 17 00:00:00 2001 From: slaws Date: Tue, 14 Sep 2010 15:57:34 +0000 Subject: TUSCANY-3631 - re-enable the test basic auth test case. The issue was that the appliesTo processing wasn't removing policy sets from Endpoints/EndpointReferences it was just removing them from the Service/Reference models. The Endpoint/EndpointReference versions are used to drive the runtime processing. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@996966 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/builder/impl/PolicyAppliesToBuilderImpl.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'sca-java-2.x/trunk/modules/builder/src') diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/PolicyAppliesToBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/PolicyAppliesToBuilderImpl.java index 132cfa5656..1c958f70d4 100644 --- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/PolicyAppliesToBuilderImpl.java +++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/PolicyAppliesToBuilderImpl.java @@ -96,18 +96,22 @@ public class PolicyAppliesToBuilderImpl extends PolicyAttachmentBuilderImpl { for (ComponentService componentService : component.getServices()) { for (Endpoint ep : componentService.getEndpoints()) { - checkAppliesToSubject(document, appliesToSubjects, topComposite, (PolicySubject)ep.getService(), ep.getService().getPolicySets()); + List policySetsToRemove = checkAppliesToSubject(document, appliesToSubjects, topComposite, (PolicySubject)ep.getService(), ep.getService().getPolicySets()); + ep.getPolicySets().removeAll(policySetsToRemove); if (ep.getBinding() instanceof PolicySubject) { - checkAppliesToSubject(document, appliesToSubjects, topComposite, (PolicySubject)ep.getBinding(), ((PolicySubject)ep.getBinding()).getPolicySets()); + policySetsToRemove = checkAppliesToSubject(document, appliesToSubjects, topComposite, (PolicySubject)ep.getBinding(), ((PolicySubject)ep.getBinding()).getPolicySets()); + ep.getPolicySets().removeAll(policySetsToRemove); } } } for (ComponentReference componentReference : component.getReferences()) { for (EndpointReference epr : componentReference.getEndpointReferences()) { - checkAppliesToSubject(document, appliesToSubjects, topComposite, (PolicySubject)epr.getReference(), epr.getReference().getPolicySets()); + List policySetsToRemove = checkAppliesToSubject(document, appliesToSubjects, topComposite, (PolicySubject)epr.getReference(), epr.getReference().getPolicySets()); + epr.getPolicySets().removeAll(policySetsToRemove); if (epr.getBinding() instanceof PolicySubject) { - checkAppliesToSubject(document, appliesToSubjects, topComposite, (PolicySubject)epr.getBinding(), ((PolicySubject)epr.getBinding()).getPolicySets()); + policySetsToRemove = checkAppliesToSubject(document, appliesToSubjects, topComposite, (PolicySubject)epr.getBinding(), ((PolicySubject)epr.getBinding()).getPolicySets()); + epr.getPolicySets().removeAll(policySetsToRemove); } } } @@ -133,7 +137,7 @@ public class PolicyAppliesToBuilderImpl extends PolicyAttachmentBuilderImpl { * @return * @throws Exception */ - private void checkAppliesToSubject(Document document, Map> appliesToSubjects, Composite composite, PolicySubject policySubject, List policySets) throws Exception { + private List checkAppliesToSubject(Document document, Map> appliesToSubjects, Composite composite, PolicySubject policySubject, List policySets) throws Exception { List policySetsToRemove = new ArrayList(); for (PolicySet policySet : policySets){ @@ -170,6 +174,7 @@ public class PolicyAppliesToBuilderImpl extends PolicyAttachmentBuilderImpl { } - policySets.removeAll(policySetsToRemove); + policySets.removeAll(policySetsToRemove); + return policySetsToRemove; } } -- cgit v1.2.3