Search in sources :

Example 1 with SchemaRegistryTestServerClientWrapper

use of com.hortonworks.registries.schemaregistry.avro.helper.SchemaRegistryTestServerClientWrapper in project registry by hortonworks.

the class AvroSchemaRegistryClientTest method beforeParam.

@CustomParameterizedRunner.BeforeParam
public static void beforeParam(SchemaRegistryTestProfileType schemaRegistryTestProfileType) throws Exception {
    SCHEMA_REGISTRY_TEST_SERVER_CLIENT_WRAPPER = new SchemaRegistryTestServerClientWrapper(schemaRegistryTestProfileType);
    SCHEMA_REGISTRY_TEST_SERVER_CLIENT_WRAPPER.startTestServer();
    SCHEMA_REGISTRY_CLIENT = SCHEMA_REGISTRY_TEST_SERVER_CLIENT_WRAPPER.getClient(false);
    SCHEMA_REGISTRY_CLIENT_CONF = SCHEMA_REGISTRY_TEST_SERVER_CLIENT_WRAPPER.exportClientConf();
}
Also used : SchemaRegistryTestServerClientWrapper(com.hortonworks.registries.schemaregistry.avro.helper.SchemaRegistryTestServerClientWrapper)

Example 2 with SchemaRegistryTestServerClientWrapper

use of com.hortonworks.registries.schemaregistry.avro.helper.SchemaRegistryTestServerClientWrapper in project registry by hortonworks.

the class KafkaAvroSerDesTest method beforeParam.

@CustomParameterizedRunner.BeforeParam
public static void beforeParam(SchemaRegistryTestProfileType schemaRegistryTestProfileType) throws Exception {
    SCHEMA_REGISTRY_TEST_SERVER_CLIENT_WRAPPER = new SchemaRegistryTestServerClientWrapper(schemaRegistryTestProfileType);
    SCHEMA_REGISTRY_TEST_SERVER_CLIENT_WRAPPER.startTestServer();
}
Also used : SchemaRegistryTestServerClientWrapper(com.hortonworks.registries.schemaregistry.avro.helper.SchemaRegistryTestServerClientWrapper)

Example 3 with SchemaRegistryTestServerClientWrapper

use of com.hortonworks.registries.schemaregistry.avro.helper.SchemaRegistryTestServerClientWrapper in project registry by hortonworks.

the class LocalRegistryServerHATest method testHASanity.

@Test
public void testHASanity() throws Exception {
    SchemaRegistryTestServerClientWrapper followerServer = followerSchemaRegistryServer();
    SchemaRegistryClient schemaRegistryClient = followerServer.getClient();
    // registering schema metadata on follower, this should have been redirected to leader.
    String schemaName = "foo";
    SchemaMetadata schemaMetadata = new SchemaMetadata.Builder(schemaName).type("avro").build();
    Long schemaId = schemaRegistryClient.registerSchemaMetadata(schemaMetadata);
    Assert.assertNotNull(schemaId);
    // registering a new schema on follower, this should have been redirected to leader.
    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"));
    // retrieve schema on leader as the schema data is stored in memory in leader. this data does not exist on
    // followers as the storage is inmemory.
    SchemaRegistryTestServerClientWrapper leaderServer = leaderSchemaRegistryServer();
    int leaderPort = leaderServer.getLocalPort();
    SchemaRegistryClient leaderClient = leaderServer.getClient();
    SchemaMetadataInfo schemaMetadataInfo = leaderClient.getSchemaMetadataInfo(schemaName);
    Assert.assertEquals(schemaMetadata, schemaMetadataInfo.getSchemaMetadata());
    // stop the leader server
    leaderServer.stopTestServer();
    // get the new leader server and run operations.
    SchemaRegistryTestServerClientWrapper newLeaderServer = leaderSchemaRegistryServer();
    Assert.assertNotEquals(leaderPort, newLeaderServer.getLocalPort());
    leaderClient = newLeaderServer.getClient();
    String receivedSchema = leaderClient.getSchemaVersionInfo(new SchemaVersionKey(schemaName, v1.getVersion())).getSchemaText();
    Assert.assertEquals(schema1, receivedSchema);
}
Also used : SchemaRegistryTestServerClientWrapper(com.hortonworks.registries.schemaregistry.avro.helper.SchemaRegistryTestServerClientWrapper) SchemaMetadata(com.hortonworks.registries.schemaregistry.SchemaMetadata) SchemaVersion(com.hortonworks.registries.schemaregistry.SchemaVersion) SchemaIdVersion(com.hortonworks.registries.schemaregistry.SchemaIdVersion) SchemaVersionKey(com.hortonworks.registries.schemaregistry.SchemaVersionKey) SchemaRegistryClient(com.hortonworks.registries.schemaregistry.client.SchemaRegistryClient) SchemaMetadataInfo(com.hortonworks.registries.schemaregistry.SchemaMetadataInfo) Test(org.junit.Test)

Example 4 with SchemaRegistryTestServerClientWrapper

use of com.hortonworks.registries.schemaregistry.avro.helper.SchemaRegistryTestServerClientWrapper in project registry by hortonworks.

the class KafkaAvroSerDesWithKafkaServerTest method beforeParam.

@CustomParameterizedRunner.BeforeParam
public static void beforeParam(SchemaRegistryTestProfileType schemaRegistryTestProfileType) throws Exception {
    SCHEMA_REGISTRY_TEST_SERVER_CLIENT_WRAPPER = new SchemaRegistryTestServerClientWrapper(schemaRegistryTestProfileType);
    SCHEMA_REGISTRY_TEST_SERVER_CLIENT_WRAPPER.startTestServer();
    CLUSTER = new EmbeddedKafkaCluster(1);
    CLUSTER.start();
}
Also used : SchemaRegistryTestServerClientWrapper(com.hortonworks.registries.schemaregistry.avro.helper.SchemaRegistryTestServerClientWrapper) EmbeddedKafkaCluster(org.apache.kafka.streams.integration.utils.EmbeddedKafkaCluster)

Example 5 with SchemaRegistryTestServerClientWrapper

use of com.hortonworks.registries.schemaregistry.avro.helper.SchemaRegistryTestServerClientWrapper in project registry by hortonworks.

the class CustomStateTransitionTest method startUp.

@Before
public void startUp() throws Exception {
    String serverYAMLPath = CustomStateTransitionTest.class.getClassLoader().getResource("registry-lifecycle-test-example.yaml").getPath();
    String clientYAMLPath = CustomStateTransitionTest.class.getClassLoader().getResource("registry-lifecycle-client.yaml").getPath();
    schemaRegistryTestServerClientWrapper = new SchemaRegistryTestServerClientWrapper(new SchemaRegistryTestConfiguration(serverYAMLPath, clientYAMLPath));
    schemaRegistryTestServerClientWrapper.startTestServer();
    schemaRegistryClient = schemaRegistryTestServerClientWrapper.getClient();
}
Also used : SchemaRegistryTestServerClientWrapper(com.hortonworks.registries.schemaregistry.avro.helper.SchemaRegistryTestServerClientWrapper) SchemaRegistryTestConfiguration(com.hortonworks.registries.schemaregistry.avro.conf.SchemaRegistryTestConfiguration) Before(org.junit.Before)

Aggregations

SchemaRegistryTestServerClientWrapper (com.hortonworks.registries.schemaregistry.avro.helper.SchemaRegistryTestServerClientWrapper)7 SchemaIdVersion (com.hortonworks.registries.schemaregistry.SchemaIdVersion)2 SchemaMetadata (com.hortonworks.registries.schemaregistry.SchemaMetadata)2 SchemaVersion (com.hortonworks.registries.schemaregistry.SchemaVersion)2 SchemaRegistryTestConfiguration (com.hortonworks.registries.schemaregistry.avro.conf.SchemaRegistryTestConfiguration)2 SchemaRegistryClient (com.hortonworks.registries.schemaregistry.client.SchemaRegistryClient)2 Before (org.junit.Before)2 Test (org.junit.Test)2 SchemaMetadataInfo (com.hortonworks.registries.schemaregistry.SchemaMetadataInfo)1 SchemaVersionKey (com.hortonworks.registries.schemaregistry.SchemaVersionKey)1 File (java.io.File)1 FileWriter (java.io.FileWriter)1 ArrayList (java.util.ArrayList)1 TestingServer (org.apache.curator.test.TestingServer)1 EmbeddedKafkaCluster (org.apache.kafka.streams.integration.utils.EmbeddedKafkaCluster)1