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;
}
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);
}
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);
}
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);
}
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);
}
Aggregations