use of com.qlangtech.tis.manage.impl.SingleTableAppSource 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.impl.SingleTableAppSource 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);
}
Aggregations