Skip to content

Commit a6d432e

Browse files
committed
Issue #5605 - Adding more comments and fixing logging
Signed-off-by: Joakim Erdfelt <[email protected]>
1 parent d4feb4f commit a6d432e

File tree

1 file changed

+31
-10
lines changed

1 file changed

+31
-10
lines changed

tests/test-integration/src/test/java/org/eclipse/jetty/test/GzipWithSendErrorTest.java

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@
5353
import org.eclipse.jetty.toolchain.test.MavenTestingUtils;
5454
import org.eclipse.jetty.util.IO;
5555
import org.eclipse.jetty.util.component.LifeCycle;
56+
import org.eclipse.jetty.util.log.Log;
57+
import org.eclipse.jetty.util.log.Logger;
5658
import org.junit.jupiter.api.AfterEach;
5759
import org.junit.jupiter.api.BeforeEach;
5860
import org.junit.jupiter.api.Test;
@@ -72,6 +74,7 @@
7274

7375
public class GzipWithSendErrorTest
7476
{
77+
private static final Logger LOG = Log.getLogger(GzipWithSendErrorTest.class);
7578
private Server server;
7679
private HttpClient client;
7780
private ServerConnector connector;
@@ -199,8 +202,14 @@ public void onComplete(Request request)
199202
});
200203

201204
// 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
204213
Path zerosCompressed = MavenTestingUtils.getTestResourcePathFile("zeros.gz.gz");
205214
byte[] compressedRequest;
206215
try (InputStream in = Files.newInputStream(zerosCompressed);
@@ -246,9 +255,12 @@ public long getLength()
246255
// Await for server side to complete the request
247256
assertTrue(serverRequestCompleteLatch.await(5, TimeUnit.SECONDS), "Request complete never occurred?");
248257

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+
}
252264

253265
// Servlet didn't read body content
254266
assertThat("Request Input Content Consumed not have been used", inputContentConsumed.get(), is(0L));
@@ -304,8 +316,14 @@ public void onComplete(Request request)
304316
});
305317

306318
// 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
309327
Path zerosCompressed = MavenTestingUtils.getTestResourcePathFile("zeros.gz.gz");
310328
byte[] compressedRequest;
311329
try (InputStream in = Files.newInputStream(zerosCompressed);
@@ -346,9 +364,12 @@ public void onComplete(Request request)
346364
// Await for server side to complete the request
347365
assertTrue(serverRequestCompleteLatch.await(5, TimeUnit.SECONDS), "Request complete never occurred?");
348366

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+
}
352373

353374
long readCount = read ? 1L : 0L;
354375

0 commit comments

Comments
 (0)