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.onap.policy.pdp.test.conformance;
26 * ConformanceTest represents a collection of XACML files with a root Policy document, optional referenced Policy documents, a Request, and a Response.
28 * @version $Revision: 1.2 $
30 public class ConformanceTest {
31 private String testName;
33 private File response;
34 private ConformanceRepository repository;
36 public ConformanceTest(String name, ConformanceRepository conformanceRepository, File fileRequest, File fileResponse) {
38 this.request = fileRequest;
39 this.response = fileResponse;
40 this.repository = conformanceRepository;
43 public ConformanceTest(String name) {
47 public String getTestName() {
50 public void setTestName(String s) {
53 public ConformanceRepository getRepository() {
54 if (this.repository == null) {
55 this.repository = new ConformanceRepository();
57 return this.repository;
59 public File getRequest() {
62 public void setRequest(File f) {
65 public File getResponse() {
68 public void setResponse(File f) {
72 public boolean isComplete() {
73 return this.getTestName() != null && this.getRepository() != null && this.getRepository().hasRootPolicy() && this.getRequest() != null && this.getResponse() != null;
77 public String toString() {
78 StringBuilder stringBuilder = new StringBuilder();
79 boolean needColon = false;
80 if (this.getTestName() != null) {
81 stringBuilder.append(this.getTestName());
84 if (this.getRepository() != null) {
87 if (this.getRequest() != null) {
89 stringBuilder.append(':');
91 stringBuilder.append(this.getRequest().getName());
94 if (this.getResponse() != null) {
96 stringBuilder.append(':');
98 stringBuilder.append(this.getResponse().getName());
101 return stringBuilder.toString();