use of org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem in project tbd-studio-se by Talend.
the class HadoopClusterDragAndDropHandler method filterNeededComponents.
@Override
public List<IComponent> filterNeededComponents(Item item, RepositoryNode seletetedNode, ERepositoryObjectType type) {
List<IComponent> neededComponents = new ArrayList<IComponent>();
if (!(item instanceof HadoopClusterConnectionItem)) {
return neededComponents;
}
IComponentsService service = GlobalServiceRegister.getDefault().getService(IComponentsService.class);
Collection<IComponent> components = service.getComponentsFactory().readComponents();
for (IComponent component : components) {
if (isValid(item, type, seletetedNode, component, HadoopClusterRepositoryNodeType.HADOOPCLUSTER.name()) && !neededComponents.contains(component)) {
neededComponents.add(component);
}
}
return neededComponents;
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem in project tbd-studio-se by Talend.
the class HCRepositoryUtilTest method testGetHadoopDbParameters.
@Test
public void testGetHadoopDbParameters() {
HadoopClusterConnectionItem hcItem = ClusterTestUtil.createDefaultHadoopClusterItem();
HadoopClusterConnection hcConnection = (HadoopClusterConnection) hcItem.getConnection();
String NAME_NODE = "namenode";
hcConnection.setNameNodeURI(NAME_NODE);
Map<String, String> dbParameters = HCRepositoryUtil.getHadoopDbParameters(hcItem);
assertEquals(NAME_NODE, dbParameters.get(ConnParameterKeys.CONN_PARA_KEY_NAME_NODE_URL));
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem in project tbd-studio-se by Talend.
the class HadoopClusterContextHandlerTest method testGetConAdditionPropertiesForContextMode.
@Test
public void testGetConAdditionPropertiesForContextMode() {
// $NON-NLS-1$
String hadoopPropertiesJsonStr = "[{\"PROPERTY\":\"hadoopProp\",\"VALUE\":\"hadoopPropValue\"}]";
// $NON-NLS-1$
String sparkPropertiesJsonStr = "[{\"PROPERTY\":\"sparkProp\",\"VALUE\":\"sparkPropValue\"}]";
HadoopClusterConnectionItem hadoopClusterItem = ClusterTestUtil.createDefaultHadoopClusterItem();
HadoopClusterConnection hadoopClusterConn = (HadoopClusterConnection) hadoopClusterItem.getConnection();
hadoopClusterConn.setHadoopProperties(hadoopPropertiesJsonStr);
hadoopClusterConn.setSparkProperties(sparkPropertiesJsonStr);
Set<String> additionProperties = contextHandler.getConAdditionPropertiesForContextMode(hadoopClusterConn);
// $NON-NLS-1$
assertTrue(additionProperties.contains("hadoopProp"));
// $NON-NLS-1$
assertTrue(additionProperties.contains("sparkProp"));
}
use of org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem 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;
}
Aggregations