Search in sources :

Example 6 with DistributionBean

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;
}
Also used : IHDistributionVersion(org.talend.core.runtime.hd.IHDistributionVersion) HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) HadoopClusterConnectionItem(org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean)

Example 7 with DistributionBean

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')))"));
}
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 8 with DistributionBean

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));
}
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 9 with DistributionBean

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

Example 10 with DistributionBean

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

Aggregations

DistributionBean (org.talend.hadoop.distribution.model.DistributionBean)29 DistributionVersion (org.talend.hadoop.distribution.model.DistributionVersion)15 Test (org.junit.Test)8 IHDistributionVersion (org.talend.core.runtime.hd.IHDistributionVersion)8 HadoopClusterConnection (org.talend.repository.model.hadoopcluster.HadoopClusterConnection)7 HadoopComponent (org.talend.hadoop.distribution.component.HadoopComponent)6 HadoopClusterConnectionItem (org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem)6 SparkComponent (org.talend.hadoop.distribution.component.SparkComponent)4 IHadoopDistributionService (org.talend.core.hadoop.IHadoopDistributionService)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 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)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 GridData (org.eclipse.swt.layout.GridData)1