public static void startUp() throws Exception { LOCAL_SCHEMA_REGISTRY_SERVER = new LocalSchemaRegistryServer(SchemaLifecycleApp.class.getClassLoader().getResource("registry-lifecycle-example.yaml").getPath()); LOCAL_SCHEMA_REGISTRY_SERVER.start(); }
public int getAdminPort() { return this.localSchemaRegistryServer.getAdminPort(); }
public int getLocalPort() { return this.localSchemaRegistryServer.getLocalPort(); }
@Test public void testConfluentProduceRegistryConsume() throws Exception { String configPath = new File(Resources.getResource("schema-registry-test.yaml").toURI()).getAbsolutePath(); LocalSchemaRegistryServer localSchemaRegistryServer = new LocalSchemaRegistryServer(configPath); try { localSchemaRegistryServer.start(); final String confluentUrl = String.format("http://localhost:%d/api/v1/confluent", localSchemaRegistryServer.getLocalPort()); final String registryUrl = String.format("http://localhost:%d/api/v1", localSchemaRegistryServer.getLocalPort()); localSchemaRegistryServer.stop();
@Before public void setup() throws Exception { String configPath = new File(Resources.getResource("schema-registry-test.yaml").toURI()).getAbsolutePath(); localSchemaRegistryServer = new LocalSchemaRegistryServer(configPath); localSchemaRegistryServer.start(); String rootUrl = String.format("http://localhost:%d/api/v1/confluent", localSchemaRegistryServer.getLocalPort()); rootTarget = createRootTarget(rootUrl); }
public SchemaRegistryTestServerClientWrapper(SchemaRegistryTestConfiguration schemaRegistryTestConfiguration) throws URISyntaxException { this.schemaRegistryTestConfiguration = schemaRegistryTestConfiguration; localSchemaRegistryServer = new LocalSchemaRegistryServer(schemaRegistryTestConfiguration.getServerYAMLPath()); }
public void stopTestServer() throws Exception { localSchemaRegistryServer.stop(); }
public boolean hasLeadership() { return this.localSchemaRegistryServer.hasLeadership(); }
private Map<String, Object> createClientConf() { String registryURL = localSchemaRegistryServer.getLocalURL() + V1_API_PATH; if (schemaRegistryTestConfiguration.getClientYAMLPath() == null) { Map<String, Object> ret = new HashMap<>(); ret.put(SchemaRegistryClient.Configuration.SCHEMA_REGISTRY_URL.name(), registryURL); return ret; } try (FileInputStream fis = new FileInputStream(schemaRegistryTestConfiguration.getClientYAMLPath())) { Map<String, Object> ret = (Map<String, Object>) new Yaml().load(IOUtils.toString(fis, "UTF-8")); ret.put("schema.registry.url", registryURL); return ret; } catch(Exception e) { throw new RuntimeException("Failed to export schema client configuration for yaml : " + schemaRegistryTestConfiguration.getClientYAMLPath(), e); } } }
@Test public void testRegistryProduceConfluentConsume() throws Exception { String configPath = new File(Resources.getResource("schema-registry-test.yaml").toURI()).getAbsolutePath(); LocalSchemaRegistryServer localSchemaRegistryServer = new LocalSchemaRegistryServer(configPath); try { localSchemaRegistryServer.start(); final String confluentUrl = String.format("http://localhost:%d/api/v1/confluent", localSchemaRegistryServer.getLocalPort()); final String registryUrl = String.format("http://localhost:%d/api/v1", localSchemaRegistryServer.getLocalPort()); localSchemaRegistryServer.stop();
@After public void cleanup() throws Exception { if (localSchemaRegistryServer != null) { localSchemaRegistryServer.stop(); } }