use of com.amazonaws.services.schemaregistry.common.configs.GlueSchemaRegistryConfiguration in project flink-mirror by flink-ci.
the class GlueSchemaRegistryAvroSerializationSchemaTest method setup.
@BeforeClass
public static void setup() throws IOException {
metadata.put("test-key", "test-value");
metadata.put(AWSSchemaRegistryConstants.TRANSPORT_METADATA_KEY, testTopic);
configs.put(AWSSchemaRegistryConstants.AWS_REGION, "us-west-2");
configs.put(AWSSchemaRegistryConstants.AWS_ENDPOINT, "https://test");
configs.put(AWSSchemaRegistryConstants.SCHEMA_AUTO_REGISTRATION_SETTING, true);
configs.put(AWSSchemaRegistryConstants.SCHEMA_NAME, schemaName);
configs.put(AWSSchemaRegistryConstants.METADATA, metadata);
Schema.Parser parser = new Schema.Parser();
userSchema = parser.parse(new File(AVRO_USER_SCHEMA_FILE));
userDefinedPojo = User.newBuilder().setName("test_avro_schema").setFavoriteColor("violet").setFavoriteNumber(10).build();
glueSchemaRegistryConfiguration = new GlueSchemaRegistryConfiguration(configs);
mockSerializationFacade = new MockGlueSchemaRegistrySerializationFacade();
}
use of com.amazonaws.services.schemaregistry.common.configs.GlueSchemaRegistryConfiguration in project flink-mirror by flink-ci.
the class GlueSchemaRegistryAvroSchemaCoderTest method testWriteSchema_withoutAutoRegistration_throwsException.
/**
* Test whether writeSchema method throws exception if auto registration un-enabled.
*/
@Test
public void testWriteSchema_withoutAutoRegistration_throwsException() throws IOException {
configs.put(AWSSchemaRegistryConstants.SCHEMA_AUTO_REGISTRATION_SETTING, false);
mockClient = new MockAWSSchemaRegistryClient();
GlueSchemaRegistrySerializationFacade glueSchemaRegistrySerializationFacade = GlueSchemaRegistrySerializationFacade.builder().schemaRegistryClient(mockClient).credentialProvider(credentialsProvider).glueSchemaRegistryConfiguration(new GlueSchemaRegistryConfiguration(configs)).build();
GlueSchemaRegistryOutputStreamSerializer glueSchemaRegistryOutputStreamSerializer = new GlueSchemaRegistryOutputStreamSerializer(testTopic, configs, glueSchemaRegistrySerializationFacade);
GlueSchemaRegistryAvroSchemaCoder glueSchemaRegistryAvroSchemaCoder = new GlueSchemaRegistryAvroSchemaCoder(glueSchemaRegistryOutputStreamSerializer);
thrown.expect(AWSSchemaRegistryException.class);
thrown.expectMessage(AWSSchemaRegistryConstants.AUTO_REGISTRATION_IS_DISABLED_MSG);
glueSchemaRegistryAvroSchemaCoder.writeSchema(userSchema, new ByteArrayOutputStream());
}
use of com.amazonaws.services.schemaregistry.common.configs.GlueSchemaRegistryConfiguration in project flink-mirror by flink-ci.
the class GlueSchemaRegistryJsonSerializationSchemaTest method setup.
@BeforeClass
public static void setup() {
metadata.put("test-key", "test-value");
metadata.put(AWSSchemaRegistryConstants.TRANSPORT_METADATA_KEY, testTopic);
configs.put(AWSSchemaRegistryConstants.AWS_REGION, "us-west-2");
configs.put(AWSSchemaRegistryConstants.AWS_ENDPOINT, "https://test");
configs.put(AWSSchemaRegistryConstants.SCHEMA_AUTO_REGISTRATION_SETTING, true);
configs.put(AWSSchemaRegistryConstants.SCHEMA_NAME, schemaName);
configs.put(AWSSchemaRegistryConstants.METADATA, metadata);
userSchema = JsonDataWithSchema.builder(JSON_SCHEMA, "{\"f1\":\"iphone\",\"f2\":12}").build();
userDefinedPojo = Car.builder().make("Tesla").model("3").used(false).miles(6000).year(2021).listedDate(new GregorianCalendar(2020, Calendar.FEBRUARY, 20).getTime()).purchaseDate(Date.from(Instant.parse("2020-01-01T00:00:00.000Z"))).owners(new String[] { "Harry", "Megan" }).serviceChecks(Arrays.asList(5000.0f, 10780.30f)).build();
glueSchemaRegistryConfiguration = new GlueSchemaRegistryConfiguration(configs);
mockSerializationFacade = new MockGlueSchemaRegistrySerializationFacade();
}
use of com.amazonaws.services.schemaregistry.common.configs.GlueSchemaRegistryConfiguration in project flink by apache.
the class GlueSchemaRegistryAvroSerializationSchemaTest method setup.
@BeforeClass
public static void setup() throws IOException {
metadata.put("test-key", "test-value");
metadata.put(AWSSchemaRegistryConstants.TRANSPORT_METADATA_KEY, testTopic);
configs.put(AWSSchemaRegistryConstants.AWS_REGION, "us-west-2");
configs.put(AWSSchemaRegistryConstants.AWS_ENDPOINT, "https://test");
configs.put(AWSSchemaRegistryConstants.SCHEMA_AUTO_REGISTRATION_SETTING, true);
configs.put(AWSSchemaRegistryConstants.SCHEMA_NAME, schemaName);
configs.put(AWSSchemaRegistryConstants.METADATA, metadata);
Schema.Parser parser = new Schema.Parser();
userSchema = parser.parse(new File(AVRO_USER_SCHEMA_FILE));
userDefinedPojo = User.newBuilder().setName("test_avro_schema").setFavoriteColor("violet").setFavoriteNumber(10).build();
glueSchemaRegistryConfiguration = new GlueSchemaRegistryConfiguration(configs);
mockSerializationFacade = new MockGlueSchemaRegistrySerializationFacade();
}
use of com.amazonaws.services.schemaregistry.common.configs.GlueSchemaRegistryConfiguration in project flink by apache.
the class GlueSchemaRegistryJsonSerializationSchemaTest method setup.
@BeforeClass
public static void setup() {
metadata.put("test-key", "test-value");
metadata.put(AWSSchemaRegistryConstants.TRANSPORT_METADATA_KEY, testTopic);
configs.put(AWSSchemaRegistryConstants.AWS_REGION, "us-west-2");
configs.put(AWSSchemaRegistryConstants.AWS_ENDPOINT, "https://test");
configs.put(AWSSchemaRegistryConstants.SCHEMA_AUTO_REGISTRATION_SETTING, true);
configs.put(AWSSchemaRegistryConstants.SCHEMA_NAME, schemaName);
configs.put(AWSSchemaRegistryConstants.METADATA, metadata);
userSchema = JsonDataWithSchema.builder(JSON_SCHEMA, "{\"f1\":\"iphone\",\"f2\":12}").build();
userDefinedPojo = Car.builder().make("Tesla").model("3").used(false).miles(6000).year(2021).listedDate(new GregorianCalendar(2020, Calendar.FEBRUARY, 20).getTime()).purchaseDate(Date.from(Instant.parse("2020-01-01T00:00:00.000Z"))).owners(new String[] { "Harry", "Megan" }).serviceChecks(Arrays.asList(5000.0f, 10780.30f)).build();
glueSchemaRegistryConfiguration = new GlueSchemaRegistryConfiguration(configs);
mockSerializationFacade = new MockGlueSchemaRegistrySerializationFacade();
}
Aggregations