Search in sources :

Example 1 with SingleTableAppSource

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);
}
Also used : ITISCoordinator(com.qlangtech.tis.cloud.ITISCoordinator) ActionProxy(com.opensymphony.xwork2.ActionProxy) InputStream(java.io.InputStream) IAppSource(com.qlangtech.tis.manage.IAppSource) SingleTableAppSource(com.qlangtech.tis.manage.impl.SingleTableAppSource) AjaxValve(com.qlangtech.tis.manage.common.valve.AjaxValve)

Example 2 with 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);
}
Also used : IAppSource(com.qlangtech.tis.manage.IAppSource) SingleTableAppSource(com.qlangtech.tis.manage.impl.SingleTableAppSource) SqlTaskNodeMeta(com.qlangtech.tis.sql.parser.SqlTaskNodeMeta) ERRules(com.qlangtech.tis.sql.parser.er.ERRules)

Aggregations

IAppSource (com.qlangtech.tis.manage.IAppSource)2 SingleTableAppSource (com.qlangtech.tis.manage.impl.SingleTableAppSource)2 ActionProxy (com.opensymphony.xwork2.ActionProxy)1 ITISCoordinator (com.qlangtech.tis.cloud.ITISCoordinator)1 AjaxValve (com.qlangtech.tis.manage.common.valve.AjaxValve)1 SqlTaskNodeMeta (com.qlangtech.tis.sql.parser.SqlTaskNodeMeta)1 ERRules (com.qlangtech.tis.sql.parser.er.ERRules)1 InputStream (java.io.InputStream)1