13
13
import okhttp3 .*;
14
14
15
15
import java .io .IOException ;
16
- import java .io .PrintStream ;
17
16
import java .util .Arrays ;
18
17
import java .util .HashMap ;
19
18
import java .util .Map ;
20
19
21
- import static com .browserstack .automate .ci .common .logger .PluginLogger .log ;
22
- import static com .browserstack .automate .ci .common .logger .PluginLogger .logError ;
23
-
24
20
public class BrowserStackTestReportAction implements Action {
25
21
26
22
private static final String DEFAULT_REPORT_TIMEOUT = "120" ;
@@ -31,8 +27,6 @@ public class BrowserStackTestReportAction implements Action {
31
27
private static final String RATE_LIMIT = "RATE_LIMIT" ;
32
28
private static final String TEST_AVAILABLE = "TEST_AVAILABLE" ;
33
29
private static final int MAX_ATTEMPTS = 3 ;
34
-
35
- private final transient PrintStream logger ;
36
30
private final RequestsUtil requestsUtil ;
37
31
private final BrowserStackCredentials credentials ;
38
32
private final String buildName ;
@@ -44,12 +38,11 @@ public class BrowserStackTestReportAction implements Action {
44
38
private String reportStatus ;
45
39
private int maxRetryReportAttempt ;
46
40
47
- public BrowserStackTestReportAction (Run <?, ?> run , BrowserStackCredentials credentials , String buildName , String buildCreatedAt , final PrintStream logger ) {
41
+ public BrowserStackTestReportAction (Run <?, ?> run , BrowserStackCredentials credentials , String buildName , String buildCreatedAt ) {
48
42
this .run = run ;
49
43
this .credentials = credentials ;
50
44
this .buildName = buildName ;
51
45
this .buildCreatedAt = buildCreatedAt ;
52
- this .logger = logger ;
53
46
this .requestsUtil = new RequestsUtil ();
54
47
this .reportHtml = null ;
55
48
this .reportStyle = "" ;
@@ -82,7 +75,6 @@ private void fetchReport() {
82
75
String reportUrl = Constants .CAD_BASE_URL + Constants .BROWSERSTACK_CONFIG_DETAILS_ENDPOINT ;
83
76
84
77
try {
85
- log (logger , "Fetching BrowserStack report..." );
86
78
Response response = requestsUtil .makeRequest (reportUrl , credentials , createRequestBody (params ));
87
79
handleResponse (response );
88
80
} catch (Exception e ) {
@@ -119,7 +111,6 @@ private void handleResponse(Response response) throws Exception {
119
111
reportStatus = RATE_LIMIT ;
120
112
} else {
121
113
reportStatus = REPORT_FAILED ;
122
- logError (logger , "Non-success response while fetching report: " + response .code ());
123
114
}
124
115
}
125
116
}
@@ -163,7 +154,7 @@ private void setReportSuccess(JSONObject report) {
163
154
ArtifactArchiver artifactArchiver = getArtifactArchiver (workspace , fullHtml );
164
155
artifactArchiver .perform (run , workspace , new EnvVars (), null , TaskListener .NULL );
165
156
} catch (Exception e ) {
166
- logError ( logger , "Failed to save or archive report artifact: " + e . getMessage ());
157
+ //do nothing, as we don't want to fail the build if archiving fails
167
158
}
168
159
}
169
160
@@ -188,7 +179,6 @@ private void handleFetchException(Exception e) {
188
179
if (maxRetryReportAttempt < 0 ) {
189
180
reportStatus = REPORT_FAILED ;
190
181
}
191
- logError (logger , "Exception while fetching the report: " + Arrays .toString (e .getStackTrace ()));
192
182
}
193
183
194
184
public boolean isReportInProgress () {
0 commit comments