use of com.qlangtech.tis.manage.IAppSource 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;
}
}
use of com.qlangtech.tis.manage.IAppSource in project tis by qlangtech.
the class TestAddAppAction method testDoCreateCollection.
/**
* 测试创建
*
* @throws Exception
*/
public void testDoCreateCollection() throws Exception {
request.setParameter("emethod", "create_collection");
request.setParameter("action", "add_app_action");
try (InputStream content = this.getClass().getResourceAsStream("create_confirm_index_http_body.json")) {
assertNotNull(content);
request.setContent(IOUtils.toByteArray(content));
}
ITISCoordinator zkCoordinator = MockZKUtils.createZkMock();
MockZooKeeperGetter.mockCoordinator = zkCoordinator;
setCollection(TestSchemaAction.collection);
ActionProxy proxy = getActionProxy();
replay();
String result = proxy.execute();
assertEquals("AddAppAction_ajax", result);
AjaxValve.ActionExecResult aResult = showBizResult();
assertNotNull(aResult);
assertTrue(aResult.isSuccess());
verifyAll();
IAppSource appSource = IAppSource.load(null, TestSchemaAction.collection);
assertTrue(appSource instanceof SingleTableAppSource);
}
use of com.qlangtech.tis.manage.IAppSource in project tis by qlangtech.
the class TestStreamComponentCodeGenerator method testSingleTableCodeGenerator.
/**
* 测试单表增量脚本生成
*
* @throws Exception
*/
public void testSingleTableCodeGenerator() throws Exception {
// CoreAction.create
String topologyName = "employees4local";
String collectionName = "search4employee4local";
Optional<ERRules> erRule = ERRules.getErRule(topologyName);
IAppSource appSource = IAppSource.load(null, collectionName);
assertTrue(appSource instanceof SingleTableAppSource);
// 测试针对单表的的topology增量脚本生成
long timestamp = 20191111115959l;
SqlTaskNodeMeta.SqlDataFlowTopology topology = SqlTaskNodeMeta.getSqlDataFlowTopology(topologyName);
assertNotNull(topology);
if (!erRule.isPresent()) {
ERRules.createDefaultErRule(topology);
}
List<FacadeContext> facadeList = Lists.newArrayList();
StreamComponentCodeGenerator streamCodeGenerator = new StreamComponentCodeGenerator(collectionName, timestamp, facadeList, (IStreamIncrGenerateStrategy) appSource, true);
// EasyMock.replay(streamIncrGenerateStrategy);
streamCodeGenerator.build();
assertGenerateContentEqual(timestamp, collectionName, "S4employee4localListener.scala");
// EasyMock.verify(streamIncrGenerateStrategy);
}
use of com.qlangtech.tis.manage.IAppSource in project tis by qlangtech.
the class TestGenerateDAOAndIncrScript method getIndexStreamCodeGenerator.
private IndexStreamCodeGenerator getIndexStreamCodeGenerator() throws Exception {
IAppSource appSource = IAppSource.load(null, collection);
assertNotNull(appSource);
return new IndexStreamCodeGenerator(collection, (IBasicAppSource) appSource, dataflowTimestamp, (dbid, tables) -> {
assertTrue(tables.size() > 0);
return tables;
});
}
use of com.qlangtech.tis.manage.IAppSource in project tis by qlangtech.
the class TestS4EmployeeStreamComponentCodeGenerator method testGeneratorCode.
public void testGeneratorCode() throws Exception {
long timestamp = 20201111115959l;
String collectionName = "search4test";
String dfName = "current_dept_emp";
IAppSource appSource = IAppSource.load(null, collectionName);
assertNotNull(collectionName + " appSource can not be null", appSource);
FacadeContext fc = new FacadeContext();
fc.setFacadeInstanceName("employeesDAOFacade");
fc.setFullFacadeClassName("com.qlangtech.tis.realtime.employees.dao.IEmployeesDAOFacade");
fc.setFacadeInterfaceName("IEmployeesDAOFacade");
List<FacadeContext> facadeList = Lists.newArrayList();
facadeList.add(fc);
StreamComponentCodeGenerator streamCodeGenerator = new StreamComponentCodeGenerator(collectionName, timestamp, facadeList, (IStreamIncrGenerateStrategy) appSource);
// EasyMock.replay(streamIncrGenerateStrategy);
streamCodeGenerator.build();
TestStreamComponentCodeGenerator.assertGenerateContentEqual(timestamp, collectionName, "S4testListener.scala");
// EasyMock.verify(streamIncrGenerateStrategy);
}
Aggregations