use of org.talend.hadoop.distribution.model.DistributionBean in project tbd-studio-se by Talend.
the class CreateHCatalogAction method hideAction.
@Override
protected boolean hideAction(RepositoryNode node) {
HadoopClusterConnectionItem hcConnectionItem = HCRepositoryUtil.getHCConnectionItemFromRepositoryNode(node);
if (hcConnectionItem != null) {
HadoopClusterConnection hcConnection = (HadoopClusterConnection) hcConnectionItem.getConnection();
// First check if the Distribution is a HD Insight one.
DistributionBean hadoopDistribution = HadoopDistributionsHelper.HADOOP.getDistribution(hcConnection.getDistribution(), false);
if (hadoopDistribution != null) {
IHDistributionVersion hdVersion = hadoopDistribution.getHDVersion(hcConnection.getDfVersion(), false);
if (hdVersion != null && IMicrosoftHDInsightDistribution.DISTRIBUTION_NAME.equals(hdVersion.getDistribution().getName())) {
return false;
}
}
// If not, check if the Distribution implements HCatalogComponent
DistributionBean hcatalogDistribution = HadoopDistributionsHelper.HCATALOG.getDistribution(hcConnection.getDistribution(), false);
if (hcatalogDistribution != null) {
IHDistributionVersion hdVersion = hcatalogDistribution.getHDVersion(hcConnection.getDfVersion(), false);
if (hdVersion != null) {
// found, don't hide
return false;
}
}
}
return true;
}
use of org.talend.hadoop.distribution.model.DistributionBean in project tbd-studio-se by Talend.
the class ComponentConditionUtilTest method generateSparkVersionShowIfConditionsTest.
@Ignore
public void generateSparkVersionShowIfConditionsTest() {
assertNull(ComponentConditionUtil.generateSparkVersionShowIfConditions(null));
Map<ESparkVersion, Set<DistributionVersion>> sparkVersionsMap = new HashMap<>();
Set<DistributionVersion> distributionVersions = new LinkedHashSet<>();
distributionVersions.add(new DistributionVersion(null, new DistributionBean(ComponentType.SPARKBATCH, "DISTRIB1", ""), "VERSION1", // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
""));
sparkVersionsMap.put(ESparkVersion.SPARK_2_0, distributionVersions);
distributionVersions = new LinkedHashSet<>();
distributionVersions.add(new DistributionVersion(null, new DistributionBean(ComponentType.SPARKBATCH, "DISTRIB2", ""), "VERSION2", // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
""));
distributionVersions.add(new DistributionVersion(null, new DistributionBean(ComponentType.SPARKBATCH, "DISTRIB3", ""), "VERSION3", // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
""));
sparkVersionsMap.put(ESparkVersion.SPARK_1_6, distributionVersions);
String[] showIfs = ComponentConditionUtil.generateSparkVersionShowIfConditions(sparkVersionsMap);
assertTrue(showIfs.length == 2);
// $NON-NLS-1$
assertThat(Arrays.asList(showIfs), hasItem("(((DISTRIBUTION=='DISTRIB1') AND (SPARK_VERSION=='VERSION1')))"));
assertThat(Arrays.asList(showIfs), // $NON-NLS-1$
hasItem("(((DISTRIBUTION=='DISTRIB2') AND (SPARK_VERSION=='VERSION2')) OR ((DISTRIBUTION=='DISTRIB3') AND (SPARK_VERSION=='VERSION3')))"));
}
use of org.talend.hadoop.distribution.model.DistributionBean in project tbd-studio-se by Talend.
the class DistributionHelperTest method test_doSupportService_SparkStreamingComponent.
@Test
public void test_doSupportService_SparkStreamingComponent() {
HadoopComponent hadoopComponent = Mockito.mock(HadoopComponent.class);
DistributionBean distribution = Mockito.mock(DistributionBean.class);
Assert.assertFalse(DistributionHelper.doSupportService(new DistributionVersion(hadoopComponent, distribution, "ABC_10", "Abc 1.0"), IHDConstants.SERVICE_SPARK_STREAMING));
SparkComponent sparkComponent = Mockito.mock(SparkComponent.class);
Assert.assertFalse(DistributionHelper.doSupportService(new DistributionVersion(sparkComponent, distribution, "ABC_10", "Abc 1.0"), IHDConstants.SERVICE_SPARK_STREAMING));
SparkStreamingComponent sparkStreamingComponent = Mockito.mock(SparkStreamingComponent.class);
Assert.assertTrue(DistributionHelper.doSupportService(new DistributionVersion(sparkStreamingComponent, distribution, "ABC_10", "Abc 1.0"), IHDConstants.SERVICE_SPARK_STREAMING));
}
use of org.talend.hadoop.distribution.model.DistributionBean in project tbd-studio-se by Talend.
the class ImpalaDistributionsTest method testImpalaDistribution_Custom.
@Test
public void testImpalaDistribution_Custom() {
DistributionBean distribution = HadoopDistributionsHelper.IMPALA.getDistribution(ICustomDistribution.DISTRIBUTION_NAME, false);
Assert.assertNotNull(distribution);
String[] versionsDisplay = distribution.getVersionsDisplay();
// because custom without version.
Assert.assertTrue(versionsDisplay.length == 0);
}
use of org.talend.hadoop.distribution.model.DistributionBean in project tbd-studio-se by Talend.
the class ImpalaDistributionsTest method testImpalaDistribution_MapR.
@Test
public void testImpalaDistribution_MapR() {
DistributionBean distribution = HadoopDistributionsHelper.IMPALA.getDistribution(IMapRDistribution.DISTRIBUTION_NAME, false);
Assert.assertNotNull(distribution);
String[] versionsDisplay = distribution.getVersionsDisplay();
List<String> versions = Arrays.asList(versionsDisplay);
String message = "Should contain the version";
arrayContain(versions, "MapR 5.1.0(YARN mode)", message);
}
Aggregations