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