use of org.talend.hadoop.distribution.component.SparkComponent 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.component.SparkComponent 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.component.SparkComponent in project tbd-studio-se by Talend.
the class DistributionHelperTest method test_doSupportService_HadoopComponent.
@Test
public void test_doSupportService_HadoopComponent() {
HadoopComponent hadoopComponent = Mockito.mock(HadoopComponent.class);
DistributionBean distribution = Mockito.mock(DistributionBean.class);
Assert.assertTrue(DistributionHelper.doSupportService(new DistributionVersion(hadoopComponent, distribution, "ABC_10", "Abc 1.0"), IHDConstants.SERVICE_HADOOP));
// because the SparkComponent is sub class of HadoopComponent
SparkComponent sparkComponent = Mockito.mock(SparkComponent.class);
Assert.assertTrue(DistributionHelper.doSupportService(new DistributionVersion(sparkComponent, distribution, "ABC_10", "Abc 1.0"), IHDConstants.SERVICE_HADOOP));
}
use of org.talend.hadoop.distribution.component.SparkComponent in project tbd-studio-se by Talend.
the class DistributionHelperTest method test_doSupportService_SparkComponent.
@Test
public void test_doSupportService_SparkComponent() {
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));
SparkComponent sparkComponent = Mockito.mock(SparkComponent.class);
Assert.assertTrue(DistributionHelper.doSupportService(new DistributionVersion(sparkComponent, distribution, "ABC_10", "Abc 1.0"), IHDConstants.SERVICE_SPARK));
// because the SparkStreamingComponent is sub class of SparkComponent
SparkStreamingComponent sparkStreamingComponent = Mockito.mock(SparkStreamingComponent.class);
Assert.assertTrue(DistributionHelper.doSupportService(new DistributionVersion(sparkStreamingComponent, distribution, "ABC_10", "Abc 1.0"), IHDConstants.SERVICE_SPARK));
}
Aggregations