Search in sources :

Example 11 with ServiceConfiguration

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);
}
Also used : ServiceConfiguration(com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration)

Example 12 with ServiceConfiguration

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);
        }
    }
}
Also used : ServiceConfiguration(com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration) Service(com.hortonworks.streamline.streams.cluster.catalog.Service) StormMetadataService(com.hortonworks.streamline.streams.cluster.service.metadata.StormMetadataService) EnvironmentService(com.hortonworks.streamline.streams.cluster.service.EnvironmentService)

Example 13 with 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));
}
Also used : Expectations(mockit.Expectations) ServiceConfiguration(com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration) HashMap(java.util.HashMap) Cluster(com.hortonworks.streamline.streams.cluster.catalog.Cluster) EnvironmentService(com.hortonworks.streamline.streams.cluster.service.EnvironmentService) Service(com.hortonworks.streamline.streams.cluster.catalog.Service) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 14 with ServiceConfiguration

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));
}
Also used : ServiceConfiguration(com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration) Config(com.hortonworks.streamline.common.Config) Cluster(com.hortonworks.streamline.streams.cluster.catalog.Cluster) Service(com.hortonworks.streamline.streams.cluster.catalog.Service) Test(org.junit.Test)

Example 15 with ServiceConfiguration

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));
}
Also used : ServiceConfiguration(com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration) Config(com.hortonworks.streamline.common.Config) Cluster(com.hortonworks.streamline.streams.cluster.catalog.Cluster) Service(com.hortonworks.streamline.streams.cluster.catalog.Service) Test(org.junit.Test)

Aggregations

ServiceConfiguration (com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration)40 Service (com.hortonworks.streamline.streams.cluster.catalog.Service)21 Cluster (com.hortonworks.streamline.streams.cluster.catalog.Cluster)14 Test (org.junit.Test)13 HashMap (java.util.HashMap)12 Config (com.hortonworks.streamline.common.Config)11 EnvironmentService (com.hortonworks.streamline.streams.cluster.service.EnvironmentService)9 Component (com.hortonworks.streamline.streams.cluster.catalog.Component)8 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)7 ComponentProcess (com.hortonworks.streamline.streams.cluster.catalog.ComponentProcess)5 Map (java.util.Map)5 Timed (com.codahale.metrics.annotation.Timed)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 Path (javax.ws.rs.Path)4 ServiceConfigurationNotFoundException (com.hortonworks.streamline.streams.cluster.exception.ServiceConfigurationNotFoundException)3 ManualServiceRegistrar (com.hortonworks.streamline.streams.cluster.register.ManualServiceRegistrar)3 IOException (java.io.IOException)3 InputStream (java.io.InputStream)3 Collection (java.util.Collection)3 Collections (java.util.Collections)3