Search in sources :

Example 31 with ISelectedTab

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;
        }
    }));
}
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)

Aggregations

ISelectedTab (com.qlangtech.tis.plugin.ds.ISelectedTab)31 IDataxProcessor (com.qlangtech.tis.datax.IDataxProcessor)14 Collectors (java.util.stream.Collectors)13 IDataxReader (com.qlangtech.tis.datax.IDataxReader)10 DTO (com.qlangtech.tis.realtime.transfer.DTO)10 List (java.util.List)8 StringUtils (org.apache.commons.lang.StringUtils)8 DataxReader (com.qlangtech.tis.datax.impl.DataxReader)7 Lists (com.google.common.collect.Lists)6 JSONObject (com.alibaba.fastjson.JSONObject)5 MQConsumeException (com.qlangtech.tis.async.message.client.consumer.MQConsumeException)5 ReaderSource (com.qlangtech.tis.realtime.ReaderSource)5 java.util (java.util)5 JobExecutionResult (org.apache.flink.api.common.JobExecutionResult)5 SinkFunction (org.apache.flink.streaming.api.functions.sink.SinkFunction)5 Maps (com.google.common.collect.Maps)4 SourceChannel (com.qlangtech.plugins.incr.flink.cdc.SourceChannel)4 TISDeserializationSchema (com.qlangtech.plugins.incr.flink.cdc.TISDeserializationSchema)4 IMQListener (com.qlangtech.tis.async.message.client.consumer.IMQListener)4 TargetResName (com.qlangtech.tis.coredefine.module.action.TargetResName)4