Search in sources :

Example 36 with HadoopClusterConnectionItem

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;
}
Also used : IComponentsService(org.talend.core.model.components.IComponentsService) IComponent(org.talend.core.model.components.IComponent) ArrayList(java.util.ArrayList) HadoopClusterConnectionItem(org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem)

Example 37 with HadoopClusterConnectionItem

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));
}
Also used : HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) HadoopClusterConnectionItem(org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem) Test(org.junit.Test)

Example 38 with HadoopClusterConnectionItem

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"));
}
Also used : HadoopClusterConnection(org.talend.repository.model.hadoopcluster.HadoopClusterConnection) HadoopClusterConnectionItem(org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem) Test(org.junit.Test)

Example 39 with HadoopClusterConnectionItem

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

Aggregations

HadoopClusterConnectionItem (org.talend.repository.model.hadoopcluster.HadoopClusterConnectionItem)39 HadoopClusterConnection (org.talend.repository.model.hadoopcluster.HadoopClusterConnection)28 DatabaseConnectionItem (org.talend.core.model.properties.DatabaseConnectionItem)11 HadoopSubConnectionItem (org.talend.repository.model.hadoopcluster.HadoopSubConnectionItem)10 Item (org.talend.core.model.properties.Item)9 ConnectionItem (org.talend.core.model.properties.ConnectionItem)7 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)6 DistributionBean (org.talend.hadoop.distribution.model.DistributionBean)6 ContextItem (org.talend.core.model.properties.ContextItem)5 IHDistributionVersion (org.talend.core.runtime.hd.IHDistributionVersion)5 Test (org.junit.Test)4 PersistenceException (org.talend.commons.exception.PersistenceException)4 Project (org.talend.core.model.general.Project)4 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)4 ArrayList (java.util.ArrayList)3 DatabaseConnection (org.talend.core.model.metadata.builder.connection.DatabaseConnection)3 Property (org.talend.core.model.properties.Property)3 HashSet (java.util.HashSet)2 Path (org.eclipse.core.runtime.Path)2 Connection (org.talend.core.model.metadata.builder.connection.Connection)2