use of org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject in project tdq-studio-se by Talend.
the class AbstractCommonActionProviderRealProjectTest method testGetConnectionCase7.
/**
* Test method for
* {@link org.talend.dataprofiler.core.ui.action.provider.AbstractCommonActionProvider#getConnection(java.lang.Object)}
* . case7 :input parameter is DBViewFolderRepNode
*/
@Test
public void testGetConnectionCase7() {
// create FileConnection
// connection
IRepositoryViewObject lastVersion = null;
String propertyID = createConnectionItem(connectionName, null, null);
// $NON-NLS-1$
Catalog createCatalog = createCatalog("catalog1");
try {
lastVersion = factory.getLastVersion(propertyID);
lastVersion = new MetadataCatalogRepositoryObject(lastVersion, createCatalog);
} catch (PersistenceException e) {
log.error(e, e);
Assert.fail(e.getMessage());
}
// ~connection data
// ~FileConnection
// create DFColumnFolderRepNode
Assert.assertFalse(lastVersion == null);
RepositoryNode dbCatalogRepNode = DQRepNodeCreateFactory.createDBCatalogRepNode(lastVersion, null, ENodeType.TDQ_REPOSITORY_ELEMENT, null);
DBViewFolderRepNode dbViewFolderRepNode = new DBViewFolderRepNode(null, dbCatalogRepNode, null, null);
// ~DFColumnFolderRepNode
AbstractCommonActionProvider provider = new AbstractCommonActionProvider();
Connection connection = provider.getConnection(dbViewFolderRepNode);
Assert.assertTrue(connection != null);
}
use of org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject in project tdq-studio-se by Talend.
the class AbstractCommonActionProviderRealProjectTest method testGetConnectionCase4.
/**
* Test method for
* {@link org.talend.dataprofiler.core.ui.action.provider.AbstractCommonActionProvider#getConnection(java.lang.Object)}
* . case4 :input parameter is DBCatalogRepNode
*/
@Test
public void testGetConnectionCase4() {
// create FileConnection
// connection
IRepositoryViewObject lastVersion = null;
String propertyID = createConnectionItem(connectionName, null, null);
// $NON-NLS-1$
Catalog createCatalog = createCatalog("catalog1");
try {
lastVersion = factory.getLastVersion(propertyID);
lastVersion = new MetadataCatalogRepositoryObject(lastVersion, createCatalog);
} catch (PersistenceException e) {
log.error(e, e);
Assert.fail(e.getMessage());
}
// ~connection data
// ~FileConnection
// create DFColumnFolderRepNode
Assert.assertFalse(lastVersion == null);
RepositoryNode dbCatalogRepNode = DQRepNodeCreateFactory.createDBCatalogRepNode(lastVersion, null, null, null);
// ~DFColumnFolderRepNode
AbstractCommonActionProvider provider = new AbstractCommonActionProvider();
Connection connection = provider.getConnection(dbCatalogRepNode);
Assert.assertTrue(connection != null);
}
use of org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject in project tdq-studio-se by Talend.
the class CatalogAnalysisDPSelectionPage method addListeners.
@Override
protected void addListeners() {
addListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
Object object = ((IStructuredSelection) event.getSelection()).getFirstElement();
if (object instanceof Catalog) {
advanceToNextPageOrFinish();
}
}
});
addListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
try {
Object object = ((IStructuredSelection) event.getSelection()).getFirstElement();
PackagesAnalyisParameter catalogPanameter = (PackagesAnalyisParameter) getConnectionParams();
List<IRepositoryNode> nodes = new ArrayList<IRepositoryNode>();
if (object instanceof DBCatalogRepNode) {
DBCatalogRepNode catalogNode = (DBCatalogRepNode) object;
Catalog catalog = ((MetadataCatalogRepositoryObject) catalogNode.getObject()).getCatalog();
Connection tdProvider = ConnectionHelper.getTdDataProvider(SwitchHelpers.PACKAGE_SWITCH.doSwitch(catalog));
nodes.add(catalogNode);
if (tdProvider != null && catalogPanameter != null) {
catalogPanameter.setTdDataProvider(tdProvider);
catalogPanameter.setConnectionRepNode((DBConnectionRepNode) catalogNode.getParent());
catalogPanameter.setPackages(nodes);
}
setPageComplete(true);
} else {
setPageComplete(false);
}
} catch (Exception e) {
log.error(e, e);
}
}
});
}
use of org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject in project tdq-studio-se by Talend.
the class DBTableFolderRepNode method createParentNode.
/**
* create the node of parent.
*
* @return
*/
private RepositoryNode createParentNode() {
RepositoryNode dbParentRepNode = null;
if (viewObject instanceof MetadataCatalogRepositoryObject) {
dbParentRepNode = DQRepNodeCreateFactory.createDBCatalogRepNode(viewObject, null, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
} else if (viewObject instanceof MetadataSchemaRepositoryObject) {
dbParentRepNode = new DBSchemaRepNode(viewObject, null, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
}
viewObject.setRepositoryNode(dbParentRepNode);
return dbParentRepNode;
}
use of org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject in project tdq-studio-se by Talend.
the class DBTableFolderRepNode method getChildrenCount.
private int getChildrenCount() {
List<TdTable> tables = new ArrayList<TdTable>();
IRepositoryViewObject object = this.getParent().getObject();
if (object instanceof MetadataCatalogRepositoryObject) {
catalog = ((MetadataCatalogRepositoryObject) object).getCatalog();
tables = PackageHelper.getTables(catalog);
} else {
schema = ((MetadataSchemaRepositoryObject) object).getSchema();
tables = PackageHelper.getTables(schema);
}
return tables.size();
}
Aggregations