View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   * http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.chemistry.opencmis.tck.impl;
20  
21  import java.util.ArrayList;
22  import java.util.List;
23  
24  import org.apache.chemistry.opencmis.tck.CmisTestResult;
25  import org.apache.chemistry.opencmis.tck.CmisTestResultStatus;
26  
27  /**
28   * CmisTestResult implementation.
29   */
30  public class CmisTestResultImpl implements CmisTestResult {
31      private final String groupName;
32      private final String testName;
33      private final String message;
34      private final CmisTestResultStatus status;
35      private final Throwable exception;
36      private StackTraceElement[] stackTrace;
37      private String url;
38      private String request;
39      private String response;
40      private final List<CmisTestResult> children = new ArrayList<CmisTestResult>();
41      private final boolean isFatal;
42  
43      public CmisTestResultImpl(String groupName, String testName, String message, CmisTestResultStatus status,
44              Throwable exception, boolean isFatal) {
45          this.groupName = groupName;
46          this.testName = testName;
47          this.message = message;
48          this.status = status;
49          this.exception = exception;
50          this.isFatal = isFatal;
51      }
52  
53      @Override
54      public String getGroupName() {
55          return groupName;
56      }
57  
58      @Override
59      public String getTestName() {
60          return testName;
61      }
62  
63      @Override
64      public String getMessage() {
65          return message;
66      }
67  
68      @Override
69      public CmisTestResultStatus getStatus() {
70          return status;
71      }
72  
73      @Override
74      public Throwable getException() {
75          return exception;
76      }
77  
78      @Override
79      public StackTraceElement[] getStackTrace() {
80          return stackTrace;
81      }
82  
83      @SuppressWarnings("PMD.ArrayIsStoredDirectly")
84      public void setStackTrace(StackTraceElement[] stackTrace) {
85          this.stackTrace = stackTrace;
86      }
87  
88      @Override
89      public String getRequest() {
90          return request;
91      }
92  
93      public void setRequest(String request) {
94          this.request = request;
95      }
96  
97      @Override
98      public String getResponse() {
99          return response;
100     }
101 
102     public void setResponse(String response) {
103         this.response = response;
104     }
105 
106     @Override
107     public String getUrl() {
108         return url;
109     }
110 
111     public void setUrl(String url) {
112         this.url = url;
113     }
114 
115     @Override
116     public List<CmisTestResult> getChildren() {
117         return children;
118     }
119 
120     @Override
121     public boolean isFatal() {
122         return isFatal;
123     }
124 
125     @Override
126     public String toString() {
127         return status + ": " + groupName + "/" + testName + ": " + message;
128     }
129 }