aboutsummaryrefslogtreecommitdiffstats
path: root/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ResultMatchResult.java
diff options
context:
space:
mode:
authorGuo Ruijing <ruijing.guo@intel.com>2017-07-31 08:47:35 +0000
committerPamela Dragosh <pdragosh@research.att.com>2017-07-31 15:51:10 -0400
commit073cc188efe9abb4c010cf674e34e2cf46ef1c52 (patch)
tree155c23fbdf3a838ecb5f4183fc3bb6b09aac41eb /ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ResultMatchResult.java
parent4ca818fdfb9b807562166800a086b413593d6894 (diff)
[POLICY-73] replace openecomp for policy-engine
Change-Id: I54072f6bcd388c0e05562614ee89b4ae7ad67004 Signed-off-by: Guo Ruijing <ruijing.guo@intel.com> Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ResultMatchResult.java')
-rw-r--r--ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ResultMatchResult.java136
1 files changed, 0 insertions, 136 deletions
diff --git a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ResultMatchResult.java b/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ResultMatchResult.java
deleted file mode 100644
index f612c1a3c..000000000
--- a/ECOMP-PDP/src/test/java/org/openecomp/policy/pdp/test/conformance/ResultMatchResult.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ECOMP-PDP
- * ================================================================================
- * 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 com.att.research.xacml.api.Result;
-import com.att.research.xacml.std.StdStatusCode;
-import com.att.research.xacml.util.ListUtil;
-
-/**
- * ResultMatchResult provides information about how well a {@link com.att.research.xacml.api.Result} object matches
- * another <code>Result</code> object.
- *
- * @version $Revision: 1.1 $
- */
-public class ResultMatchResult {
- private boolean bAssociatedAdviceMatches = true;
- private boolean bAttributesMatch = true;
- private boolean bDecisionsMatch = true;
- private boolean bObligationsMatch = true;
- private boolean bPolicyIdentifiersMatch = true;
- private boolean bPolicySetIdentifiersMatch = true;
- private boolean bStatusCodesMatch = true;
- private boolean bUnknownFunction = false;
-
- protected void setAssociatedAdviceMatches(boolean b) {
- this.bAssociatedAdviceMatches = b;
- }
- protected void setAttributesMatch(boolean b) {
- this.bAttributesMatch = b;
- }
- protected void setDecisionsMatch(boolean b) {
- this.bDecisionsMatch = b;
- }
- protected void setObligationsMatch(boolean b) {
- this.bObligationsMatch = b;
- }
- protected void setPolicyIdentifiersMatch(boolean b) {
- this.bPolicyIdentifiersMatch = b;
- }
- protected void setPolicySetIdentifiersMatch(boolean b) {
- this.bPolicySetIdentifiersMatch = b;
- }
- protected void setStatusCodesMatch(boolean b) {
- this.bStatusCodesMatch = b;
- }
- protected void setUnknownFunction(boolean b) {
- this.bUnknownFunction = b;
- }
-
- public ResultMatchResult() {
- }
-
- public static ResultMatchResult newInstance(Result result1, Result result2) {
- ResultMatchResult resultMatchResult = new ResultMatchResult();
- if (result2 != null && result2.getStatus() != null &&
- result2.getStatus().getStatusCode().equals(StdStatusCode.STATUS_CODE_PROCESSING_ERROR) &&
- result2.getStatus().getStatusMessage() != null &&
- result2.getStatus().getStatusMessage().contains("Unknown Function")
- ) {
- resultMatchResult.setUnknownFunction(true);
- }
- if (result1 == null || result2 == null) {
- resultMatchResult.setAssociatedAdviceMatches(false);
- resultMatchResult.setAttributesMatch(false);
- resultMatchResult.setDecisionsMatch(false);
- resultMatchResult.setObligationsMatch(false);
- resultMatchResult.setPolicyIdentifiersMatch(false);
- resultMatchResult.setPolicySetIdentifiersMatch(false);
- resultMatchResult.setStatusCodesMatch(false);
- } else {
- resultMatchResult.setAssociatedAdviceMatches(ListUtil.equalsAllowNulls(result1.getAssociatedAdvice(), result2.getAssociatedAdvice()));
- resultMatchResult.setAttributesMatch(ListUtil.equalsAllowNulls(result1.getAttributes(), result2.getAttributes()));
- resultMatchResult.setDecisionsMatch(result1.getDecision() == result2.getDecision());
- resultMatchResult.setObligationsMatch(ListUtil.equalsAllowNulls(result1.getObligations(), result2.getObligations()));
- resultMatchResult.setPolicyIdentifiersMatch(ListUtil.equalsAllowNulls(result1.getPolicyIdentifiers(), result2.getPolicyIdentifiers()));
- resultMatchResult.setPolicySetIdentifiersMatch(ListUtil.equalsAllowNulls(result1.getPolicySetIdentifiers(), result2.getPolicySetIdentifiers()));
- if (result1.getStatus() == null || result1.getStatus().getStatusCode() == null || result2.getStatus() == null || result2.getStatus().getStatusCode() == null) {
- resultMatchResult.setStatusCodesMatch(false);
- } else {
- resultMatchResult.setStatusCodesMatch(result1.getStatus().getStatusCode().equals(result2.getStatus().getStatusCode()));
- }
- }
- return resultMatchResult;
- }
-
- 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;
- }
-
-}