use of com.hortonworks.streamline.streams.cluster.catalog.ComponentProcess in project streamline by hortonworks.
the class StormServiceRegistrar method createStormUIServerComponent.
private Pair<Component, List<ComponentProcess>> createStormUIServerComponent(Config config, Map<String, String> flattenConfigMap) {
if (!config.contains(PARAM_UI_HOST)) {
throw new IllegalArgumentException("Required parameter " + PARAM_UI_HOST + " not present.");
}
if (!config.contains(PARAM_UI_PORT)) {
throw new IllegalArgumentException("Required parameter " + PARAM_UI_PORT + " not present.");
}
String stormUiServerHost;
try {
stormUiServerHost = config.getString(PARAM_UI_HOST);
} catch (ClassCastException e) {
throw new IllegalArgumentException("Required parameter " + PARAM_UI_HOST + " should be a string.");
}
Number stormUiServerPort = readNumberFromConfig(config, PARAM_UI_PORT);
Component stormUiServer = new Component();
stormUiServer.setName(COMPONENT_STORM_UI_SERVER);
ComponentProcess uiProcess = new ComponentProcess();
uiProcess.setHost(stormUiServerHost);
uiProcess.setPort(stormUiServerPort.intValue());
return new Pair<>(stormUiServer, Collections.singletonList(uiProcess));
}
use of com.hortonworks.streamline.streams.cluster.catalog.ComponentProcess in project streamline by hortonworks.
the class KafkaServiceRegistrarTest method testRegisterWithoutOptionalParams.
@Test
public void testRegisterWithoutOptionalParams() 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, "PLAINTEXT://kafka-1:9092");
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());
assertEquals(1, brokerProcesses.size());
assertTrue(brokerProcesses.stream().anyMatch(p -> p.getHost().equals("kafka-1") && p.getPort().equals(9092) && p.getProtocol().equals("PLAINTEXT")));
ServiceConfiguration serverPropertiesConf = environmentService.getServiceConfigurationByName(kafkaService.getId(), CONFIGURATION_NAME_SERVER_PROPERTIES);
assertNotNull(serverPropertiesConf);
Map<String, String> serverPropertiesConfMap = serverPropertiesConf.getConfigurationMap();
assertFalse(serverPropertiesConfMap.containsKey(KafkaServiceRegistrar.PARAM_SECURITY_INTER_BROKER_PROTOCOL));
}
use of com.hortonworks.streamline.streams.cluster.catalog.ComponentProcess 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.ComponentProcess in project streamline by hortonworks.
the class ZookeeperMetadataService method getZookeeperServers.
public List<HostPort> getZookeeperServers() throws ServiceNotFoundException, ServiceComponentNotFoundException {
final Long serviceId = environmentService.getServiceIdByName(clusterId, STREAMS_JSON_SCHEMA_SERVICE_ZOOKEEPER);
if (serviceId == null) {
throw new ServiceNotFoundException(clusterId, ServiceConfigurations.ZOOKEEPER.name());
}
final Component zookeeperServer = environmentService.getComponentByName(serviceId, STREAMS_JSON_SCHEMA_COMPONENT_ZOOKEEPER_SERVER);
if (zookeeperServer == null) {
throw new ServiceComponentNotFoundException(clusterId, ServiceConfigurations.STORM.name(), ComponentPropertyPattern.ZOOKEEPER_SERVER.name());
}
final Collection<ComponentProcess> zookeeperServers = environmentService.listComponentProcesses(zookeeperServer.getId());
return zookeeperServers.stream().map(cp -> new HostPort(cp.getHost(), cp.getPort())).collect(Collectors.toList());
}
use of com.hortonworks.streamline.streams.cluster.catalog.ComponentProcess in project streamline by hortonworks.
the class StormMetadataServiceTest method buildUiComponentProcesses.
private List<ComponentProcess> buildUiComponentProcesses() {
ComponentProcess ui = new ComponentProcess();
ui.setHost("localhost");
ui.setPort(8080);
return Collections.singletonList(ui);
}
Aggregations