use of org.talend.dq.nodes.SourceFileSubFolderNode in project tdq-studio-se by Talend.
the class WorkspaceResourceHelperTest method testCheckSourceFileSubFolderNodeOpening.
/**
* Test method for
* {@link org.talend.dataprofiler.core.helper.WorkspaceResourceHelper#checkSourceFileSubFolderNodeOpening(org.talend.dq.nodes.SourceFileSubFolderNode)}
* .
*/
@Test
public void testCheckSourceFileSubFolderNodeOpening() {
SourceFileSubFolderNode folderNodeMock = mock(SourceFileSubFolderNode.class);
SourceFileRepNode nodeMock = mock(SourceFileRepNode.class);
List<IRepositoryNode> nodeList = new ArrayList<IRepositoryNode>();
nodeList.add(nodeMock);
when(folderNodeMock.getChildren()).thenReturn(nodeList);
boolean ok = Boolean.TRUE;
// $NON-NLS-1$
String msg = "msg";
ReturnCode rc = new ReturnCode(msg, ok);
// $NON-NLS-1$
stub(method(WorkspaceResourceHelper.class, "checkSourceFileNodeOpening", SourceFileRepNode.class)).toReturn(rc);
ReturnCode rc2 = WorkspaceResourceHelper.checkSourceFileSubFolderNodeOpening(folderNodeMock);
assertEquals(rc.isOk(), rc2.isOk());
assertEquals(rc.getMessage(), rc2.getMessage());
}
use of org.talend.dq.nodes.SourceFileSubFolderNode in project tdq-studio-se by Talend.
the class DQDeleteAction method checkSourceFilesEditorOpening.
/**
* DOC xqliu Comment method "checkSourceFilesEditorOpening".
*
* @param deleteElements
* @return
*/
@SuppressWarnings({ "hiding", "rawtypes", "unchecked" })
private Object[] checkSourceFilesEditorOpening(Object[] deleteElements) {
List list = new ArrayList();
boolean opened = false;
// $NON-NLS-1$
String openSourceFileNames = "";
for (Object obj : deleteElements) {
if (obj instanceof SourceFileRepNode || obj instanceof JrxmlTempleteRepNode) {
ReturnCode rc = WorkspaceResourceHelper.checkSourceFileNodeOpening((RepositoryNode) obj);
if (rc.isOk()) {
opened = rc.isOk();
openSourceFileNames += rc.getMessage();
} else {
list.add(obj);
}
} else if (obj instanceof SourceFileSubFolderNode || obj instanceof JrxmlTempSubFolderNode) {
ReturnCode rc = WorkspaceResourceHelper.checkSourceFileSubFolderNodeOpening((RepositoryNode) obj);
if (rc.isOk()) {
opened = rc.isOk();
openSourceFileNames += rc.getMessage();
} else {
list.add(obj);
}
} else {
list.add(obj);
}
}
if (opened) {
WorkspaceResourceHelper.showSourceFilesOpeningWarnMessages(openSourceFileNames);
}
return list.toArray();
}
Aggregations