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));
}
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;
}
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);
}
Aggregations