use of org.talend.hadoop.distribution.model.DistributionVersion in project tbd-studio-se by Talend.
the class HadoopSubMultiRepTypeProcessor method isValidAttributes.
private boolean isValidAttributes(RepositoryNode node) {
if (node == null) {
return true;
}
if (attributesMap != null && !attributesMap.isEmpty()) {
HadoopClusterConnection hcConnection = HCRepositoryUtil.getRelativeHadoopClusterConnection(node.getId());
if (hcConnection != null) {
IElement elem = (IElement) attributesMap.get(ELEMENT);
DistributionBean hadoopDistribution = HadoopDistributionsHelper.HADOOP.getDistribution(hcConnection.getDistribution(), false);
if (hadoopDistribution != null) {
DistributionVersion distributionVersion = hadoopDistribution.getVersion(hcConnection.getDfVersion(), false);
if (distributionVersion != null && distributionVersion.hadoopComponent != null) {
boolean validated = true;
Object isSpark = attributesMap.get(ISSPARK);
if (isSpark != null && Boolean.valueOf(isSpark.toString())) {
validated = (validated && distributionVersion.hadoopComponent instanceof SparkComponent);
if (!validated) {
return false;
}
}
Object useYarn = attributesMap.get(USEYARN);
if (useYarn != null && Boolean.valueOf(useYarn.toString())) {
// CustomDistribution.doSupportSparkYarnClusterMode = true
if (ICustomDistribution.DISTRIBUTION_NAME.equals(distributionVersion.hadoopComponent.getDistribution())) {
validated = true;
} else {
validated = (validated && (distributionVersion.hadoopComponent.isHadoop2() || distributionVersion.hadoopComponent.isHadoop3()));
}
if (!validated) {
return false;
}
}
}
}
}
}
return true;
}
use of org.talend.hadoop.distribution.model.DistributionVersion 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.DistributionVersion 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.DistributionVersion in project tbd-studio-se by Talend.
the class StandardHCInfoForm method isCurrentHadoopVersionSupportMapRTicket.
private boolean isCurrentHadoopVersionSupportMapRTicket() {
boolean supportMapRTicket = false;
final DistributionVersion distributionVersion = getDistributionVersion();
if (distributionVersion != null && distributionVersion.hadoopComponent != null) {
supportMapRTicket = distributionVersion.hadoopComponent.doSupportMapRTicket();
}
return supportMapRTicket;
}
use of org.talend.hadoop.distribution.model.DistributionVersion in project tbd-studio-se by Talend.
the class StandardHCInfoForm method isCurrentHadoopVersionSupportWebHDFS.
private boolean isCurrentHadoopVersionSupportWebHDFS() {
boolean supportWebHDFS = false;
final DistributionVersion distributionVersion = getDistributionVersion();
if (distributionVersion != null && distributionVersion.hadoopComponent != null) {
supportWebHDFS = distributionVersion.hadoopComponent.doSupportWebHDFS();
}
return supportWebHDFS;
}
Aggregations