Search in sources :

Example 16 with DataMetaData

use of org.jumpmind.symmetric.model.DataMetaData in project symmetric-ds by JumpMind.

the class ColumnMatchDataRouterTest method testExpressionEqualsNodeId.

@Test
public void testExpressionEqualsNodeId() {
    ColumnMatchDataRouter router = new ColumnMatchDataRouter();
    SimpleRouterContext routingContext = new SimpleRouterContext();
    HashSet<Node> nodes = new HashSet<Node>();
    nodes.add(new Node("100", "client"));
    nodes.add(new Node("200", "client"));
    nodes.add(new Node("300", "client"));
    TriggerHistory triggerHist = new TriggerHistory("mytable", "ID", "ID,NODE_ID,COLUMN2");
    Data data = new Data();
    data.setDataId(1);
    data.setDataEventType(DataEventType.INSERT);
    data.setRowData("1,100,Super Dooper");
    data.setTriggerHistory(triggerHist);
    Table table = new Table();
    NodeChannel nodeChannel = new NodeChannel();
    Router route = new Router();
    route.setRouterExpression("NODE_ID = :NODE_ID");
    route.setRouterId("route1");
    DataMetaData dataMetaData = new DataMetaData(data, table, route, nodeChannel);
    Set<String> result = router.routeToNodes(routingContext, dataMetaData, nodes, false, false, null);
    assertEquals(1, result.size());
    assertEquals(true, result.contains("100"));
}
Also used : Table(org.jumpmind.db.model.Table) Node(org.jumpmind.symmetric.model.Node) Router(org.jumpmind.symmetric.model.Router) Data(org.jumpmind.symmetric.model.Data) DataMetaData(org.jumpmind.symmetric.model.DataMetaData) TriggerHistory(org.jumpmind.symmetric.model.TriggerHistory) NodeChannel(org.jumpmind.symmetric.model.NodeChannel) HashSet(java.util.HashSet) DataMetaData(org.jumpmind.symmetric.model.DataMetaData) Test(org.junit.Test)

Aggregations

DataMetaData (org.jumpmind.symmetric.model.DataMetaData)16 Data (org.jumpmind.symmetric.model.Data)15 TriggerHistory (org.jumpmind.symmetric.model.TriggerHistory)13 Table (org.jumpmind.db.model.Table)12 Test (org.junit.Test)12 HashSet (java.util.HashSet)11 Node (org.jumpmind.symmetric.model.Node)9 NodeChannel (org.jumpmind.symmetric.model.NodeChannel)9 Router (org.jumpmind.symmetric.model.Router)9 File (java.io.File)2 CsvData (org.jumpmind.symmetric.io.data.CsvData)2 ArrayList (java.util.ArrayList)1 SymmetricException (org.jumpmind.symmetric.SymmetricException)1 FileSnapshot (org.jumpmind.symmetric.model.FileSnapshot)1 FileTrigger (org.jumpmind.symmetric.model.FileTrigger)1 FileTriggerRouter (org.jumpmind.symmetric.model.FileTriggerRouter)1 TriggerRouter (org.jumpmind.symmetric.model.TriggerRouter)1 DelayRoutingException (org.jumpmind.symmetric.route.DelayRoutingException)1 IDataRouter (org.jumpmind.symmetric.route.IDataRouter)1 IContextService (org.jumpmind.symmetric.service.IContextService)1