LinyuYao1021 commented on a change in pull request #14737: URL: https://github.com/apache/flink/pull/14737#discussion_r578008683
########## File path: flink-formats/flink-avro-glue-schema-registry/src/test/java/org/apache/flink/formats/avro/glue/schema/registry/GlueSchemaRegistryInputStreamDeserializerTest.java ########## @@ -0,0 +1,282 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.formats.avro.glue.schema.registry; + +import org.apache.flink.formats.avro.utils.MutableByteArrayInputStream; + +import com.amazonaws.services.schemaregistry.common.AWSCompressionHandler; +import com.amazonaws.services.schemaregistry.common.AWSSchemaRegistryDefaultCompression; +import com.amazonaws.services.schemaregistry.common.configs.GlueSchemaRegistryConfiguration; +import com.amazonaws.services.schemaregistry.deserializers.AWSDeserializer; +import com.amazonaws.services.schemaregistry.exception.AWSSchemaRegistryException; +import com.amazonaws.services.schemaregistry.utils.AWSSchemaRegistryConstants; +import lombok.NonNull; +import org.apache.avro.Schema; +import org.apache.avro.io.BinaryEncoder; +import org.apache.avro.io.DatumWriter; +import org.apache.avro.io.EncoderFactory; +import org.apache.avro.specific.SpecificDatumWriter; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import software.amazon.awssdk.auth.credentials.AwsCredentialsProvider; +import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.instanceOf; + +/** Tests for {@link GlueSchemaRegistryInputStreamDeserializer}. */ +public class GlueSchemaRegistryInputStreamDeserializerTest { + private static final String testTopic = "Test-Topic"; + private static final UUID USER_SCHEMA_VERSION_ID = UUID.randomUUID(); + private static final String AVRO_USER_SCHEMA_FILE = "src/test/java/resources/avro/user.avsc"; + private static byte compressionByte; + private static Schema userSchema; + private static com.amazonaws.services.schemaregistry.common.Schema glueSchema; + private static User userDefinedPojo; + private static Map<String, Object> configs = new HashMap<>(); + private static Map<String, String> metadata = new HashMap<>(); + private static AWSCompressionHandler awsCompressionHandler; + private static AwsCredentialsProvider credentialsProvider = + DefaultCredentialsProvider.builder().build(); + @Rule public ExpectedException thrown = ExpectedException.none(); + private AWSDeserializer mockDeserializer; + + @Before Review comment: Updated some of test classes with `BeforeClass` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org