use of com.amazonaws.services.schemaregistry.utils.AWSSchemaRegistryConstants.COMPRESSION in project flink by apache.
the class GlueSchemaRegistryInputStreamDeserializerTest method testGetSchemaAndDeserializedStream_withCompression_succeeds.
/**
* Test whether getSchemaAndDeserializedStream method when compression is enabled works.
*/
@Test
public void testGetSchemaAndDeserializedStream_withCompression_succeeds() throws IOException {
COMPRESSION compressionType = COMPRESSION.ZLIB;
compressionByte = AWSSchemaRegistryConstants.COMPRESSION_BYTE;
compressionHandler = new GlueSchemaRegistryDefaultCompression();
ByteArrayOutputStream byteArrayOutputStream = buildByteArrayOutputStream(AWSSchemaRegistryConstants.HEADER_VERSION_BYTE, compressionByte);
byte[] bytes = writeToExistingStream(byteArrayOutputStream, compressData(encodeData(userDefinedPojo, new SpecificDatumWriter<>(userSchema))));
MutableByteArrayInputStream mutableByteArrayInputStream = new MutableByteArrayInputStream();
mutableByteArrayInputStream.setBuffer(bytes);
glueSchemaRegistryDeserializationFacade = new MockGlueSchemaRegistryDeserializationFacade(bytes, glueSchema, compressionType);
GlueSchemaRegistryInputStreamDeserializer glueSchemaRegistryInputStreamDeserializer = new GlueSchemaRegistryInputStreamDeserializer(glueSchemaRegistryDeserializationFacade);
Schema resultSchema = glueSchemaRegistryInputStreamDeserializer.getSchemaAndDeserializedStream(mutableByteArrayInputStream);
assertThat(resultSchema.toString()).isEqualTo(glueSchema.getSchemaDefinition());
}
Aggregations