Search in sources :

Example 1 with IAppSource

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

Example 2 with IAppSource

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);
}
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 3 with IAppSource

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

Example 4 with IAppSource

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;
    });
}
Also used : IAppSource(com.qlangtech.tis.manage.IAppSource)

Example 5 with IAppSource

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);
}
Also used : IAppSource(com.qlangtech.tis.manage.IAppSource)

Aggregations

IAppSource (com.qlangtech.tis.manage.IAppSource)6 SingleTableAppSource (com.qlangtech.tis.manage.impl.SingleTableAppSource)2 JSONObject (com.alibaba.fastjson.JSONObject)1 ActionProxy (com.opensymphony.xwork2.ActionProxy)1 ITISCoordinator (com.qlangtech.tis.cloud.ITISCoordinator)1 IDataxProcessor (com.qlangtech.tis.datax.IDataxProcessor)1 DataxProcessor (com.qlangtech.tis.datax.impl.DataxProcessor)1 Descriptor (com.qlangtech.tis.extension.Descriptor)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