Class GzipHeaderDecoratorTest

java.lang.Object
ubic.gemma.rest.providers.GzipHeaderDecoratorTest

public class GzipHeaderDecoratorTest extends Object
Pins which of the two Content-Encoding decorators fires, for each shape of the GZIP annotation.

The distinction matters because the two run on opposite sides of Jersey's GZipEncoder: GzipHeaderDecorator sets the header before it, which is what makes the encoder compress, while GzipHeaderDecoratorAfterGZipEncoder sets it after, labelling a payload that is already compressed. Pick the wrong one and the response is either double-compressed or labelled gzip while being plain text.

  • Constructor Details

    • GzipHeaderDecoratorTest

      public GzipHeaderDecoratorTest()
  • Method Details

    • unconditionalGzipIsHandledBeforeTheEncoder

      @Test public void unconditionalGzipIsHandledBeforeTheEncoder() throws IOException
      Throws:
      IOException
    • preCompressedGzipIsHandledAfterTheEncoder

      @Test public void preCompressedGzipIsHandledAfterTheEncoder() throws IOException
      Throws:
      IOException
    • mediaTypeRestrictionIsHonoured

      @Test public void mediaTypeRestrictionIsHonoured() throws IOException
      Throws:
      IOException
    • repeatedGzipCompressesJsonThroughTheEncoder

      @Test public void repeatedGzipCompressesJsonThroughTheEncoder() throws IOException
      The repeated-annotation case. A method carrying two @GZIP reaches the interceptor as a single @GZIPs container; before it was unwrapped, neither decorator matched and the endpoint quietly lost compression on both representations.
      Throws:
      IOException
    • repeatedGzipLabelsTsvWithoutInvokingTheEncoder

      @Test public void repeatedGzipLabelsTsvWithoutInvokingTheEncoder() throws IOException
      Throws:
      IOException
    • everyRepresentationOfTheRepeatedShapeGetsExactlyOneDecorator

      @Test public void everyRepresentationOfTheRepeatedShapeGetsExactlyOneDecorator() throws IOException
      Neither decorator may leave a representation both unlabelled and uncompressed — that is the silent-regression shape, and it is what a dropped container annotation looks like from the outside.
      Throws:
      IOException
    • resultSetsListingIsCompressedThroughTheEncoder

      @Test public void resultSetsListingIsCompressedThroughTheEncoder() throws IOException
      The GET /resultSets list route, driven off its real annotations rather than a fixture.

      Every row of that listing repeats its parent analysis and its experimentalFactors verbatim, so the body is dominated by duplicated text: measured on gemma2 at ?limit=20, 229,515 bytes uncompressed against 5,777 gzipped. Compression is the whole reason the route is affordable, and losing it is invisible from the response body — only the missing Content-Encoding header shows it.

      Throws:
      IOException