View Javadoc
1   package org.apache.maven.surefire.api.booter;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *     http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import org.apache.maven.surefire.api.report.ReportEntry;
23  import org.apache.maven.surefire.api.report.StackTraceWriter;
24  import org.apache.maven.surefire.api.report.TestOutputReportEntry;
25  import org.apache.maven.surefire.api.report.TestSetReportEntry;
26  
27  /**
28   * An abstraction for physical encoder of events.
29   *
30   * @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a>
31   * @since 3.0.0-M5
32   */
33  public interface MasterProcessChannelEncoder
34  {
35      /**
36       * @return {@code true} if the encoder's stream has got an error
37       */
38      boolean checkError();
39  
40      /**
41       * Called on JVM exit error.
42       */
43      void onJvmExit();
44  
45      /**
46       * The test set has started.
47       *
48       * @param reportEntry     test set report entry
49       * @param trimStackTraces {@code true} if stack trace trimming
50       */
51      void testSetStarting( TestSetReportEntry reportEntry, boolean trimStackTraces );
52  
53      /**
54       * The test set has finished.
55       *
56       * @param reportEntry     test set report entry
57       * @param trimStackTraces {@code true} if stack trace trimming
58       */
59      void testSetCompleted( TestSetReportEntry reportEntry, boolean trimStackTraces );
60  
61      /**
62       * The test has started.
63       *
64       * @param reportEntry     test set report entry
65       * @param trimStackTraces {@code true} if stack trace trimming
66       */
67      void testStarting( ReportEntry reportEntry, boolean trimStackTraces );
68  
69      /**
70       * The test has succeeded.
71       *
72       * @param reportEntry     test set report entry
73       * @param trimStackTraces {@code true} if stack trace trimming
74       */
75      void testSucceeded( ReportEntry reportEntry, boolean trimStackTraces );
76  
77      /**
78       * The test has failed.
79       *
80       * @param reportEntry     test set report entry
81       * @param trimStackTraces {@code true} if stack trace trimming
82       */
83      void testFailed( ReportEntry reportEntry, boolean trimStackTraces );
84  
85      /**
86       * The test is skipped.
87       *
88       * @param reportEntry     test set report entry
89       * @param trimStackTraces {@code true} if stack trace trimming
90       */
91      void testSkipped( ReportEntry reportEntry, boolean trimStackTraces );
92  
93      /**
94       * The test error.
95       *
96       * @param reportEntry     test set report entry
97       * @param trimStackTraces {@code true} if stack trace trimming
98       */
99      void testError( ReportEntry reportEntry, boolean trimStackTraces );
100 
101     /**
102      * The test assumption failure.
103      *
104      * @param reportEntry     test set report entry
105      * @param trimStackTraces {@code true} if stack trace trimming
106      */
107     void testAssumptionFailure( ReportEntry reportEntry, boolean trimStackTraces );
108 
109     /**
110      * Test output, a line or characters.
111      *
112      * @param reportEntry std/out or std/err context
113      */
114     void testOutput( TestOutputReportEntry reportEntry );
115 
116     /**
117      * Info log.
118      *
119      * @param msg message of info logger
120      */
121     void consoleInfoLog( String msg );
122 
123     /**
124      * Error log.
125      *
126      * @param msg message of error logger
127      */
128     void consoleErrorLog( String msg );
129 
130     /**
131      * Error log.
132      *
133      * @param t exception
134      */
135     void consoleErrorLog( Throwable t );
136 
137     /**
138      * Error log.
139      *
140      * @param msg additional error message
141      * @param t   exception
142      */
143     void consoleErrorLog( String msg, Throwable t );
144 
145     /**
146      * Error log.
147      *
148      * @param stackTraceWriter printable stack trace
149      * @param trimStackTraces  {@code true} if selected trimmed stack trace to print into encoder channel/stream
150      */
151     void consoleErrorLog( StackTraceWriter stackTraceWriter, boolean trimStackTraces );
152 
153     /**
154      * Debug log.
155      *
156      * @param msg message of debug logger
157      */
158     void consoleDebugLog( String msg );
159 
160     /**
161      * Warning log.
162      *
163      * @param msg message of warning logger
164      */
165     void consoleWarningLog( String msg );
166 
167     /**
168      * Say BYE on exit.
169      * ForkBooter will consequently wait for BYE_ACK command which finally drains the (std/in) sink channel.
170      */
171     void bye();
172 
173     /**
174      * The provider wants to stop the progress.
175      */
176     void stopOnNextTest();
177 
178     /**
179      * The provider acquires a new test set to run.
180      */
181     void acquireNextTest();
182 
183     /**
184      * ForkedBooter tear down has failed while waiting for BYE_ACK command.
185      *
186      * @param stackTraceWriter printable stack trace
187      * @param trimStackTraces  {@code true} if selected trimmed stack trace to print into encoder channel/stream
188      */
189     void sendExitError( StackTraceWriter stackTraceWriter, boolean trimStackTraces );
190 }