use of com.qlangtech.tis.plugin.ds.ISelectedTab in project tis by qlangtech.
the class TestPluginItems method validatePluginValue.
private void validatePluginValue() throws Exception {
DataxReader reader = readerStore.getPlugin();
assertNotNull(reader);
PluginFormProperties rootPropertyTypes = reader.getDescriptor().getPluginFormPropertyTypes();
assertTrue("get RootFormProperties process result", rootPropertyTypes.accept(new PluginFormProperties.IVisitor() {
@Override
public Boolean visit(RootFormProperties props) {
Map<String, PropertyType> propertiesType = props.propertiesType;
validatePropertyValue(propertiesType, "dbName", "order1", reader);
validatePropertyValue(propertiesType, "splitPk", true, reader);
// validatePropertyValue(propertiesType, "template"
// , IOUtils.loadResourceFromClasspath(TestPluginItems.class, "datax_reader_mysql_prop_template.json"), reader);
assertEquals(3, propertiesType.size());
return true;
}
}));
Optional<IPropertyType.SubFormFilter> subFormFilter = subFieldPluginMeta.getSubFormFilter();
assertTrue(subFormFilter.isPresent());
PluginFormProperties pluginFormPropertyTypes = reader.getDescriptor().getPluginFormPropertyTypes(subFormFilter);
assertTrue("get SuFormProperties process result", pluginFormPropertyTypes.accept(new PluginFormProperties.IVisitor() {
@Override
public Boolean visit(SuFormProperties props) {
assertEquals("selectedTabs", props.getSubFormFieldName());
Map<String, PropertyType> fieldsType = props.fieldsType;
assertEquals(3, fieldsType.size());
List<ISelectedTab> selectedTabs = reader.getSelectedTabs();
assertNotNull("selectedTabs can not be null", selectedTabs);
assertEquals(1, selectedTabs.size());
ISelectedTab selectedTab = selectedTabs.get(0);
assertEquals("customer_order_relation", selectedTab.getName());
assertEquals("1=999", selectedTab.getWhere());
List<ISelectedTab.ColMeta> cols = selectedTab.getCols();
assertEquals(5, cols.size());
Set<String> selectedCols = Sets.newHashSet("customerregister_id", "waitingorder_id", "kind", "create_time", "last_ver");
cols.forEach((c) -> assertTrue(selectedCols.contains(c.getName())));
return true;
}
}));
}
Aggregations