Commit 4886c7fb authored by Noel Alonso's avatar Noel Alonso
Browse files

Crea base común para tests de integración de kafka

Añade método para crear e iniciar servidor de schemaRegistry
parent 2b188a2f
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
package es.redmic.testutils.kafka;

import org.springframework.beans.factory.annotation.Value;

import es.redmic.testutils.schemaregistry.RestApp;
import io.confluent.kafka.schemaregistry.avro.AvroCompatibilityLevel;

public abstract class KafkaBaseIntegrationTest {

	@Value("${spring.kafka.properties.schema.registry.url}")
	protected String SCHEMA_REGISTRY_URL;

	protected RestApp restApp = null;

	protected void createSchemaRegistryRestApp(String zookeeperConnection, String brokers) throws Exception {

		restApp = new RestApp(Integer.parseInt(SCHEMA_REGISTRY_URL.split(":")[2]), SCHEMA_REGISTRY_URL,
				zookeeperConnection, brokers, AvroCompatibilityLevel.BACKWARD_TRANSITIVE.name);
		restApp.start();
	}
}