Search in sources :

Example 1 with Descriptor

use of com.qlangtech.tis.extension.Descriptor in project plugins by qlangtech.

the class HdfsFileSystemFactoryTestUtils method createHiveConnGetter.

public static IHiveConnGetter createHiveConnGetter() {
    Descriptor hiveConnGetter = TIS.get().getDescriptor("DefaultHiveConnGetter");
    Assert.assertNotNull(hiveConnGetter);
    // 使用hudi的docker运行环境 https://hudi.apache.org/docs/docker_demo#step-3-sync-with-hive
    Descriptor.FormData formData = new Descriptor.FormData();
    formData.addProp("name", "testhiveConn");
    formData.addProp("hiveAddress", "hiveserver:10000");
    formData.addProp("useUserToken", "true");
    formData.addProp("dbName", "default");
    formData.addProp("password", "hive");
    formData.addProp("userName", "hive");
    formData.addProp("metaStoreUrls", "thrift://hiveserver:9083");
    Descriptor.ParseDescribable<IHiveConnGetter> parseDescribable = hiveConnGetter.newInstance(HdfsFileSystemFactoryTestUtils.testDataXName.getName(), formData);
    Assert.assertNotNull(parseDescribable.instance);
    Assert.assertNotNull(parseDescribable.instance);
    return parseDescribable.instance;
}
Also used : Descriptor(com.qlangtech.tis.extension.Descriptor) IHiveConnGetter(com.qlangtech.tis.config.hive.IHiveConnGetter)

Example 2 with Descriptor

use of com.qlangtech.tis.extension.Descriptor in project plugins by qlangtech.

the class TestPlugin method testReceiceRequestFromClient.

public void testReceiceRequestFromClient() throws Exception {
    com.alibaba.fastjson.JSONArray jsonArray = null;
    com.alibaba.fastjson.JSONObject jsonObject = null;
    com.alibaba.fastjson.JSONObject valJ = null;
    String impl = null;
    PropertyType attrDesc = null;
    Descriptor descriptor = null;
    JSONArray vals = null;
    String attr = null;
    String attrVal = null;
    TIS tis = TIS.get();
    // IncrComponent incrComponent = tis.loadIncrComponent(collection);
    // incrComponent.setMqListenerFactory();
    Describable describable = null;
    try (InputStream input = TestPlugin.class.getResourceAsStream("RocketMQListenerFactory.json")) {
        assertNotNull(input);
        jsonArray = JSONArray.parseArray(IOUtils.toString(input, TisUTF8.getName()));
        for (int i = 0; i < jsonArray.size(); i++) {
            // 创建一个item
            jsonObject = jsonArray.getJSONObject(i);
            describable = (Describable) parseDescribable(jsonObject).instance;
        }
    }
    assertNotNull(describable);
    RocketMQListenerFactory mqListenerFactory = (RocketMQListenerFactory) describable;
    assertEquals(MQ_TOPIC, mqListenerFactory.getMqTopic());
    assertEquals(NamesrvAddr, mqListenerFactory.getNamesrvAddr());
    assertEquals(consumeId, mqListenerFactory.consumeName);
    assertNotNull(mqListenerFactory.getDeserialize());
}
Also used : Describable(com.qlangtech.tis.extension.Describable) InputStream(java.io.InputStream) JSONArray(com.alibaba.fastjson.JSONArray) PropertyType(com.qlangtech.tis.extension.impl.PropertyType) JSONArray(com.alibaba.fastjson.JSONArray) Descriptor(com.qlangtech.tis.extension.Descriptor) JSONObject(com.alibaba.fastjson.JSONObject) RocketMQListenerFactory(com.qlangtech.async.message.client.consumer.RocketMQListenerFactory) TIS(com.qlangtech.tis.TIS)

Example 3 with Descriptor

use of com.qlangtech.tis.extension.Descriptor in project plugins by qlangtech.

the class TestTISFlinkCDCOracleSourceFunction method createMySqlDataSourceFactory.

protected BasicDataSourceFactory createMySqlDataSourceFactory(TargetResName dataxName) {
    Descriptor mySqlV5DataSourceFactory = TIS.get().getDescriptor("OracleDataSourceFactory");
    Assert.assertNotNull(mySqlV5DataSourceFactory);
    Descriptor.FormData formData = new Descriptor.FormData();
    formData.addProp("name", "oracle");
    formData.addProp("dbName", oracleContainer.getSid());
    formData.addProp("nodeDesc", oracleContainer.getHost());
    // formData.addProp("password", OracleTestUtils.ORACLE_PWD);
    // formData.addProp("userName", OracleTestUtils.ORACLE_USER);
    formData.addProp("password", oracleContainer.getPassword());
    formData.addProp("userName", oracleContainer.getUsername());
    formData.addProp("port", String.valueOf(oracleContainer.getOraclePort()));
    formData.addProp("allAuthorized", "true");
    formData.addProp("asServiceName", "false");
    Descriptor.ParseDescribable<BasicDataSourceFactory> parseDescribable = mySqlV5DataSourceFactory.newInstance(dataxName.getName(), formData);
    Assert.assertNotNull(parseDescribable.instance);
    return parseDescribable.instance;
}
Also used : BasicDataSourceFactory(com.qlangtech.tis.plugin.ds.BasicDataSourceFactory) Descriptor(com.qlangtech.tis.extension.Descriptor)

Example 4 with Descriptor

use of com.qlangtech.tis.extension.Descriptor in project plugins by qlangtech.

the class TestFlinkCDCPostgreSQLSourceFunction method createPGDataSourceFactory.

protected BasicDataSourceFactory createPGDataSourceFactory(TargetResName dataxName) {
    Descriptor pgDataSourceFactory = TIS.get().getDescriptor("PGDataSourceFactory");
    Assert.assertNotNull(pgDataSourceFactory);
    Descriptor.FormData formData = new Descriptor.FormData();
    formData.addProp("name", "pg");
    formData.addProp("dbName", POSTGERS_CONTAINER.getDatabaseName());
    formData.addProp("nodeDesc", POSTGERS_CONTAINER.getContainerIpAddress());
    formData.addProp("password", POSTGERS_CONTAINER.getPassword());
    formData.addProp("userName", POSTGERS_CONTAINER.getUsername());
    formData.addProp("port", String.valueOf(POSTGERS_CONTAINER.getMappedPort(PostgreSQLContainer.POSTGRESQL_PORT)));
    formData.addProp("tabSchema", schemaName);
    formData.addProp("encode", "utf8");
    // formData.addProp("useCompression", "true");
    Descriptor.ParseDescribable<BasicDataSourceFactory> parseDescribable = pgDataSourceFactory.newInstance(dataxName.getName(), formData);
    Assert.assertNotNull(parseDescribable.instance);
    return parseDescribable.instance;
}
Also used : BasicDataSourceFactory(com.qlangtech.tis.plugin.ds.BasicDataSourceFactory) Descriptor(com.qlangtech.tis.extension.Descriptor)

Example 5 with Descriptor

use of com.qlangtech.tis.extension.Descriptor in project tis by qlangtech.

the class DataxProcessor method load.

public static DataxProcessor load(IPluginContext pluginContext, String dataXName) {
    if (processorGetter != null) {
        return processorGetter.get(dataXName);
    }
    Optional<DataxProcessor> appSource = IAppSource.loadNullable(pluginContext, dataXName);
    if (appSource.isPresent()) {
        return appSource.get();
    } else {
        Descriptor<IAppSource> pluginDescMeta = DataxProcessor.getPluginDescMeta();
        Map<String, com.alibaba.fastjson.JSONObject> /**
         * attr key
         */
        formData = new HashMap<String, com.alibaba.fastjson.JSONObject>() {

            @Override
            public JSONObject get(Object key) {
                JSONObject o = new JSONObject();
                o.put(Descriptor.KEY_primaryVal, null);
                return o;
            }
        };
        Descriptor.ParseDescribable<IAppSource> appSourceParseDescribable = pluginDescMeta.newInstance(pluginContext, formData, Optional.empty());
        return (DataxProcessor) appSourceParseDescribable.instance;
    }
}
Also used : IDataxProcessor(com.qlangtech.tis.datax.IDataxProcessor) JSONObject(com.alibaba.fastjson.JSONObject) IAppSource(com.qlangtech.tis.manage.IAppSource) Descriptor(com.qlangtech.tis.extension.Descriptor) JSONObject(com.alibaba.fastjson.JSONObject)

Aggregations

Descriptor (com.qlangtech.tis.extension.Descriptor)21 JSONObject (com.alibaba.fastjson.JSONObject)6 Lists (com.google.common.collect.Lists)6 Describable (com.qlangtech.tis.extension.Describable)6 java.util (java.util)6 TIS (com.qlangtech.tis.TIS)5 IPropertyType (com.qlangtech.tis.extension.IPropertyType)5 PluginFormProperties (com.qlangtech.tis.extension.PluginFormProperties)5 PropertyType (com.qlangtech.tis.extension.impl.PropertyType)5 SuFormProperties (com.qlangtech.tis.extension.impl.SuFormProperties)5 Collectors (java.util.stream.Collectors)5 Context (com.alibaba.citrus.turbine.Context)4 JSONArray (com.alibaba.fastjson.JSONArray)4 StringUtils (org.apache.commons.lang.StringUtils)4 IPluginEnum (com.qlangtech.tis.IPluginEnum)3 DataxReader (com.qlangtech.tis.datax.impl.DataxReader)3 IAppSource (com.qlangtech.tis.manage.IAppSource)3 Option (com.qlangtech.tis.manage.common.Option)3 DbScope (com.qlangtech.tis.offline.DbScope)3 OfflineDatasourceAction (com.qlangtech.tis.offline.module.action.OfflineDatasourceAction)3