aboutsummaryrefslogtreecommitdiffstats
path: root/ECOMP-TEST/src/test/java/org/openecomp/policy/pdp/test/conformance/ResponseMatchResult.java
diff options
context:
space:
mode:
authorITSERVICES\rb7147 <rb7147@att.com>2017-04-25 11:46:00 -0400
committerITSERVICES\rb7147 <rb7147@att.com>2017-05-03 09:58:17 -0400
commite0addf5b588a1244f9679becd90999dfcb4c3a94 (patch)
tree1212772d6366730266ff0e093c874b07aa716c29 /ECOMP-TEST/src/test/java/org/openecomp/policy/pdp/test/conformance/ResponseMatchResult.java
parent39fb0f30472777e4b60d6a7ac8aa4eb9773961ff (diff)
Policy 1707 commit to LF
Change-Id: Ibe6f01d92f9a434c040abb05d5386e89d675ae65 Signed-off-by: ITSERVICES\rb7147 <rb7147@att.com>
Diffstat (limited to 'ECOMP-TEST/src/test/java/org/openecomp/policy/pdp/test/conformance/ResponseMatchResult.java')
-rw-r--r--ECOMP-TEST/src/test/java/org/openecomp/policy/pdp/test/conformance/ResponseMatchResult.java137
1 files changed, 0 insertions, 137 deletions
diff --git a/ECOMP-TEST/src/test/java/org/openecomp/policy/pdp/test/conformance/ResponseMatchResult.java b/ECOMP-TEST/src/test/java/org/openecomp/policy/pdp/test/conformance/ResponseMatchResult.java
deleted file mode 100644
index 31e6da415..000000000
--- a/ECOMP-TEST/src/test/java/org/openecomp/policy/pdp/test/conformance/ResponseMatchResult.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-TEST
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.policy.pdp.test.conformance;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import com.att.research.xacml.api.Response;
-import com.att.research.xacml.api.Result;
-
-/**
- * ResponseMatchResult provides information about how a {@link com.att.research.xacml.api.Response} object matches
- * another <code>Response</code> object.
- *
- * @version $Revision: 1.1 $
- */
-public class ResponseMatchResult {
- private List<ResultMatchResult> resultMatchResults = new ArrayList<ResultMatchResult>();
-
- private boolean bAssociatedAdviceMatches = true;
- private boolean bAttributesMatch = true;
- private boolean bDecisionsMatch = true;
- private boolean bStatusCodesMatch = true;
- private boolean bObligationsMatch = true;
- private boolean bPolicyIdentifiersMatch = true;
- private boolean bPolicySetIdentifiersMatch = true;
- private boolean bNumResultsMatch = true;
- private boolean bUnknownFunction;
-
- protected void addResultMatchResult(ResultMatchResult resultMatchResult) {
- this.resultMatchResults.add(resultMatchResult);
- this.bAssociatedAdviceMatches = resultMatchResult.associatedAdviceMatches() && this.bAssociatedAdviceMatches;
- this.bAttributesMatch = resultMatchResult.attributesMatch() && this.bAttributesMatch;
- this.bDecisionsMatch = resultMatchResult.decisionsMatch() && this.bDecisionsMatch;
- this.bStatusCodesMatch = resultMatchResult.statusCodesMatch() && this.bStatusCodesMatch;
- this.bObligationsMatch = resultMatchResult.obligationsMatch() && this.bObligationsMatch;
- this.bPolicyIdentifiersMatch = resultMatchResult.policyIdentifiersMatch() && this.bPolicyIdentifiersMatch;
- this.bPolicySetIdentifiersMatch = resultMatchResult.policySetIdentifiersMatch() && this.bPolicySetIdentifiersMatch;
- this.bUnknownFunction = resultMatchResult.unknownFunction() || this.bUnknownFunction;
- }
-
- protected void setNumResultsMatch(boolean b) {
- this.bNumResultsMatch = b;
- }
-
- public ResponseMatchResult() {
- }
-
- public static ResponseMatchResult newInstance(Response response1, Response response2) {
- ResponseMatchResult responseMatchResult = new ResponseMatchResult();
-
- Collection<Result> listResultsResponse1 = response1.getResults();
- Collection<Result> listResultsResponse2 = response2.getResults();
- if (listResultsResponse1.size() == 1 && listResultsResponse2.size() == 1) {
- /*
- * Just add a single ResultMatchResult comparing the results in the two responses
- */
- responseMatchResult.addResultMatchResult(ResultMatchResult.newInstance(listResultsResponse1.iterator().next(), listResultsResponse2.iterator().next()));
- } else {
- /*
- * Iterate over all of the results in the two responses and match them
- */
- Iterator<Result> iterResponse1Results = listResultsResponse1.iterator();
- Iterator<Result> iterResponse2Results = listResultsResponse2.iterator();
- while ((iterResponse1Results != null && iterResponse1Results.hasNext()) || (iterResponse2Results != null && iterResponse2Results.hasNext())) {
- Result result1 = (iterResponse1Results != null && iterResponse1Results.hasNext() ? iterResponse1Results.next() : null);
- Result result2 = (iterResponse2Results != null && iterResponse2Results.hasNext() ? iterResponse2Results.next() : null);
- if ((result1 == null || result2 == null) && responseMatchResult.numResultsMatch()) {
- responseMatchResult.setNumResultsMatch(false);
- }
- responseMatchResult.addResultMatchResult(ResultMatchResult.newInstance(result1, result2));
- }
- }
- return responseMatchResult;
- }
-
- public Iterator<ResultMatchResult> getResultMatchResults() {
- return this.resultMatchResults.iterator();
- }
-
- public boolean numResultsMatch() {
- return this.bNumResultsMatch;
- }
-
- public boolean associatedAdviceMatches() {
- return this.bAssociatedAdviceMatches;
- }
-
- public boolean attributesMatch() {
- return this.bAttributesMatch;
- }
-
- public boolean decisionsMatch() {
- return this.bDecisionsMatch;
- }
-
- public boolean obligationsMatch() {
- return this.bObligationsMatch;
- }
-
- public boolean policyIdentifiersMatch() {
- return this.bPolicyIdentifiersMatch;
- }
-
- public boolean policySetIdentifiersMatch() {
- return this.bPolicySetIdentifiersMatch;
- }
-
- public boolean statusCodesMatch() {
- return this.bStatusCodesMatch;
- }
-
- public boolean unknownFunction() {
- return this.bUnknownFunction;
- }
-
-}