Search in sources :

Example 16 with Cluster

use of com.hortonworks.streamline.streams.cluster.catalog.Cluster in project streamline by hortonworks.

the class HBaseServiceRegistrarTest method testRegister_hbase_site_xml_notPresent.

@Test
public void testRegister_hbase_site_xml_notPresent() throws Exception {
    Cluster cluster = getTestCluster(1L);
    HBaseServiceRegistrar registrar = initializeServiceRegistrar();
    try {
        registrar.register(cluster, new Config(), Lists.newArrayList());
        fail("Should throw IllegalArgumentException");
    } catch (IllegalArgumentException e) {
        // OK
        Service hbaseService = environmentService.getServiceByName(cluster.getId(), Constants.HBase.SERVICE_NAME);
        assertNull(hbaseService);
    }
}
Also used : 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 17 with Cluster

use of com.hortonworks.streamline.streams.cluster.catalog.Cluster in project streamline by hortonworks.

the class HDFSServiceRegistrarTest method testRegister_requiredPropertyNotPresent.

@Test
public void testRegister_requiredPropertyNotPresent() throws Exception {
    Cluster cluster = getTestCluster(1L);
    HDFSServiceRegistrar registrar = initializeServiceRegistrar();
    try (InputStream coreSiteIs = getClass().getClassLoader().getResourceAsStream(CORE_SITE_XML_BADCASE_FILE_PATH);
        InputStream hdfsSiteIs = getClass().getClassLoader().getResourceAsStream(HDFS_SITE_XML_BADCASE_FILE_PATH)) {
        ManualServiceRegistrar.ConfigFileInfo coreSiteXml = new ManualServiceRegistrar.ConfigFileInfo(CORE_SITE_XML, coreSiteIs);
        ManualServiceRegistrar.ConfigFileInfo hdfsSiteXml = new ManualServiceRegistrar.ConfigFileInfo(HDFS_SITE_XML, hdfsSiteIs);
        registrar.register(cluster, new Config(), Lists.newArrayList(coreSiteXml, hdfsSiteXml));
        fail("Should throw IllegalArgumentException");
    } catch (IllegalArgumentException e) {
        // OK
        Service hdfsService = environmentService.getServiceByName(cluster.getId(), Constants.HDFS.SERVICE_NAME);
        assertNull(hdfsService);
    }
}
Also used : ManualServiceRegistrar(com.hortonworks.streamline.streams.cluster.register.ManualServiceRegistrar) InputStream(java.io.InputStream) 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 18 with Cluster

use of com.hortonworks.streamline.streams.cluster.catalog.Cluster in project streamline by hortonworks.

the class HDFSServiceRegistrarTest method testRegister_core_site_xml_notPresent.

@Test
public void testRegister_core_site_xml_notPresent() throws Exception {
    Cluster cluster = getTestCluster(1L);
    HDFSServiceRegistrar registrar = initializeServiceRegistrar();
    try (InputStream is = getClass().getClassLoader().getResourceAsStream(HDFS_SITE_XML_FILE_PATH)) {
        ManualServiceRegistrar.ConfigFileInfo hdfsSiteXml = new ManualServiceRegistrar.ConfigFileInfo(HDFS_SITE_XML, is);
        registrar.register(cluster, new Config(), Lists.newArrayList(hdfsSiteXml));
        fail("Should throw IllegalArgumentException");
    } catch (IllegalArgumentException e) {
        // OK
        Service hdfsService = environmentService.getServiceByName(cluster.getId(), Constants.HDFS.SERVICE_NAME);
        assertNull(hdfsService);
    }
}
Also used : ManualServiceRegistrar(com.hortonworks.streamline.streams.cluster.register.ManualServiceRegistrar) InputStream(java.io.InputStream) 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 19 with Cluster

use of com.hortonworks.streamline.streams.cluster.catalog.Cluster in project streamline by hortonworks.

the class HiveServiceRegistrarTest method testRegister.

@Test
public void testRegister() throws Exception {
    Cluster cluster = getTestCluster(1L);
    HiveServiceRegistrar registrar = initializeServiceRegistrar();
    try (InputStream is = getClass().getClassLoader().getResourceAsStream(HIVE_SITE_XML_FILE_PATH)) {
        ManualServiceRegistrar.ConfigFileInfo hiveSiteXml = new ManualServiceRegistrar.ConfigFileInfo(HIVE_SITE_XML, is);
        registrar.register(cluster, new Config(), Lists.newArrayList(hiveSiteXml));
    }
    Service hiveService = environmentService.getServiceByName(cluster.getId(), Constants.Hive.SERVICE_NAME);
    assertNotNull(hiveService);
    ServiceConfiguration coreSiteConf = environmentService.getServiceConfigurationByName(hiveService.getId(), CONFIGURATION_NAME_HIVE_SITE);
    assertNotNull(coreSiteConf);
}
Also used : ManualServiceRegistrar(com.hortonworks.streamline.streams.cluster.register.ManualServiceRegistrar) ServiceConfiguration(com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration) InputStream(java.io.InputStream) 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 20 with Cluster

use of com.hortonworks.streamline.streams.cluster.catalog.Cluster in project streamline by hortonworks.

the class StormServiceRegistrarTest method testRegisterWithoutOptionalParams.

@Test
public void testRegisterWithoutOptionalParams() throws Exception {
    Cluster cluster = getTestCluster(1L);
    StormServiceRegistrar registrar = initializeServiceRegistrar();
    Config config = new Config();
    config.put(StormServiceRegistrar.PARAM_NIMBUS_SEEDS, "storm-1,storm-2");
    config.put(StormServiceRegistrar.PARAM_NIMBUS_THRIFT_PORT, (Object) 6627);
    config.put(StormServiceRegistrar.PARAM_UI_HOST, "storm-1");
    config.put(StormServiceRegistrar.PARAM_UI_PORT, (Object) 8080);
    registrar.register(cluster, config, Collections.emptyList());
    Service stormService = environmentService.getServiceByName(cluster.getId(), Constants.Storm.SERVICE_NAME);
    assertNotNull(stormService);
    ServiceConfiguration stormYamlConf = environmentService.getServiceConfigurationByName(stormService.getId(), CONFIGURATION_NAME_STORM_YAML);
    assertNotNull(stormYamlConf);
    ServiceConfiguration stormEnvConf = environmentService.getServiceConfigurationByName(stormService.getId(), CONFIGURATION_NAME_STORM_ENV);
    assertNotNull(stormEnvConf);
    Map<String, String> confMap = stormEnvConf.getConfigurationMap();
    assertFalse(confMap.containsKey(StormServiceRegistrar.PARAM_NIMBUS_THRIFT_MAX_BUFFER_SIZE));
    assertFalse(confMap.containsKey(StormServiceRegistrar.PARAM_PRINCIPAL_TO_LOCAL));
    assertFalse(confMap.containsKey(StormServiceRegistrar.PARAM_THRIFT_TRANSPORT));
    assertFalse(confMap.containsKey(StormServiceRegistrar.PARAM_NIMBUS_PRINCIPAL_NAME));
}
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

Cluster (com.hortonworks.streamline.streams.cluster.catalog.Cluster)49 Service (com.hortonworks.streamline.streams.cluster.catalog.Service)31 Test (org.junit.Test)30 Config (com.hortonworks.streamline.common.Config)25 ServiceConfiguration (com.hortonworks.streamline.streams.cluster.catalog.ServiceConfiguration)15 ManualServiceRegistrar (com.hortonworks.streamline.streams.cluster.register.ManualServiceRegistrar)9 InputStream (java.io.InputStream)9 Timed (com.codahale.metrics.annotation.Timed)8 EnvironmentService (com.hortonworks.streamline.streams.cluster.service.EnvironmentService)8 Path (javax.ws.rs.Path)8 Expectations (mockit.Expectations)8 NamespaceServiceClusterMap (com.hortonworks.streamline.streams.cluster.catalog.NamespaceServiceClusterMap)7 Component (com.hortonworks.streamline.streams.cluster.catalog.Component)6 HashMap (java.util.HashMap)5 ComponentProcess (com.hortonworks.streamline.streams.cluster.catalog.ComponentProcess)4 Collection (java.util.Collection)4 Collections (java.util.Collections)4 Map (java.util.Map)4 POST (javax.ws.rs.POST)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3