use of org.talend.dataprofiler.core.ui.wizard.indicator.forms.FormEnum in project tdq-studio-se by Talend.
the class InidcatorUnitTest method testGetFormsCase1.
/**
* Test method for {@link org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit#getForms()}.
*
* test case 1: Get Forms from ColumnSetIndicatorUnit
*/
@Test
public void testGetFormsCase1() {
RowCountIndicator rowCountIndicator = IndicatorsFactory.eINSTANCE.createRowCountIndicator();
IRepositoryViewObject rowCountRepositoryViewObject = null;
try {
List<IRepositoryViewObject> all = ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.SYSTEM_INDICATORS_SIMPLE_STATISTICS);
Assert.assertEquals(10, all.size());
rowCountRepositoryViewObject = all.get(7);
} catch (PersistenceException e) {
Assert.fail(e.getMessage());
}
Assert.assertNotNull(rowCountRepositoryViewObject);
TDQIndicatorDefinitionItem rowCountItem = (TDQIndicatorDefinitionItem) rowCountRepositoryViewObject.getProperty().getItem();
rowCountIndicator.setIndicatorDefinition(rowCountItem.getIndicatorDefinition());
ColumnSetIndicatorUnit columnSetIndicatorUnit = new ColumnSetIndicatorUnit(IndicatorEnum.RowCountIndicatorEnum, rowCountIndicator);
FormEnum[] forms = new FormEnum[] { FormEnum.IndicatorThresholdsForm };
FormEnum[] resultforms = columnSetIndicatorUnit.getForms();
Assert.assertEquals(forms.length, resultforms.length);
for (int index = 0; index < forms.length; index++) {
Assert.assertEquals(forms[index], resultforms[index]);
}
}
use of org.talend.dataprofiler.core.ui.wizard.indicator.forms.FormEnum in project tdq-studio-se by Talend.
the class DynamicIndicatorOptionsPage method createControl.
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
*/
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new FillLayout());
tabFolder = new TabFolder(container, SWT.FLAT);
tabFolder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Object formObject = e.item.getData();
if (formObject != null && getCurrentDialog() != null) {
AbstractIndicatorForm form = (AbstractIndicatorForm) formObject;
String helpHref = form.getFormEnum().getHelpHref();
getCurrentDialog().setHref(helpHref);
getCurrentDialog().showHelp();
}
}
});
FormEnum[] forms = FormEnum.getForms(indicatorUnit);
if (forms != null) {
validFroms = createForm(tabFolder, listener, forms);
setControl(createView(validFroms));
}
}
use of org.talend.dataprofiler.core.ui.wizard.indicator.forms.FormEnum in project tdq-studio-se by Talend.
the class DynamicTableIndicatorOptionsPage method createControl.
public void createControl(Composite parent) {
Composite container = new Composite(parent, SWT.NONE);
container.setLayout(new FillLayout());
tabFolder = new TabFolder(container, SWT.FLAT);
tabFolder.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Object formObject = e.item.getData();
if (formObject != null && getCurrentDialog() != null) {
AbstractIndicatorForm form = (AbstractIndicatorForm) formObject;
String helpHref = form.getFormEnum().getHelpHref();
getCurrentDialog().setHref(helpHref);
getCurrentDialog().showHelp();
}
}
});
FormEnum[] forms = FormEnum.getForms(indicatorUnit);
if (forms != null) {
validFroms = createForm(tabFolder, listener, forms);
setControl(createView(validFroms));
}
}
use of org.talend.dataprofiler.core.ui.wizard.indicator.forms.FormEnum in project tdq-studio-se by Talend.
the class InidcatorUnitTest method testGetFormsCase2.
/**
* Test method for {@link org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit#getForms()}.
*
* test case 2: Get Forms from TableIndicatorUnit
*/
@Test
public void testGetFormsCase2() {
RowCountIndicator rowCountIndicator = IndicatorsFactory.eINSTANCE.createRowCountIndicator();
IRepositoryViewObject rowCountRepositoryViewObject = null;
try {
List<IRepositoryViewObject> all = ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.SYSTEM_INDICATORS_SIMPLE_STATISTICS);
Assert.assertEquals(10, all.size());
rowCountRepositoryViewObject = all.get(7);
} catch (PersistenceException e) {
Assert.fail(e.getMessage());
}
Assert.assertNotNull(rowCountRepositoryViewObject);
TDQIndicatorDefinitionItem rowCountItem = (TDQIndicatorDefinitionItem) rowCountRepositoryViewObject.getProperty().getItem();
rowCountIndicator.setIndicatorDefinition(rowCountItem.getIndicatorDefinition());
ColumnIndicatorUnit columnIndicatorUnit = new ColumnIndicatorUnit(IndicatorEnum.RowCountIndicatorEnum, rowCountIndicator, null);
FormEnum[] forms = new FormEnum[] { FormEnum.IndicatorThresholdsForm };
FormEnum[] resultforms = columnIndicatorUnit.getForms();
Assert.assertEquals(forms.length, resultforms.length);
for (int index = 0; index < forms.length; index++) {
Assert.assertEquals(forms[index], resultforms[index]);
}
}
use of org.talend.dataprofiler.core.ui.wizard.indicator.forms.FormEnum in project tdq-studio-se by Talend.
the class InidcatorUnitTest method testGetFormsCase3.
/**
* Test method for {@link org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit#getForms()}.
*
* test case 3: Get Forms from ColumnIndicatorUnit
*/
@Test
public void testGetFormsCase3() {
RowCountIndicator rowCountIndicator = IndicatorsFactory.eINSTANCE.createRowCountIndicator();
IRepositoryViewObject rowCountRepositoryViewObject = null;
try {
List<IRepositoryViewObject> all = ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.SYSTEM_INDICATORS_SIMPLE_STATISTICS);
Assert.assertEquals(10, all.size());
rowCountRepositoryViewObject = all.get(7);
} catch (PersistenceException e) {
Assert.fail(e.getMessage());
}
Assert.assertNotNull(rowCountRepositoryViewObject);
TDQIndicatorDefinitionItem rowCountItem = (TDQIndicatorDefinitionItem) rowCountRepositoryViewObject.getProperty().getItem();
rowCountIndicator.setIndicatorDefinition(rowCountItem.getIndicatorDefinition());
TableIndicatorUnit TableIndicatorUnit = new TableIndicatorUnit(IndicatorEnum.RowCountIndicatorEnum, rowCountIndicator, null);
FormEnum[] forms = new FormEnum[] { FormEnum.IndicatorThresholdsForm };
FormEnum[] resultforms = TableIndicatorUnit.getForms();
Assert.assertEquals(forms.length, resultforms.length);
for (int index = 0; index < forms.length; index++) {
Assert.assertEquals(forms[index], resultforms[index]);
}
}
Aggregations