2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.policy.pdp.test.conformance;
23 import com.att.research.xacml.api.Request;
24 import com.att.research.xacml.api.Response;
27 * ConformanceTestResult holds all of the objects for a single conformance test run.
29 * @version $Revision: 1.1 $
31 public class ConformanceTestResult {
32 private ConformanceTest conformanceTest;
33 private Request request;
34 private Response expectedResponse;
35 private Response actualResponse;
36 private ResponseMatchResult responseMatchResult;
37 private Exception error;
39 // performance timings
40 private long firstCallTime;
41 private long averageTotalLoopTime;
43 // how many non-first-call times the decide() was called
44 private int iterations;
46 public ConformanceTestResult(ConformanceTest conformanceTestIn, int iterations) {
47 this.conformanceTest = conformanceTestIn;
48 this.iterations = iterations;
51 public ConformanceTestResult(ConformanceTest conformanceTestIn, Exception errorIn) {
52 this.conformanceTest = conformanceTestIn;
56 public int getIterations() {
57 return this.iterations;
60 public ConformanceTest getConformanceTest() {
61 return this.conformanceTest;
63 public void setConformanceTest(ConformanceTest conformanceTestIn) {
64 this.conformanceTest = conformanceTestIn;
67 public Request getRequest() {
70 public void setRequest(Request requestIn) {
71 this.request = requestIn;
74 public Response getExpectedResponse() {
75 return this.expectedResponse;
77 public void setExpectedResponse(Response response) {
78 this.expectedResponse = response;
79 this.responseMatchResult = null;
82 public Response getActualResponse() {
83 return this.actualResponse;
85 public void setActualResponse(Response response) {
86 this.actualResponse = response;
87 this.responseMatchResult = null;
90 public ResponseMatchResult getResponseMatchResult() {
91 if (this.responseMatchResult == null && (this.actualResponse != null && this.expectedResponse != null)) {
92 this.computeResponseMatchResult();
94 return this.responseMatchResult;
96 public void computeResponseMatchResult() {
97 if (this.expectedResponse != null && this.actualResponse != null) {
98 this.responseMatchResult = ResponseMatchResult.newInstance(this.expectedResponse, this.actualResponse);
101 public Exception getError() {
104 public void setError(Exception ex) {
108 public long getFirstCallTime() {
109 return firstCallTime;
111 public void setFirstCallTime(long t) {
114 public long getAverageTotalLoopTime(){
115 return averageTotalLoopTime;
117 public void setAverageTotalLoopTime(long t) {
118 averageTotalLoopTime = t;