Search in sources :

Example 1 with IStreamIncrGenerateStrategy

use of com.qlangtech.tis.sql.parser.tuple.creator.IStreamIncrGenerateStrategy in project plugins by qlangtech.

the class DefaultDataxProcessor method writerPluginOverwrite.

private <T> T writerPluginOverwrite(Function<IStreamIncrGenerateStrategy, T> func) {
    TISSinkFactory sinKFactory = TISSinkFactory.getIncrSinKFactory(this.identityValue());
    Objects.requireNonNull(sinKFactory, "writer plugin can not be null");
    if (sinKFactory instanceof IStreamIncrGenerateStrategy) {
        return func.apply(((IStreamIncrGenerateStrategy) sinKFactory));
    }
    return func.apply(this);
}
Also used : TISSinkFactory(com.qlangtech.tis.plugin.incr.TISSinkFactory) IStreamIncrGenerateStrategy(com.qlangtech.tis.sql.parser.tuple.creator.IStreamIncrGenerateStrategy)

Example 2 with IStreamIncrGenerateStrategy

use of com.qlangtech.tis.sql.parser.tuple.creator.IStreamIncrGenerateStrategy in project tis by qlangtech.

the class TestStreamComponentCodeGenerator method testGeneratorSearch4totalpay5Code.

public void testGeneratorSearch4totalpay5Code() throws Exception {
    long timestamp = 20200928183209l;
    IStreamIncrGenerateStrategy streamIncrGenerateStrategy = EasyMock.createMock("streamIncrGenerateStrategy", IStreamIncrGenerateStrategy.class);
    String collectionName = "search4totalpay5";
    SqlTaskNodeMeta.SqlDataFlowTopology topology = SqlTaskNodeMeta.getSqlDataFlowTopology("totalpay2");
    FacadeContext fc = new FacadeContext();
    fc.setFacadeInstanceName("order2DAOFacade");
    fc.setFullFacadeClassName("com.qlangtech.tis.realtime.order.dao.IOrder2DAOFacade");
    fc.setFacadeInterfaceName("IOrder2DAOFacade");
    List<FacadeContext> facadeList = Lists.newArrayList();
    facadeList.add(fc);
    StreamComponentCodeGenerator streamCodeGenerator = new StreamComponentCodeGenerator(collectionName, timestamp, facadeList, streamIncrGenerateStrategy);
    EasyMock.replay(streamIncrGenerateStrategy);
    streamCodeGenerator.build();
    assertGenerateContentEqual(timestamp, collectionName, "S4totalpay5Listener.scala");
    EasyMock.verify(streamIncrGenerateStrategy);
}
Also used : SqlTaskNodeMeta(com.qlangtech.tis.sql.parser.SqlTaskNodeMeta) IStreamIncrGenerateStrategy(com.qlangtech.tis.sql.parser.tuple.creator.IStreamIncrGenerateStrategy)

Example 3 with IStreamIncrGenerateStrategy

use of com.qlangtech.tis.sql.parser.tuple.creator.IStreamIncrGenerateStrategy in project tis by qlangtech.

the class TestTikvEmployee method testGeneratorCode.

public void testGeneratorCode() throws Exception {
    long timestamp = 20201111115959l;
    String collectionName = "search4employees";
    IStreamIncrGenerateStrategy streamIncrGenerateStrategy = EasyMock.createMock("streamIncrGenerateStrategy", IStreamIncrGenerateStrategy.class);
    String dfName = "tikv-employee";
    SqlTaskNodeMeta.SqlDataFlowTopology topology = SqlTaskNodeMeta.getSqlDataFlowTopology(dfName);
    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, streamIncrGenerateStrategy);
    EasyMock.replay(streamIncrGenerateStrategy);
    streamCodeGenerator.build();
    TestStreamComponentCodeGenerator.assertGenerateContentEqual(timestamp, collectionName, "S4employeesListener.scala");
    EasyMock.verify(streamIncrGenerateStrategy);
}
Also used : SqlTaskNodeMeta(com.qlangtech.tis.sql.parser.SqlTaskNodeMeta) IStreamIncrGenerateStrategy(com.qlangtech.tis.sql.parser.tuple.creator.IStreamIncrGenerateStrategy)

Example 4 with IStreamIncrGenerateStrategy

use of com.qlangtech.tis.sql.parser.tuple.creator.IStreamIncrGenerateStrategy in project tis by qlangtech.

the class TestStreamComponentCodeGenerator method testGeneratorCode.

public void testGeneratorCode() throws Exception {
    long timestamp = 20191111115959l;
    String collectionName = "search4totalpay";
    SqlTaskNodeMeta.SqlDataFlowTopology topology = SqlTaskNodeMeta.getSqlDataFlowTopology("totalpay");
    assertNotNull(topology);
    IStreamIncrGenerateStrategy streamIncrGenerateStrategy = EasyMock.createMock("streamIncrGenerateStrategy", IStreamIncrGenerateStrategy.class);
    FacadeContext fc = new FacadeContext();
    fc.setFacadeInstanceName("order2DAOFacade");
    fc.setFullFacadeClassName("com.qlangtech.tis.realtime.order.dao.IOrder2DAOFacade");
    fc.setFacadeInterfaceName("IOrder2DAOFacade");
    List<FacadeContext> facadeList = Lists.newArrayList();
    facadeList.add(fc);
    StreamComponentCodeGenerator streamCodeGenerator = new StreamComponentCodeGenerator("search4totalpay", timestamp, facadeList, streamIncrGenerateStrategy);
    EasyMock.replay(streamIncrGenerateStrategy);
    streamCodeGenerator.build();
    assertGenerateContentEqual(timestamp, collectionName, "S4totalpayListener.scala");
    EasyMock.verify(streamIncrGenerateStrategy);
}
Also used : SqlTaskNodeMeta(com.qlangtech.tis.sql.parser.SqlTaskNodeMeta) IStreamIncrGenerateStrategy(com.qlangtech.tis.sql.parser.tuple.creator.IStreamIncrGenerateStrategy)

Aggregations

IStreamIncrGenerateStrategy (com.qlangtech.tis.sql.parser.tuple.creator.IStreamIncrGenerateStrategy)4 SqlTaskNodeMeta (com.qlangtech.tis.sql.parser.SqlTaskNodeMeta)3 TISSinkFactory (com.qlangtech.tis.plugin.incr.TISSinkFactory)1