use of com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration in project streamline by hortonworks.
the class StormServiceRegistrar method createServiceConfigurations.
@Override
protected List<ServiceConfiguration> createServiceConfigurations(Config config) {
ServiceConfiguration storm = buildStormServiceConfiguration(config);
ServiceConfiguration stormEnv = buildStormEnvServiceConfiguration(config);
return Lists.newArrayList(storm, stormEnv);
}
use of com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration in project streamline by hortonworks.
the class ClusterCatalogResource method injectStormViewAsStormConfiguration.
private void injectStormViewAsStormConfiguration(Long clusterId, AmbariServiceNodeDiscoverer discoverer) {
Service stormService = environmentService.getServiceByName(clusterId, ServiceConfigurations.STORM.name());
if (stormService != null) {
// hack: find Storm View and inject to one of ServiceConfiguration for Storm service if available
String stormViewURL = discoverer.getStormViewUrl();
if (StringUtils.isNotEmpty(stormViewURL)) {
ServiceConfiguration serviceConfiguration = new ServiceConfiguration();
serviceConfiguration.setServiceId(stormService.getId());
serviceConfiguration.setName(StormMetadataService.SERVICE_STORM_VIEW);
serviceConfiguration.setConfiguration("{\"" + StormMetadataService.STORM_VIEW_CONFIGURATION_KEY_STORM_VIEW_URL + "\":\"" + stormViewURL + "\"}");
serviceConfiguration.setDescription("a hack to store Storm View URL");
environmentService.addServiceConfiguration(serviceConfiguration);
}
}
}
use of com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration in project streamline by hortonworks.
the class DruidSinkBundleHintProviderTest method getHintsOnCluster.
@Test
public void getHintsOnCluster() throws Exception {
ObjectMapper objectMapper = new ObjectMapper();
Cluster cluster = new Cluster();
cluster.setId(1L);
cluster.setName("cluster1");
Service service = new Service();
service.setId(1L);
service.setName(Constants.Druid.SERVICE_NAME);
Map<String, String> confMap = new HashMap<>();
confMap.put(Constants.Druid.PROPERTY_KEY_ZK_SERVICE_HOSTS, "svr1:2181,svr2:2181");
confMap.put(Constants.Druid.PROPERTY_KEY_INDEXING_SERVICE_NAME, "druid/overlord");
confMap.put(Constants.Druid.PROPERTY_KEY_DISCOVERY_CURATOR_PATH, "/discovery");
ServiceConfiguration serviceConfiguration = new ServiceConfiguration();
serviceConfiguration.setId(1L);
serviceConfiguration.setName(Constants.Druid.CONF_TYPE_COMMON_RUNTIME);
serviceConfiguration.setConfiguration(objectMapper.writeValueAsString(confMap));
new Expectations() {
{
environmentService.getServiceByName(cluster.getId(), Constants.Druid.SERVICE_NAME);
result = service;
environmentService.getServiceConfigurationByName(service.getId(), Constants.Druid.CONF_TYPE_COMMON_RUNTIME);
result = serviceConfiguration;
}
};
provider.init(environmentService);
Map<String, Object> hints = provider.getHintsOnCluster(cluster, null, null);
Assert.assertNotNull(hints);
Assert.assertEquals("svr1:2181,svr2:2181", hints.get(DruidSinkBundleHintProvider.FIELD_NAME_ZK_CONNECT));
Assert.assertEquals("druid/overlord", hints.get(DruidSinkBundleHintProvider.FIELD_NAME_INDEX_SERVICE));
Assert.assertEquals("/discovery", hints.get(DruidSinkBundleHintProvider.FIELD_NAME_DISCOVERY_PATH));
}
use of com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration in project streamline by hortonworks.
the class DruidServiceRegistrarTest method testRegister.
@Test
public void testRegister() throws Exception {
Cluster cluster = getTestCluster(1L);
DruidServiceRegistrar registerer = initializeServiceRegistrar();
Config config = new Config();
config.put(DruidServiceRegistrar.PARAM_ZOOKEEPER_CONNECTION_STRING, "zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181");
config.put(DruidServiceRegistrar.PARAM_INDEXING_SERVICE_NAME, "druid/overlord");
config.put(DruidServiceRegistrar.PARAM_DISCOVERY_CURATOR_PATH, "/prod/discovery");
registerer.register(cluster, config, Collections.emptyList());
Service druidService = environmentService.getServiceByName(cluster.getId(), Constants.Druid.SERVICE_NAME);
assertNotNull(druidService);
ServiceConfiguration commonRuntimePropertiesConf = environmentService.getServiceConfigurationByName(druidService.getId(), CONFIGURATION_NAME_COMMON_RUNTIME_PROPERTIES);
assertNotNull(commonRuntimePropertiesConf);
Map<String, String> confMap = commonRuntimePropertiesConf.getConfigurationMap();
assertEquals(config.get(DruidServiceRegistrar.PARAM_ZOOKEEPER_CONNECTION_STRING), confMap.get(DruidServiceRegistrar.PARAM_ZOOKEEPER_CONNECTION_STRING));
assertEquals(config.get(DruidServiceRegistrar.PARAM_INDEXING_SERVICE_NAME), confMap.get(DruidServiceRegistrar.PARAM_INDEXING_SERVICE_NAME));
assertEquals(config.get(DruidServiceRegistrar.PARAM_DISCOVERY_CURATOR_PATH), confMap.get(DruidServiceRegistrar.PARAM_DISCOVERY_CURATOR_PATH));
}
use of com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration in project streamline by hortonworks.
the class DruidServiceRegistrarTest method testRegisterWithoutOptionalParams.
@Test
public void testRegisterWithoutOptionalParams() throws Exception {
Cluster cluster = getTestCluster(1L);
DruidServiceRegistrar registerer = initializeServiceRegistrar();
Config config = new Config();
config.put(DruidServiceRegistrar.PARAM_ZOOKEEPER_CONNECTION_STRING, "zookeeper-1:2181,zookeeper-2:2181,zookeeper-3:2181");
registerer.register(cluster, config, Collections.emptyList());
Service druidService = environmentService.getServiceByName(cluster.getId(), Constants.Druid.SERVICE_NAME);
assertNotNull(druidService);
ServiceConfiguration commonRuntimePropertiesConf = environmentService.getServiceConfigurationByName(druidService.getId(), CONFIGURATION_NAME_COMMON_RUNTIME_PROPERTIES);
assertNotNull(commonRuntimePropertiesConf);
Map<String, String> confMap = commonRuntimePropertiesConf.getConfigurationMap();
assertEquals(config.get(DruidServiceRegistrar.PARAM_ZOOKEEPER_CONNECTION_STRING), confMap.get(DruidServiceRegistrar.PARAM_ZOOKEEPER_CONNECTION_STRING));
}
Aggregations