use of com.hortonworks.streamline.streams.cluster.catalog.Cluster in project streamline by hortonworks.
the class AbstractBundleHintProviderTest method createDummyCluster.
private Cluster createDummyCluster(long id, String clusterName) {
Cluster cluster = new Cluster();
cluster.setId(id);
cluster.setName(clusterName);
return cluster;
}
use of com.hortonworks.streamline.streams.cluster.catalog.Cluster 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.Cluster in project streamline by hortonworks.
the class HBaseBundleHintProviderTest method testGetHintsOnCluster.
// FIXME: below hint needs to access HBase and currently it doesn't work with secure cluster
// FIXME: hence can't add HBase sink to the topology
// FIXME: so we should mark this test to ignore until it is fixed
@Ignore
@Test
public void testGetHintsOnCluster() throws Exception {
List<String> tables = Lists.newArrayList("test1", "test2", "test3");
new Expectations() {
{
hbaseMetadataService.getHBaseTables();
result = new Tables(tables);
}
};
Cluster cluster = new Cluster();
cluster.setId(1L);
cluster.setName("cluster1");
Map<String, Object> hints = provider.getHintsOnCluster(cluster, null, null);
Assert.assertNotNull(hints);
Assert.assertEquals(1, hints.size());
Assert.assertEquals(tables, hints.get(HBaseBundleHintProvider.FIELD_NAME_TABLE));
new Verifications() {
{
hbaseMetadataService.getHBaseTables();
}
};
}
use of com.hortonworks.streamline.streams.cluster.catalog.Cluster 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.Cluster 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