Search in sources :

Example 76 with HadoopClusterConnection

use of org.talend.repository.model.hadoopcluster.HadoopClusterConnection in project tbd-studio-se by Talend.

the class HadoopConfsUtilsTest method testRenameContextGroups_contextMode.

@Test
public void testRenameContextGroups_contextMode() {
    HadoopClusterConnection hcConnection = (HadoopClusterConnection) hcConnectionItem.getConnection();
    hcConnection.setContextMode(true);
    // $NON-NLS-1$
    String oldContextGroup1 = "old";
    // $NON-NLS-1$
    String newContextGroup1 = "new";
    // $NON-NLS-1$
    byte[] jarContent1 = "jarcontent".getBytes();
    // $NON-NLS-1$
    String oldContextGroup2 = "old2";
    // $NON-NLS-1$
    byte[] jarContent2 = "jarcontent2".getBytes();
    hcConnection.getConfFiles().put(oldContextGroup1, jarContent1);
    hcConnection.getConfFiles().put(oldContextGroup2, jarContent2);
    Map<String, String> renamedMap = new HashMap<>();
    renamedMap.put(oldContextGroup1, newContextGroup1);
    assertTrue(HadoopConfsUtils.renameContextGroups(hcConnection, renamedMap));
    EMap<String, byte[]> newConfFiles = hcConnection.getConfFiles();
    assertEquals(2, newConfFiles.size());
    assertEquals(jarContent1, newConfFiles.get(newContextGroup1));
    assertEquals(jarContent2, newConfFiles.get(oldContextGroup2));
}
Also used : HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) Test(org.junit.Test)

Example 77 with HadoopClusterConnection

use of org.talend.repository.model.hadoopcluster.HadoopClusterConnection in project tbd-studio-se by Talend.

the class ClusterTestUtil method createHadoopClusterItem.

public static HadoopClusterConnectionItem createHadoopClusterItem(String name, boolean persistence) throws PersistenceException {
    IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
    HadoopClusterConnection connection = HadoopClusterFactory.eINSTANCE.createHadoopClusterConnection();
    Property connectionProperty = PropertiesFactory.eINSTANCE.createProperty();
    connectionProperty.setAuthor(ProjectManager.getInstance().getCurrentProject().getAuthor());
    connectionProperty.setVersion(VersionUtils.DEFAULT_VERSION);
    // $NON-NLS-1$
    connectionProperty.setStatusCode("");
    connectionProperty.setId(factory.getNextId());
    connectionProperty.setLabel(name + System.currentTimeMillis());
    HadoopClusterConnectionItem connectionItem = HadoopClusterFactory.eINSTANCE.createHadoopClusterConnectionItem();
    connectionItem.setProperty(connectionProperty);
    connectionItem.setConnection(connection);
    if (persistence) {
        // $NON-NLS-1$
        factory.create(connectionItem, new Path(""));
    }
    return connectionItem;
}
Also used : Path(org.eclipse.core.runtime.Path) HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) Property(org.talend.core.model.properties.Property) HadoopClusterConnectionItem(org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem) IProxyRepositoryFactory(org.talend.repository.model.IProxyRepositoryFactory)

Example 78 with HadoopClusterConnection

use of org.talend.repository.model.hadoopcluster.HadoopClusterConnection in project tbd-studio-se by Talend.

the class ChangeRepositoryValueFromCdhtoEmrTest method testExecute_cdh.

// test for TUP-17721 xwen
@Test
public void testExecute_cdh() {
    Property propertyCDH = PropertiesFactory.eINSTANCE.createProperty();
    IProcess2 processCDH = new Process(propertyCDH);
    IComponent sourceComCDH = ComponentsFactoryProvider.getInstance().get("tSparkConfiguration", ComponentCategory.CATEGORY_4_SPARK.getName());
    HadoopClusterConnection hadoopClusterConnection = HadoopClusterFactory.eINSTANCE.createHadoopClusterConnection();
    hadoopClusterConnection.setAuthMode("USERNAME");
    hadoopClusterConnection.setDfVersion("Cloudera_CDH5_8");
    hadoopClusterConnection.setDistribution("CLOUDERA");
    hadoopClusterConnection.setLabel("cdh");
    hadoopClusterConnection.setEnableKerberos(true);
    INode newElemCDH = new Node(sourceComCDH, processCDH);
    newElemCDH.getElementParameter("USE_KRB").setValue(new Boolean(true));
    ChangeValuesFromRepository changeValuesFromRepo = new ChangeValuesFromRepository(newElemCDH, hadoopClusterConnection, "MR_PROPERTY:REPOSITORY_PROPERTY_TYPE", "_31iU4GIREeegQqu8SjIMUw");
    changeValuesFromRepo.execute();
    assertEquals(newElemCDH.getElementParameter("USE_KRB").getValue(), true);
}
Also used : INode(org.talend.core.model.process.INode) IComponent(org.talend.core.model.components.IComponent) INode(org.talend.core.model.process.INode) Node(org.talend.designer.core.ui.editor.nodes.Node) IProcess2(org.talend.core.model.process.IProcess2) Process(org.talend.designer.core.ui.editor.process.Process) HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) Property(org.talend.core.model.properties.Property) Test(org.junit.Test)

Aggregations

HadoopClusterConnection (org.talend.repository.model.hadoopcluster.HadoopClusterConnection)78 HadoopClusterConnectionItem (org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem)30 Test (org.junit.Test)15 ContextItem (org.talend.core.model.properties.ContextItem)14 ContextType (org.talend.designer.core.model.utils.emf.talendfile.ContextType)13 DatabaseConnectionItem (org.talend.core.model.properties.DatabaseConnectionItem)9 ArrayList (java.util.ArrayList)7 Map (java.util.Map)7 Item (org.talend.core.model.properties.Item)7 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)7 DistributionBean (org.talend.hadoop.distribution.model.DistributionBean)7 ConnectionItem (org.talend.core.model.properties.ConnectionItem)6 HadoopSubConnectionItem (org.talend.repository.model.hadoopcluster.HadoopSubConnectionItem)6 File (java.io.File)5 IHDistributionVersion (org.talend.core.runtime.hd.IHDistributionVersion)5 HashMap (java.util.HashMap)4 HashSet (java.util.HashSet)4 List (java.util.List)4 PersistenceException (org.talend.commons.exception.PersistenceException)4 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)4