use of org.talend.dq.analysis.AnalysisHandler in project tdq-studio-se by Talend.
the class RedundancyAnalysisDetailsPage method getAnalysisHandler.
public AnalysisHandler getAnalysisHandler() {
AnalysisHandler analysisHandler = new AnalysisHandler();
analysisHandler.setAnalysis(getCurrentModelElement());
return analysisHandler;
}
use of org.talend.dq.analysis.AnalysisHandler in project tdq-studio-se by Talend.
the class AbstractFilterMetadataPage method getAnalysisHandler.
@Override
public AnalysisHandler getAnalysisHandler() {
AnalysisHandler analysisHandler = new AnalysisHandler();
analysisHandler.setAnalysis(getCurrentModelElement());
return analysisHandler;
}
use of org.talend.dq.analysis.AnalysisHandler in project tdq-studio-se by Talend.
the class MatchWizardTest method testInitCWMResourceBuilder.
/**
* Test method for
* {@link org.talend.dataprofiler.core.ui.wizard.analysis.column.MatchWizard#initCWMResourceBuilder()}.
*/
@Test
public void testInitCWMResourceBuilder() {
AnalysisParameter anaParameter = new AnalysisParameter();
// $NON-NLS-1$
anaParameter.setName("analysis1");
anaParameter.setAnalysisTypeName(AnalysisType.COLUMN.getName());
MatchWizard matchWizard = new MatchWizard(anaParameter);
// Default value should be 10000
Analysis ana = (Analysis) matchWizard.initCWMResourceBuilder();
AnalysisHandler anaHandler = AnalysisHandler.createHandler(ana);
IPreferenceStore preferenceStore = CorePlugin.getDefault().getPreferenceStore();
int maxRows = preferenceStore.getInt(PluginConstant.MAX_NB_ROWS_ANALYSIS_EDITOR);
Assert.assertEquals(String.valueOf(maxRows), anaHandler.getDefaultLoadedRowCount());
// after setting the value, result should be changed too
// $NON-NLS-1$
String rowCountValue = "100";
TaggedValueHelper.setTaggedValue(ana, TaggedValueHelper.PREVIEW_ROW_NUMBER, rowCountValue);
anaHandler = AnalysisHandler.createHandler(ana);
Assert.assertEquals(rowCountValue, anaHandler.getDefaultLoadedRowCount());
}
use of org.talend.dq.analysis.AnalysisHandler in project tdq-studio-se by Talend.
the class ResourceViewLabelProvider method decorateImage.
@Override
protected ImageDescriptor decorateImage(ImageDescriptor input, Object element) {
ImageDescriptor image = super.decorateImage(input, element);
if (element instanceof IFile) {
IFile file = (IFile) element;
String fileExtension = file.getFileExtension();
// MOD qiongli 2010-9-7,bug 14698,add 'try...catch'
try {
if (FactoriesUtil.isPatternFile(fileExtension)) {
image = ImageLib.getImageDescriptor(ImageLib.PATTERN_REG);
Pattern pattern = PatternResourceFileHelper.getInstance().findPattern(file);
if (pattern != null) {
if (!TaggedValueHelper.getValidStatus(pattern)) {
image = ImageLib.createInvalidIconDes(ImageLib.PATTERN_REG);
}
}
} else if (FactoriesUtil.isReportFile(fileExtension)) {
image = ImageLib.getImageDescriptor(ImageLib.REPORT_OBJECT);
} else if (FactoriesUtil.isUDIFile(fileExtension)) {
image = ImageLib.getImageDescriptor(ImageLib.IND_DEFINITION);
IndicatorDefinition udi = IndicatorResourceFileHelper.getInstance().findIndDefinition(file);
if (udi != null) {
boolean validStatus = TaggedValueHelper.getValidStatus(udi) | UDIHelper.isUDIValid(udi);
if (!validStatus) {
image = ImageLib.createInvalidIconDes(ImageLib.IND_DEFINITION);
}
}
} else if (FactoriesUtil.isAnalysisFile(fileExtension)) {
// ADD qiongli 2010-8-9,feature 14252
Analysis analysis = AnaResourceFileHelper.getInstance().findAnalysis(file);
if (analysis != null) {
AnalysisHandler analysisHandler = new AnalysisHandler();
analysisHandler.setAnalysis(analysis);
if (analysisHandler.getResultMetadata().getExecutionNumber() != 0) {
if (!analysisHandler.getResultMetadata().isLastRunOk()) {
image = ImageLib.createErrorIcon(image);
} else if (analysisHandler.getResultMetadata().isOutThreshold()) {
image = ImageLib.createInvalidIcon(image);
}
}
}
}
} catch (Exception exc) {
log.error(exc, exc);
image = ImageLib.getImageDescriptor(ImageLib.DELETE_ACTION);
}
if (FactoriesUtil.isEmfFile(fileExtension)) {
Property property = PropertyHelper.getProperty(file);
if (property != null) {
Item item = property.getItem();
Boolean lockByOthers = ProxyRepositoryManager.getInstance().isLockByOthers(item);
Boolean lockByUserOwn = ProxyRepositoryManager.getInstance().isLockByUserOwn(item);
if (lockByOthers || lockByUserOwn) {
// $NON-NLS-1$
log.info(property.getLabel() + " is locked");
image = ImageLib.createLockedIcon(image);
}
}
}
} else if (element instanceof IFolder) {
IFolder folder = (IFolder) element;
if (ResourceManager.isMetadataFolder(folder)) {
image = ImageLib.getImageDescriptor(ImageLib.METADATA);
} else if (ResourceManager.isLibrariesFolder(folder)) {
image = ImageLib.getImageDescriptor(ImageLib.LIBRARIES);
} else if (ResourceManager.isDataProfilingFolder(folder)) {
image = ImageLib.getImageDescriptor(ImageLib.DATA_PROFILING);
} else if (ResourceManager.isDBConnectionFolder(folder)) {
image = ImageLib.getImageDescriptor(ImageLib.CONNECTION);
} else if (ResourceManager.isExchangeFolder(folder)) {
image = ImageLib.getImageDescriptor(ImageLib.EXCHANGE);
} else if (ResourceManager.isFileDelimitedFolder(folder)) {
image = ImageLib.getImageDescriptor(ImageLib.FILE_DELIMITED);
}
}
return image;
}
use of org.talend.dq.analysis.AnalysisHandler in project tdq-studio-se by Talend.
the class TdqAnalysisConnectionPoolTest method setUp.
/**
* DOC yyin Comment method "setUp".
*
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
analysis = mock(Analysis.class);
AnalysisContext context = mock(AnalysisContext.class);
AnalysisResult result = mock(AnalysisResult.class);
dataManager = mock(org.talend.core.model.metadata.builder.connection.Connection.class);
ExecutionInformations resultMetadata = mock(ExecutionInformations.class);
PowerMockito.mockStatic(AnalysisHandler.class);
AnalysisHandler mockHandler = mock(AnalysisHandler.class);
when(AnalysisHandler.createHandler(analysis)).thenReturn(mockHandler);
when(mockHandler.getNumberOfConnectionsPerAnalysis()).thenReturn(5);
when(context.getConnection()).thenReturn(dataManager);
when(analysis.getContext()).thenReturn(context);
when(analysis.getResults()).thenReturn(result);
when(result.getResultMetadata()).thenReturn(resultMetadata);
connPool = new TdqAnalysisConnectionPool(analysis, 5);
}
Aggregations