Search in sources :

Example 1 with DQDBFolderRepositoryNode

use of org.talend.dq.nodes.DQDBFolderRepositoryNode in project tdq-studio-se by Talend.

the class RepNodeUtilsTest method testIsValidSelectionForMatchAnalysis.

/**
 * Test: 1) when the selected node is: connection, catalog,schema, folder, will not be valid; 2) when the selected
 * nodes are: multiple table/views, multiple columns from different table/view, will not be valid; 3) when the
 * selected node is: one single table/view/file table,will be valid; 4) when the selected nodes are: multiple
 * columns from one same table/view, will be valid.
 */
@Test
public void testIsValidSelectionForMatchAnalysis() {
    // 1) when the selected node is: connection, catalog,schema, folder, will not be valid;
    List<IRepositoryNode> nodes = new ArrayList<IRepositoryNode>();
    ConnectionRepNode cNode = mock(ConnectionRepNode.class);
    nodes.add(cNode);
    Assert.assertFalse(RepNodeUtils.isValidSelectionFromSameTable(nodes));
    DBConnectionRepNode dbNode = mock(DBConnectionRepNode.class);
    nodes.clear();
    nodes.add(dbNode);
    Assert.assertFalse(RepNodeUtils.isValidSelectionFromSameTable(nodes));
    DBConnectionFolderRepNode dbfNode = mock(DBConnectionFolderRepNode.class);
    nodes.clear();
    nodes.add(dbfNode);
    Assert.assertFalse(RepNodeUtils.isValidSelectionFromSameTable(nodes));
    DQDBFolderRepositoryNode folderNode = mock(DQDBFolderRepositoryNode.class);
    nodes.clear();
    nodes.add(folderNode);
    Assert.assertFalse(RepNodeUtils.isValidSelectionFromSameTable(nodes));
    DBCatalogRepNode catalogNode = mock(DBCatalogRepNode.class);
    nodes.clear();
    nodes.add(catalogNode);
    Assert.assertFalse(RepNodeUtils.isValidSelectionFromSameTable(nodes));
    DBSchemaRepNode schemaNode = mock(DBSchemaRepNode.class);
    nodes.clear();
    nodes.add(schemaNode);
    Assert.assertFalse(RepNodeUtils.isValidSelectionFromSameTable(nodes));
}
Also used : DBConnectionRepNode(org.talend.dq.nodes.DBConnectionRepNode) ConnectionRepNode(org.talend.dq.nodes.ConnectionRepNode) DBConnectionRepNode(org.talend.dq.nodes.DBConnectionRepNode) DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) ArrayList(java.util.ArrayList) DQDBFolderRepositoryNode(org.talend.dq.nodes.DQDBFolderRepositoryNode) DBConnectionFolderRepNode(org.talend.dq.nodes.DBConnectionFolderRepNode) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 2 with DQDBFolderRepositoryNode

use of org.talend.dq.nodes.DQDBFolderRepositoryNode in project tdq-studio-se by Talend.

the class CatalogSchemaComparisonLevel method reloadCurrentLevelElement.

@Override
public Connection reloadCurrentLevelElement() throws ReloadCompareException {
    if (selectedObj instanceof DQDBFolderRepositoryNode) {
        DQDBFolderRepositoryNode columnFolderRepNode = (DQDBFolderRepositoryNode) selectedObj;
        columnFolderRepNode.setReload(true);
    }
    return super.reloadCurrentLevelElement();
}
Also used : DQDBFolderRepositoryNode(org.talend.dq.nodes.DQDBFolderRepositoryNode)

Example 3 with DQDBFolderRepositoryNode

use of org.talend.dq.nodes.DQDBFolderRepositoryNode in project tdq-studio-se by Talend.

the class TableViewComparisonLevel method reloadCurrentLevelElement.

@Override
public Connection reloadCurrentLevelElement() throws ReloadCompareException {
    if (selectedObj instanceof DQDBFolderRepositoryNode) {
        DQDBFolderRepositoryNode columnFolderRepNode = (DQDBFolderRepositoryNode) selectedObj;
        columnFolderRepNode.setReload(true);
    }
    return super.reloadCurrentLevelElement();
}
Also used : DQDBFolderRepositoryNode(org.talend.dq.nodes.DQDBFolderRepositoryNode)

Example 4 with DQDBFolderRepositoryNode

use of org.talend.dq.nodes.DQDBFolderRepositoryNode in project tdq-studio-se by Talend.

the class ColumnsSelectionDialog method handleTreeExpanded.

/**
 * Added TDQ-8718 20140506 yyin: when expand the nodes in the column select dialog, should refresh the table/view
 * folder. otherwise: if the parent catalog is checked before expanding, it may get no children(without connecting
 * to db) If the user has checked some high level node, must refresh the table/view folder node. otherwise, it
 * always return 0
 */
@Override
protected void handleTreeExpanded(TreeItem item) {
    Object node = item.getData();
    if (node instanceof DBCatalogRepNode || node instanceof DBSchemaRepNode) {
        TreeItem[] children = item.getItems();
        if (children != null) {
            for (TreeItem child : children) {
                Object data = child.getData();
                if (data != null) {
                    if (!(data instanceof DQDBFolderRepositoryNode)) {
                        break;
                    } else {
                        getTreeViewer().refresh(data, true);
                    }
                }
            }
        }
    }
    super.handleTreeExpanded(item);
}
Also used : DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) DBCatalogRepNode(org.talend.dq.nodes.DBCatalogRepNode) TreeItem(org.eclipse.swt.widgets.TreeItem) DQDBFolderRepositoryNode(org.talend.dq.nodes.DQDBFolderRepositoryNode)

Aggregations

DQDBFolderRepositoryNode (org.talend.dq.nodes.DQDBFolderRepositoryNode)4 DBCatalogRepNode (org.talend.dq.nodes.DBCatalogRepNode)2 DBSchemaRepNode (org.talend.dq.nodes.DBSchemaRepNode)2 ArrayList (java.util.ArrayList)1 TreeItem (org.eclipse.swt.widgets.TreeItem)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1 ConnectionRepNode (org.talend.dq.nodes.ConnectionRepNode)1 DBConnectionFolderRepNode (org.talend.dq.nodes.DBConnectionFolderRepNode)1 DBConnectionRepNode (org.talend.dq.nodes.DBConnectionRepNode)1 IRepositoryNode (org.talend.repository.model.IRepositoryNode)1