use of org.apache.pulsar.client.impl.schema.SchemaTestUtils in project incubator-pulsar by apache.
the class MultiVersionSchemaInfoProviderTest method testGetSchema.
@Test
public void testGetSchema() throws Exception {
CompletableFuture<Optional<SchemaInfo>> completableFuture = new CompletableFuture<>();
SchemaInfo schemaInfo = AvroSchema.of(SchemaDefinition.<SchemaTestUtils>builder().withPojo(SchemaTestUtils.class).build()).getSchemaInfo();
completableFuture.complete(Optional.of(schemaInfo));
when(schemaProvider.getPulsarClient().getLookup().getSchema(any(TopicName.class), any(byte[].class))).thenReturn(completableFuture);
SchemaInfo schemaInfoByVersion = schemaProvider.getSchemaByVersion(new byte[0]).get();
assertEquals(schemaInfoByVersion, schemaInfo);
}
use of org.apache.pulsar.client.impl.schema.SchemaTestUtils in project pulsar by apache.
the class MultiVersionSchemaInfoProviderTest method testGetSchema.
@Test
public void testGetSchema() throws Exception {
CompletableFuture<Optional<SchemaInfo>> completableFuture = new CompletableFuture<>();
SchemaInfo schemaInfo = AvroSchema.of(SchemaDefinition.<SchemaTestUtils>builder().withPojo(SchemaTestUtils.class).build()).getSchemaInfo();
completableFuture.complete(Optional.of(schemaInfo));
when(schemaProvider.getPulsarClient().getLookup().getSchema(any(TopicName.class), any(byte[].class))).thenReturn(completableFuture);
SchemaInfo schemaInfoByVersion = schemaProvider.getSchemaByVersion(new byte[0]).get();
assertEquals(schemaInfoByVersion, schemaInfo);
}
use of org.apache.pulsar.client.impl.schema.SchemaTestUtils in project pulsar by yahoo.
the class MultiVersionSchemaInfoProviderTest method testGetSchema.
@Test
public void testGetSchema() throws Exception {
CompletableFuture<Optional<SchemaInfo>> completableFuture = new CompletableFuture<>();
SchemaInfo schemaInfo = AvroSchema.of(SchemaDefinition.<SchemaTestUtils>builder().withPojo(SchemaTestUtils.class).build()).getSchemaInfo();
completableFuture.complete(Optional.of(schemaInfo));
when(schemaProvider.getPulsarClient().getLookup().getSchema(any(TopicName.class), any(byte[].class))).thenReturn(completableFuture);
SchemaInfo schemaInfoByVersion = schemaProvider.getSchemaByVersion(new byte[0]).get();
assertEquals(schemaInfoByVersion, schemaInfo);
}
Aggregations