|
53 | 53 | import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
|
54 | 54 | import org.eclipse.jetty.util.IO;
|
55 | 55 | import org.eclipse.jetty.util.component.LifeCycle;
|
| 56 | +import org.eclipse.jetty.util.log.Log; |
| 57 | +import org.eclipse.jetty.util.log.Logger; |
56 | 58 | import org.junit.jupiter.api.AfterEach;
|
57 | 59 | import org.junit.jupiter.api.BeforeEach;
|
58 | 60 | import org.junit.jupiter.api.Test;
|
|
72 | 74 |
|
73 | 75 | public class GzipWithSendErrorTest
|
74 | 76 | {
|
| 77 | + private static final Logger LOG = Log.getLogger(GzipWithSendErrorTest.class); |
75 | 78 | private Server server;
|
76 | 79 | private HttpClient client;
|
77 | 80 | private ServerConnector connector;
|
@@ -199,8 +202,14 @@ public void onComplete(Request request)
|
199 | 202 | });
|
200 | 203 |
|
201 | 204 | // This is a doubly-compressed (with gzip) test resource.
|
202 |
| - // There's no point putting into SCM the full 1MB file, when the |
203 |
| - // 3KB version is adequate. |
| 205 | + // There's no point putting into SCM the full 1MB file input file. |
| 206 | + // So the zeros.gz.gz is committed. This file uses full sized gzip |
| 207 | + // headers and data segments. Java's Gzip/Deflate handling cannot |
| 208 | + // produce a gzip data stream like this. |
| 209 | + // This test resource will unpack to |
| 210 | + // -rw-rw-r-- 1 joakim joakim 1,042,069 Nov 19 10:14 zeros.gz |
| 211 | + // That will unpack to |
| 212 | + // -rw-rw-r-- 1 joakim joakim 1,073,741,824 Nov 19 10:14 zeros |
204 | 213 | Path zerosCompressed = MavenTestingUtils.getTestResourcePathFile("zeros.gz.gz");
|
205 | 214 | byte[] compressedRequest;
|
206 | 215 | try (InputStream in = Files.newInputStream(zerosCompressed);
|
@@ -246,9 +255,12 @@ public long getLength()
|
246 | 255 | // Await for server side to complete the request
|
247 | 256 | assertTrue(serverRequestCompleteLatch.await(5, TimeUnit.SECONDS), "Request complete never occurred?");
|
248 | 257 |
|
249 |
| - // System.out.printf("Input Content Consumed: %,d%n", inputContentConsumed.get()); |
250 |
| - // System.out.printf("Input Content Received: %,d%n", inputContentReceived.get()); |
251 |
| - // System.out.printf("Input BytesIn Count: %,d%n", inputBytesIn.get()); |
| 258 | + if (LOG.isDebugEnabled()) |
| 259 | + { |
| 260 | + LOG.debug("Input Content Consumed: %,d%n", inputContentConsumed.get()); |
| 261 | + LOG.debug("Input Content Received: %,d%n", inputContentReceived.get()); |
| 262 | + LOG.debug("Input BytesIn Count: %,d%n", inputBytesIn.get()); |
| 263 | + } |
252 | 264 |
|
253 | 265 | // Servlet didn't read body content
|
254 | 266 | assertThat("Request Input Content Consumed not have been used", inputContentConsumed.get(), is(0L));
|
@@ -304,8 +316,14 @@ public void onComplete(Request request)
|
304 | 316 | });
|
305 | 317 |
|
306 | 318 | // This is a doubly-compressed (with gzip) test resource.
|
307 |
| - // There's no point putting into SCM the full 1MB file, when the |
308 |
| - // 3KB version is adequate. |
| 319 | + // There's no point putting into SCM the full 1MB file input file. |
| 320 | + // So the zeros.gz.gz is committed. This file uses full sized gzip |
| 321 | + // headers and data segments. Java's Gzip/Deflate handling cannot |
| 322 | + // produce a gzip data stream like this. |
| 323 | + // This test resource will unpack to |
| 324 | + // -rw-rw-r-- 1 joakim joakim 1,042,069 Nov 19 10:14 zeros.gz |
| 325 | + // That will unpack to |
| 326 | + // -rw-rw-r-- 1 joakim joakim 1,073,741,824 Nov 19 10:14 zeros |
309 | 327 | Path zerosCompressed = MavenTestingUtils.getTestResourcePathFile("zeros.gz.gz");
|
310 | 328 | byte[] compressedRequest;
|
311 | 329 | try (InputStream in = Files.newInputStream(zerosCompressed);
|
@@ -346,9 +364,12 @@ public void onComplete(Request request)
|
346 | 364 | // Await for server side to complete the request
|
347 | 365 | assertTrue(serverRequestCompleteLatch.await(5, TimeUnit.SECONDS), "Request complete never occurred?");
|
348 | 366 |
|
349 |
| - // System.out.printf("Input Content Consumed: %,d%n", inputContentConsumed.get()); |
350 |
| - // System.out.printf("Input Content Received: %,d%n", inputContentReceived.get()); |
351 |
| - // System.out.printf("Input BytesIn Count: %,d%n", inputBytesIn.get()); |
| 367 | + if (LOG.isDebugEnabled()) |
| 368 | + { |
| 369 | + LOG.debug("Input Content Consumed: %,d%n", inputContentConsumed.get()); |
| 370 | + LOG.debug("Input Content Received: %,d%n", inputContentReceived.get()); |
| 371 | + LOG.debug("Input BytesIn Count: %,d%n", inputBytesIn.get()); |
| 372 | + } |
352 | 373 |
|
353 | 374 | long readCount = read ? 1L : 0L;
|
354 | 375 |
|
|
0 commit comments