use of com.hortonworks.streamline.streams.cluster.catalog.Cluster in project streamline by hortonworks.
the class KafkaServiceRegistrarTest method testRegister_component_zookeeper_connect_notPresent.
@Test
public void testRegister_component_zookeeper_connect_notPresent() throws Exception {
Cluster cluster = getTestCluster(1L);
KafkaServiceRegistrar registrar = initializeServiceRegistrar();
try {
Config config = new Config();
config.put(KafkaServiceRegistrar.PARAM_LISTENERS, "PLAINTEXT://kafka-1:9092");
config.put(KafkaServiceRegistrar.PARAM_SECURITY_INTER_BROKER_PROTOCOL, "SSL");
registrar.register(cluster, config, Collections.emptyList());
fail("Should throw IllegalArgumentException");
} catch (IllegalArgumentException e) {
// OK
Service kafkaService = environmentService.getServiceByName(cluster.getId(), Constants.Kafka.SERVICE_NAME);
assertNull(kafkaService);
}
}
use of com.hortonworks.streamline.streams.cluster.catalog.Cluster in project streamline by hortonworks.
the class KafkaServiceRegistrarTest method testRegister.
@Test
public void testRegister() throws Exception {
Cluster cluster = getTestCluster(1L);
KafkaServiceRegistrar registrar = initializeServiceRegistrar();
Config config = new Config();
config.put(KafkaServiceRegistrar.PARAM_ZOOKEEPER_CONNECT, "zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181");
config.put(KafkaServiceRegistrar.PARAM_LISTENERS, "SASL_PLAINTEXT://kafka-1:6668,PLAINTEXT://kafka-2:6669,SSL://kafka-3:6670,SASL_SSL://kafka-4:6671");
config.put(KafkaServiceRegistrar.PARAM_SECURITY_INTER_BROKER_PROTOCOL, "SSL");
registrar.register(cluster, config, Collections.emptyList());
Service kafkaService = environmentService.getServiceByName(cluster.getId(), Constants.Kafka.SERVICE_NAME);
assertNotNull(kafkaService);
Component broker = environmentService.getComponentByName(kafkaService.getId(), ComponentPropertyPattern.KAFKA_BROKER.name());
assertNotNull(broker);
Collection<ComponentProcess> brokerProcesses = environmentService.listComponentProcesses(broker.getId());
// we have 4 component processes according to listener
assertEquals(4, brokerProcesses.size());
assertTrue(brokerProcesses.stream().anyMatch(p -> p.getHost().equals("kafka-1") && p.getPort().equals(6668) && p.getProtocol().equals("SASL_PLAINTEXT")));
assertTrue(brokerProcesses.stream().anyMatch(p -> p.getHost().equals("kafka-2") && p.getPort().equals(6669) && p.getProtocol().equals("PLAINTEXT")));
assertTrue(brokerProcesses.stream().anyMatch(p -> p.getHost().equals("kafka-3") && p.getPort().equals(6670) && p.getProtocol().equals("SSL")));
assertTrue(brokerProcesses.stream().anyMatch(p -> p.getHost().equals("kafka-4") && p.getPort().equals(6671) && p.getProtocol().equals("SASL_SSL")));
ServiceConfiguration serverPropertiesConf = environmentService.getServiceConfigurationByName(kafkaService.getId(), CONFIGURATION_NAME_SERVER_PROPERTIES);
assertNotNull(serverPropertiesConf);
Map<String, String> serverPropertiesConfMap = serverPropertiesConf.getConfigurationMap();
assertEquals(config.get(KafkaServiceRegistrar.PARAM_SECURITY_INTER_BROKER_PROTOCOL), serverPropertiesConfMap.get(KafkaServiceRegistrar.PARAM_SECURITY_INTER_BROKER_PROTOCOL));
}
use of com.hortonworks.streamline.streams.cluster.catalog.Cluster in project streamline by hortonworks.
the class KafkaServiceRegistrarTest method testRegister_component_listeners_notPresent.
@Test
public void testRegister_component_listeners_notPresent() throws Exception {
Cluster cluster = getTestCluster(1L);
KafkaServiceRegistrar registrar = initializeServiceRegistrar();
try {
Config config = new Config();
config.put(KafkaServiceRegistrar.PARAM_ZOOKEEPER_CONNECT, "zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181");
config.put(KafkaServiceRegistrar.PARAM_SECURITY_INTER_BROKER_PROTOCOL, "SSL");
registrar.register(cluster, config, Collections.emptyList());
fail("Should throw IllegalArgumentException");
} catch (IllegalArgumentException e) {
// OK
Service kafkaService = environmentService.getServiceByName(cluster.getId(), Constants.Kafka.SERVICE_NAME);
assertNull(kafkaService);
}
}
use of com.hortonworks.streamline.streams.cluster.catalog.Cluster in project streamline by hortonworks.
the class HiveServiceRegistrarTest method testRegister_requiredPropertyNotPresent.
@Test
public void testRegister_requiredPropertyNotPresent() throws Exception {
Cluster cluster = getTestCluster(1L);
HiveServiceRegistrar registrar = initializeServiceRegistrar();
try (InputStream is = getClass().getClassLoader().getResourceAsStream(HIVE_SITE_XML_BADCASE_FILE_PATH)) {
ManualServiceRegistrar.ConfigFileInfo hiveSiteXml = new ManualServiceRegistrar.ConfigFileInfo(HIVE_SITE_XML, is);
registrar.register(cluster, new Config(), Lists.newArrayList(hiveSiteXml));
fail("Should throw IllegalArgumentException");
} catch (IllegalArgumentException e) {
// OK
Service hiveService = environmentService.getServiceByName(cluster.getId(), Constants.Hive.SERVICE_NAME);
assertNull(hiveService);
}
}
use of com.hortonworks.streamline.streams.cluster.catalog.Cluster in project streamline by hortonworks.
the class HiveServiceRegistrarTest method testRegister_hive_site_xml_notPresent.
@Test
public void testRegister_hive_site_xml_notPresent() throws Exception {
Cluster cluster = getTestCluster(1L);
HiveServiceRegistrar registrar = initializeServiceRegistrar();
try {
registrar.register(cluster, new Config(), Lists.newArrayList());
fail("Should throw IllegalArgumentException");
} catch (IllegalArgumentException e) {
// OK
Service hiveService = environmentService.getServiceByName(cluster.getId(), Constants.Hive.SERVICE_NAME);
assertNull(hiveService);
}
}
Aggregations