use of com.hortonworks.registries.schemaregistry.avro.helper.SchemaRegistryTestServerClientWrapper in project registry by hortonworks.
the class LocalRegistryServerHATest method startZooKeeper.
@Before
public void startZooKeeper() throws Exception {
testingServer = new TestingServer(true);
File serverYAMLFile = new File(SCHEMA_REGISTRY_TEST_CONFIGURATION.getServerYAMLPath());
String fileContent = FileUtils.readFileToString(serverYAMLFile, "UTF-8");
File registryConfigFile = File.createTempFile("ha-", ".yaml");
registryConfigFile.deleteOnExit();
try (FileWriter writer = new FileWriter(registryConfigFile)) {
IOUtils.write(fileContent.replace("__zk_connect_url__", testingServer.getConnectString()), writer);
}
SchemaRegistryTestConfiguration testConfiguration = new SchemaRegistryTestConfiguration(registryConfigFile.getAbsolutePath(), SCHEMA_REGISTRY_TEST_CONFIGURATION.getClientYAMLPath());
List<SchemaRegistryTestServerClientWrapper> schemaRegistryServers = new ArrayList<>();
for (int i = 1; i < 4; i++) {
SchemaRegistryTestServerClientWrapper server = new SchemaRegistryTestServerClientWrapper(testConfiguration);
schemaRegistryServers.add(server);
server.startTestServer();
}
registryServers = Collections.unmodifiableList(schemaRegistryServers);
}
use of com.hortonworks.registries.schemaregistry.avro.helper.SchemaRegistryTestServerClientWrapper in project registry by hortonworks.
the class LocalRegistryServerTest method testSanity.
@Test
public void testSanity() throws Exception {
SchemaRegistryTestServerClientWrapper schemaRegistryTestServerClientWrapper = new SchemaRegistryTestServerClientWrapper(SCHEMA_REGISTRY_TEST_CONFIGURATION);
schemaRegistryTestServerClientWrapper.startTestServer();
SchemaRegistryClient schemaRegistryClient = schemaRegistryTestServerClientWrapper.getClient();
// registering schema metadata
SchemaMetadata schemaMetadata = new SchemaMetadata.Builder("foo").type("avro").build();
Long schemaId = schemaRegistryClient.registerSchemaMetadata(schemaMetadata);
Assert.assertNotNull(schemaId);
// registering a new schema
String schemaName = schemaMetadata.getName();
String schema1 = IOUtils.toString(LocalRegistryServerTest.class.getResourceAsStream("/schema-1.avsc"), "UTF-8");
SchemaIdVersion v1 = schemaRegistryClient.addSchemaVersion(schemaName, new SchemaVersion(schema1, "Initial version of the schema"));
schemaRegistryTestServerClientWrapper.stopTestServer();
}
Aggregations