Search in sources :

Example 21 with DistributionVersion

use of org.talend.hadoop.distribution.model.DistributionVersion 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));
}
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) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean) Test(org.junit.Test)

Example 22 with DistributionVersion

use of org.talend.hadoop.distribution.model.DistributionVersion 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));
}
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 23 with DistributionVersion

use of org.talend.hadoop.distribution.model.DistributionVersion in project tbd-studio-se by Talend.

the class HadoopDistributionsHelperTest method testDistributionOnly.

private void testDistributionOnly(String distributionName, String distributionDisplay, String[][] supportVersions) {
    DistributionBean distribution = HadoopDistributionsHelper.HADOOP.getDistribution(distributionName, false);
    Assert.assertNotNull("Can't find the Distribution: " + distributionName, distribution);
    Assert.assertEquals(distributionName, distribution.name);
    Assert.assertEquals(distributionDisplay, distribution.displayName);
    Assert.assertNull("Because get all Hadoop distributions via HadoopComponent, so no ComponentType to be matched.", distribution.componentType);
    if (supportVersions != null) {
        for (String[] supportVersion : supportVersions) {
            String versionName = supportVersion[0];
            String versionDisplay = supportVersion[1];
            String hadoopVersion = supportVersion[2];
            DistributionVersion version = TestUtils.getDistributionVersion(distribution, versionDisplay);
            Assert.assertNotNull("No support of version : " + versionDisplay, version);
            Assert.assertEquals(versionName, version.version);
            Assert.assertEquals(versionDisplay, TestUtils.getVersionDisplayDeprecatedSuffixRemoved(version.displayVersion));
            Assert.assertEquals(distribution, version.distribution);
            Assert.assertNotNull(version.hadoopComponent);
            Assert.assertEquals(distributionName, version.hadoopComponent.getDistribution());
            Assert.assertEquals(distributionDisplay, version.hadoopComponent.getDistributionName());
            Assert.assertEquals(versionName, version.hadoopComponent.getVersion());
            Assert.assertEquals(versionDisplay, TestUtils.getVersionDisplayDeprecatedSuffixRemoved(version.hadoopComponent.getVersionName(distribution.componentType)));
            if (version.hadoopComponent.getHadoopVersion() != null) {
                Assert.assertEquals(hadoopVersion, version.hadoopComponent.getHadoopVersion().name());
            }
        }
    }
}
Also used : DistributionVersion(org.talend.hadoop.distribution.model.DistributionVersion) DistributionBean(org.talend.hadoop.distribution.model.DistributionBean)

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