Search in sources :

Example 6 with ResourceDecoder

use of cn.taketoday.core.codec.ResourceDecoder in project today-infrastructure by TAKETODAY.

the class ServerCodecConfigurerTests method maxInMemorySize.

@Test
public void maxInMemorySize() {
    int size = 99;
    this.configurer.defaultCodecs().maxInMemorySize(size);
    List<HttpMessageReader<?>> readers = this.configurer.getReaders();
    assertThat(((ByteArrayDecoder) getNextDecoder(readers)).getMaxInMemorySize()).isEqualTo(size);
    assertThat(((ByteBufferDecoder) getNextDecoder(readers)).getMaxInMemorySize()).isEqualTo(size);
    assertThat(((DataBufferDecoder) getNextDecoder(readers)).getMaxInMemorySize()).isEqualTo(size);
    assertThat(((NettyByteBufDecoder) getNextDecoder(readers)).getMaxInMemorySize()).isEqualTo(size);
    assertThat(((ResourceDecoder) getNextDecoder(readers)).getMaxInMemorySize()).isEqualTo(size);
    assertThat(((StringDecoder) getNextDecoder(readers)).getMaxInMemorySize()).isEqualTo(size);
    assertThat(((ProtobufDecoder) getNextDecoder(readers)).getMaxMessageSize()).isEqualTo(size);
    assertThat(((FormHttpMessageReader) nextReader(readers)).getMaxInMemorySize()).isEqualTo(size);
    assertThat(((DefaultPartHttpMessageReader) nextReader(readers)).getMaxInMemorySize()).isEqualTo(size);
    MultipartHttpMessageReader multipartReader = (MultipartHttpMessageReader) nextReader(readers);
    DefaultPartHttpMessageReader reader = (DefaultPartHttpMessageReader) multipartReader.getPartReader();
    assertThat((reader).getMaxInMemorySize()).isEqualTo(size);
    assertThat(((PartEventHttpMessageReader) nextReader(readers)).getMaxInMemorySize()).isEqualTo(size);
    assertThat(((Jackson2JsonDecoder) getNextDecoder(readers)).getMaxInMemorySize()).isEqualTo(size);
    assertThat(((Jackson2SmileDecoder) getNextDecoder(readers)).getMaxInMemorySize()).isEqualTo(size);
    assertThat(((StringDecoder) getNextDecoder(readers)).getMaxInMemorySize()).isEqualTo(size);
}
Also used : MultipartHttpMessageReader(cn.taketoday.http.codec.multipart.MultipartHttpMessageReader) DefaultPartHttpMessageReader(cn.taketoday.http.codec.multipart.DefaultPartHttpMessageReader) Jackson2JsonDecoder(cn.taketoday.http.codec.json.Jackson2JsonDecoder) ProtobufDecoder(cn.taketoday.http.codec.protobuf.ProtobufDecoder) StringDecoder(cn.taketoday.core.codec.StringDecoder) ResourceDecoder(cn.taketoday.core.codec.ResourceDecoder) ByteBufferDecoder(cn.taketoday.core.codec.ByteBufferDecoder) ResourceHttpMessageReader(cn.taketoday.http.codec.ResourceHttpMessageReader) DefaultPartHttpMessageReader(cn.taketoday.http.codec.multipart.DefaultPartHttpMessageReader) FormHttpMessageReader(cn.taketoday.http.codec.FormHttpMessageReader) MultipartHttpMessageReader(cn.taketoday.http.codec.multipart.MultipartHttpMessageReader) DecoderHttpMessageReader(cn.taketoday.http.codec.DecoderHttpMessageReader) HttpMessageReader(cn.taketoday.http.codec.HttpMessageReader) PartEventHttpMessageReader(cn.taketoday.http.codec.multipart.PartEventHttpMessageReader) FormHttpMessageReader(cn.taketoday.http.codec.FormHttpMessageReader) NettyByteBufDecoder(cn.taketoday.core.codec.NettyByteBufDecoder) PartEventHttpMessageReader(cn.taketoday.http.codec.multipart.PartEventHttpMessageReader) DataBufferDecoder(cn.taketoday.core.codec.DataBufferDecoder) ByteArrayDecoder(cn.taketoday.core.codec.ByteArrayDecoder) Jackson2SmileDecoder(cn.taketoday.http.codec.json.Jackson2SmileDecoder) Test(org.junit.jupiter.api.Test)

Aggregations

ByteArrayDecoder (cn.taketoday.core.codec.ByteArrayDecoder)6 ByteBufferDecoder (cn.taketoday.core.codec.ByteBufferDecoder)6 DataBufferDecoder (cn.taketoday.core.codec.DataBufferDecoder)6 NettyByteBufDecoder (cn.taketoday.core.codec.NettyByteBufDecoder)6 ResourceDecoder (cn.taketoday.core.codec.ResourceDecoder)6 FormHttpMessageReader (cn.taketoday.http.codec.FormHttpMessageReader)6 ResourceHttpMessageReader (cn.taketoday.http.codec.ResourceHttpMessageReader)6 ProtobufDecoder (cn.taketoday.http.codec.protobuf.ProtobufDecoder)6 StringDecoder (cn.taketoday.core.codec.StringDecoder)4 DecoderHttpMessageReader (cn.taketoday.http.codec.DecoderHttpMessageReader)4 HttpMessageReader (cn.taketoday.http.codec.HttpMessageReader)4 Jackson2JsonDecoder (cn.taketoday.http.codec.json.Jackson2JsonDecoder)4 Jackson2SmileDecoder (cn.taketoday.http.codec.json.Jackson2SmileDecoder)4 Test (org.junit.jupiter.api.Test)4 AbstractDataBufferDecoder (cn.taketoday.core.codec.AbstractDataBufferDecoder)2 ServerSentEventHttpMessageReader (cn.taketoday.http.codec.ServerSentEventHttpMessageReader)2 DefaultPartHttpMessageReader (cn.taketoday.http.codec.multipart.DefaultPartHttpMessageReader)2 MultipartHttpMessageReader (cn.taketoday.http.codec.multipart.MultipartHttpMessageReader)2 PartEventHttpMessageReader (cn.taketoday.http.codec.multipart.PartEventHttpMessageReader)2