Search in sources :

Example 6 with PropertyType

use of com.qlangtech.tis.extension.impl.PropertyType 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;
        }
    }));
}
Also used : RootFormProperties(com.qlangtech.tis.extension.impl.RootFormProperties) ISelectedTab(com.qlangtech.tis.plugin.ds.ISelectedTab) PropertyType(com.qlangtech.tis.extension.impl.PropertyType) IPropertyType(com.qlangtech.tis.extension.IPropertyType) DataxReader(com.qlangtech.tis.datax.impl.DataxReader) PluginFormProperties(com.qlangtech.tis.extension.PluginFormProperties) SuFormProperties(com.qlangtech.tis.extension.impl.SuFormProperties)

Example 7 with PropertyType

use of com.qlangtech.tis.extension.impl.PropertyType in project tis by qlangtech.

the class TestPluginItems method validatePropertyValue.

private void validatePropertyValue(Map<String, PropertyType> propertiesType, String key, Object value, DataxReader reader) {
    PropertyType pt = null;
    pt = propertiesType.get(key);
    assertNotNull(pt);
    assertEquals(value, pt.getVal(reader));
}
Also used : PropertyType(com.qlangtech.tis.extension.impl.PropertyType) IPropertyType(com.qlangtech.tis.extension.IPropertyType)

Aggregations

PropertyType (com.qlangtech.tis.extension.impl.PropertyType)7 JSONObject (com.alibaba.fastjson.JSONObject)4 Descriptor (com.qlangtech.tis.extension.Descriptor)4 PluginFormProperties (com.qlangtech.tis.extension.PluginFormProperties)4 JSONArray (com.alibaba.fastjson.JSONArray)3 IPropertyType (com.qlangtech.tis.extension.IPropertyType)3 SuFormProperties (com.qlangtech.tis.extension.impl.SuFormProperties)3 RocketMQListenerFactory (com.qlangtech.async.message.client.consumer.RocketMQListenerFactory)2 Describable (com.qlangtech.tis.extension.Describable)2 FormFieldType (com.qlangtech.tis.plugin.annotation.FormFieldType)2 Lists (com.google.common.collect.Lists)1 TIS (com.qlangtech.tis.TIS)1 MQListenerFactory (com.qlangtech.tis.async.message.client.consumer.impl.MQListenerFactory)1 DataxReader (com.qlangtech.tis.datax.impl.DataxReader)1 RootFormProperties (com.qlangtech.tis.extension.impl.RootFormProperties)1 Config (com.qlangtech.tis.manage.common.Config)1 IdentityName (com.qlangtech.tis.plugin.IdentityName)1 ISelectedTab (com.qlangtech.tis.plugin.ds.ISelectedTab)1 JsonUtil (com.qlangtech.tis.trigger.util.JsonUtil)1 HeteroList (com.qlangtech.tis.util.HeteroList)1