Search in sources :

Example 1 with HadoopComponent

use of org.talend.hadoop.distribution.component.HadoopComponent in project tbd-studio-se by Talend.

the class DistributionsManager method getDistributionsDelegate.

Map<String, DistributionBean> getDistributionsDelegate() {
    if (getServiceName() == null) {
        return new HashMap<String, DistributionBean>();
    }
    final ComponentType type = getComponentType();
    // We retrieve all the implementations of the HadoopComponent service.
    BundleContext bc = getBundleContext();
    Collection<ServiceReference<? extends HadoopComponent>> distributions = new LinkedList<>();
    try {
        Class<? extends HadoopComponent> clazz = (Class<? extends HadoopComponent>) Class.forName(getServiceName());
        distributions.addAll(bc.getServiceReferences(clazz, null));
    } catch (InvalidSyntaxException | ClassNotFoundException e) {
        CommonExceptionHandler.process(e);
        return new HashMap<String, DistributionBean>();
    }
    Map<String, DistributionBean> disctributionsMap = new HashMap<>();
    for (ServiceReference<? extends HadoopComponent> sr : distributions) {
        addDistribution(bc, disctributionsMap, type, sr);
    }
    return disctributionsMap;
}
Also used : ComponentType(org.talend.hadoop.distribution.ComponentType) HashMap(java.util.HashMap) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean) LinkedList(java.util.LinkedList) ServiceReference(org.osgi.framework.ServiceReference) HadoopComponent(org.talend.hadoop.distribution.component.HadoopComponent) InvalidSyntaxException(org.osgi.framework.InvalidSyntaxException) BundleContext(org.osgi.framework.BundleContext)

Example 2 with HadoopComponent

use of org.talend.hadoop.distribution.component.HadoopComponent in project tbd-studio-se by Talend.

the class AbstractTest4DefaultConfiguration method doTestExistedProperty.

protected void doTestExistedProperty(String value, String... keys) {
    assertTrue("Must provide the property key", keys != null && keys.length > 0);
    assertNotNull("Can't test the value for null", value);
    HadoopComponent hadoopComponent = getHadoopComponent();
    final String distribution = hadoopComponent.getDistribution();
    String version = hadoopComponent.getVersion();
    if (version == null) {
        version = "";
    }
    String[] keysWithDistribution = new String[keys.length + 1];
    keysWithDistribution[0] = distribution;
    System.arraycopy(keys, 0, keysWithDistribution, 1, keys.length);
    String defaultValue = hadoopComponent.getDefaultConfig(keysWithDistribution);
    StringBuffer keysPath = new StringBuffer();
    for (int i = 0; i < keys.length; i++) {
        keysPath.append(keys[i]);
        if (i < keys.length - 1) {
            // last one
            keysPath.append('/');
        }
    }
    String key = keysPath.toString();
    assertNotNull(MessageFormat.format("Can not found the default value for key \"{0}\" in \"{1} {2}\"", key, version, distribution), defaultValue);
    assertEquals(MessageFormat.format("The value are not expected for key \"{0}\" in \"{1} {2}\" ", key, version, distribution), value, defaultValue);
}
Also used : HadoopComponent(org.talend.hadoop.distribution.component.HadoopComponent)

Example 3 with HadoopComponent

use of org.talend.hadoop.distribution.component.HadoopComponent in project tbd-studio-se by Talend.

the class AbstractTest4DefaultConfiguration method before.

@Before
public void before() {
    HadoopComponent hadoopComponent = getHadoopComponent();
    assertNotNull("Can't load hadoop distribution", hadoopComponent);
}
Also used : HadoopComponent(org.talend.hadoop.distribution.component.HadoopComponent) Before(org.junit.Before)

Example 4 with HadoopComponent

use of org.talend.hadoop.distribution.component.HadoopComponent in project tbd-studio-se by Talend.

the class HDInsight40DefaultConfigurationTest method preTest.

@Before
public void preTest() {
    HadoopComponent hadoopComponent = getHadoopComponent();
    assertNotNull("Can't load hadoop distribution", hadoopComponent);
}
Also used : HadoopComponent(org.talend.hadoop.distribution.component.HadoopComponent) Before(org.junit.Before)

Example 5 with HadoopComponent

use of org.talend.hadoop.distribution.component.HadoopComponent in project tbd-studio-se by Talend.

the class HDInsight40DefaultConfigurationTest method testHive_NotSupport.

@Ignore
public void testHive_NotSupport() {
    HadoopComponent hadoopComponent = getHadoopComponent();
    String defaultValue = hadoopComponent.getDefaultConfig(hadoopComponent.getDistribution(), EHadoopCategory.HIVE.getName());
    assertTrue("Should not support for Hive", defaultValue == null);
}
Also used : HadoopComponent(org.talend.hadoop.distribution.component.HadoopComponent) Ignore(org.junit.Ignore)

Aggregations

HadoopComponent (org.talend.hadoop.distribution.component.HadoopComponent)20 Test (org.junit.Test)10 DistributionBean (org.talend.hadoop.distribution.model.DistributionBean)6 DistributionVersion (org.talend.hadoop.distribution.model.DistributionVersion)5 HCatalogComponent (org.talend.hadoop.distribution.component.HCatalogComponent)4 ImpalaComponent (org.talend.hadoop.distribution.component.ImpalaComponent)4 SparkBatchComponent (org.talend.hadoop.distribution.component.SparkBatchComponent)4 SparkStreamingComponent (org.talend.hadoop.distribution.component.SparkStreamingComponent)4 IHDistributionVersion (org.talend.core.runtime.hd.IHDistributionVersion)3 HBaseComponent (org.talend.hadoop.distribution.component.HBaseComponent)3 SparkComponent (org.talend.hadoop.distribution.component.SparkComponent)3 SqoopComponent (org.talend.hadoop.distribution.component.SqoopComponent)3 Before (org.junit.Before)2 BundleContext (org.osgi.framework.BundleContext)2 InvalidSyntaxException (org.osgi.framework.InvalidSyntaxException)2 AbstractDynamicDistributionTemplate (org.talend.hadoop.distribution.dynamic.template.AbstractDynamicDistributionTemplate)2 DynamicDistributionVersion (org.talend.hadoop.distribution.model.DynamicDistributionVersion)2 AbstractDistributionTest (org.talend.hadoop.distribution.test.AbstractDistributionTest)2 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1