Search in sources :

Example 1 with DistributionVersion

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;
}
Also used : IElement(org.talend.core.model.process.IElement) DistributionVersion(org.talend.hadoop.distribution.model.DistributionVersion) SparkComponent(org.talend.hadoop.distribution.component.SparkComponent) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean)

Example 2 with DistributionVersion

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')))"));
}
Also used : ESparkVersion(org.talend.hadoop.distribution.ESparkVersion) DistributionVersion(org.talend.hadoop.distribution.model.DistributionVersion) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean) Ignore(org.junit.Ignore)

Example 3 with DistributionVersion

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));
}
Also used : IHDistributionVersion(org.talend.core.runtime.hd.IHDistributionVersion) DistributionVersion(org.talend.hadoop.distribution.model.DistributionVersion) SparkComponent(org.talend.hadoop.distribution.component.SparkComponent) HadoopComponent(org.talend.hadoop.distribution.component.HadoopComponent) SparkStreamingComponent(org.talend.hadoop.distribution.component.SparkStreamingComponent) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean) Test(org.junit.Test)

Example 4 with DistributionVersion

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;
}
Also used : DistributionVersion(org.talend.hadoop.distribution.model.DistributionVersion)

Example 5 with DistributionVersion

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;
}
Also used : DistributionVersion(org.talend.hadoop.distribution.model.DistributionVersion)

Aggregations

DistributionVersion (org.talend.hadoop.distribution.model.DistributionVersion)23 DistributionBean (org.talend.hadoop.distribution.model.DistributionBean)15 HadoopComponent (org.talend.hadoop.distribution.component.HadoopComponent)5 SparkComponent (org.talend.hadoop.distribution.component.SparkComponent)4 Test (org.junit.Test)3 IHDistributionVersion (org.talend.core.runtime.hd.IHDistributionVersion)3 HadoopClusterConnection (org.talend.repository.model.hadoopcluster.HadoopClusterConnection)3 ESparkVersion (org.talend.hadoop.distribution.ESparkVersion)2 SparkStreamingComponent (org.talend.hadoop.distribution.component.SparkStreamingComponent)2 AbstractDynamicDistributionTemplate (org.talend.hadoop.distribution.dynamic.template.AbstractDynamicDistributionTemplate)2 DynamicDistributionVersion (org.talend.hadoop.distribution.model.DynamicDistributionVersion)2 LinkedHashSet (java.util.LinkedHashSet)1 Map (java.util.Map)1 Set (java.util.Set)1 ModifyEvent (org.eclipse.swt.events.ModifyEvent)1 ModifyListener (org.eclipse.swt.events.ModifyListener)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Ignore (org.junit.Ignore)1 PersistenceException (org.talend.commons.exception.PersistenceException)1