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.maven.surefire.api.booter; 20 21 import org.apache.maven.surefire.api.report.ReportEntry; 22 import org.apache.maven.surefire.api.report.StackTraceWriter; 23 import org.apache.maven.surefire.api.report.TestOutputReportEntry; 24 import org.apache.maven.surefire.api.report.TestSetReportEntry; 25 26 /** 27 * An abstraction for physical encoder of events. 28 * 29 * @author <a href="mailto:tibordigana@apache.org">Tibor Digana (tibor17)</a> 30 * @since 3.0.0-M5 31 */ 32 public interface MasterProcessChannelEncoder { 33 /** 34 * @return {@code true} if the encoder's stream has got an error 35 */ 36 boolean checkError(); 37 38 /** 39 * Called on JVM exit error. 40 */ 41 void onJvmExit(); 42 43 /** 44 * The test set has started. 45 * 46 * @param reportEntry test set report entry 47 * @param trimStackTraces {@code true} if stack trace trimming 48 */ 49 void testSetStarting(TestSetReportEntry reportEntry, boolean trimStackTraces); 50 51 /** 52 * The test set has finished. 53 * 54 * @param reportEntry test set report entry 55 * @param trimStackTraces {@code true} if stack trace trimming 56 */ 57 void testSetCompleted(TestSetReportEntry reportEntry, boolean trimStackTraces); 58 59 /** 60 * The test has started. 61 * 62 * @param reportEntry test set report entry 63 * @param trimStackTraces {@code true} if stack trace trimming 64 */ 65 void testStarting(ReportEntry reportEntry, boolean trimStackTraces); 66 67 /** 68 * The test has succeeded. 69 * 70 * @param reportEntry test set report entry 71 * @param trimStackTraces {@code true} if stack trace trimming 72 */ 73 void testSucceeded(ReportEntry reportEntry, boolean trimStackTraces); 74 75 /** 76 * The test has failed. 77 * 78 * @param reportEntry test set report entry 79 * @param trimStackTraces {@code true} if stack trace trimming 80 */ 81 void testFailed(ReportEntry reportEntry, boolean trimStackTraces); 82 83 /** 84 * The test is skipped. 85 * 86 * @param reportEntry test set report entry 87 * @param trimStackTraces {@code true} if stack trace trimming 88 */ 89 void testSkipped(ReportEntry reportEntry, boolean trimStackTraces); 90 91 /** 92 * The test error. 93 * 94 * @param reportEntry test set report entry 95 * @param trimStackTraces {@code true} if stack trace trimming 96 */ 97 void testError(ReportEntry reportEntry, boolean trimStackTraces); 98 99 /** 100 * The test assumption failure. 101 * 102 * @param reportEntry test set report entry 103 * @param trimStackTraces {@code true} if stack trace trimming 104 */ 105 void testAssumptionFailure(ReportEntry reportEntry, boolean trimStackTraces); 106 107 /** 108 * Test output, a line or characters. 109 * 110 * @param reportEntry std/out or std/err context 111 */ 112 void testOutput(TestOutputReportEntry reportEntry); 113 114 /** 115 * Info log. 116 * 117 * @param msg message of info logger 118 */ 119 void consoleInfoLog(String msg); 120 121 /** 122 * Error log. 123 * 124 * @param msg message of error logger 125 */ 126 void consoleErrorLog(String msg); 127 128 /** 129 * Error log. 130 * 131 * @param t exception 132 */ 133 void consoleErrorLog(Throwable t); 134 135 /** 136 * Error log. 137 * 138 * @param msg additional error message 139 * @param t exception 140 */ 141 void consoleErrorLog(String msg, Throwable t); 142 143 /** 144 * Error log. 145 * 146 * @param stackTraceWriter printable stack trace 147 * @param trimStackTraces {@code true} if selected trimmed stack trace to print into encoder channel/stream 148 */ 149 void consoleErrorLog(StackTraceWriter stackTraceWriter, boolean trimStackTraces); 150 151 /** 152 * Debug log. 153 * 154 * @param msg message of debug logger 155 */ 156 void consoleDebugLog(String msg); 157 158 /** 159 * Warning log. 160 * 161 * @param msg message of warning logger 162 */ 163 void consoleWarningLog(String msg); 164 165 /** 166 * Say BYE on exit. 167 * ForkBooter will consequently wait for BYE_ACK command which finally drains the (std/in) sink channel. 168 */ 169 void bye(); 170 171 /** 172 * The provider wants to stop the progress. 173 */ 174 void stopOnNextTest(); 175 176 /** 177 * The provider acquires a new test set to run. 178 */ 179 void acquireNextTest(); 180 181 /** 182 * ForkedBooter tear down has failed while waiting for BYE_ACK command. 183 * 184 * @param stackTraceWriter printable stack trace 185 * @param trimStackTraces {@code true} if selected trimmed stack trace to print into encoder channel/stream 186 */ 187 void sendExitError(StackTraceWriter stackTraceWriter, boolean trimStackTraces); 188 }