Search in sources :

Example 1 with UUIDSet

use of com.alibaba.otter.canal.parse.driver.mysql.packets.UUIDSet in project canal by alibaba.

the class MysqlGTIDSetTest method buildForTest.

private MysqlGTIDSet buildForTest(List<Material> materials) {
    Map<String, UUIDSet> sets = new HashMap<>();
    for (Material a : materials) {
        UUIDSet.Interval interval = new UUIDSet.Interval();
        interval.start = a.start;
        interval.stop = a.stop;
        List<UUIDSet.Interval> intervals = new ArrayList<>();
        intervals.add(interval);
        if (a.start1 > 0 && a.stop1 > 0) {
            UUIDSet.Interval interval1 = new UUIDSet.Interval();
            interval1.start = a.start1;
            interval1.stop = a.stop1;
            intervals.add(interval1);
        }
        UUIDSet us = new UUIDSet();
        us.SID = UUID.fromString(a.uuid);
        us.intervals = intervals;
        sets.put(a.uuid, us);
    }
    MysqlGTIDSet gs = new MysqlGTIDSet();
    gs.sets = sets;
    return gs;
}
Also used : UUIDSet(com.alibaba.otter.canal.parse.driver.mysql.packets.UUIDSet) HashMap(java.util.HashMap) MysqlGTIDSet(com.alibaba.otter.canal.parse.driver.mysql.packets.MysqlGTIDSet) ArrayList(java.util.ArrayList)

Aggregations

MysqlGTIDSet (com.alibaba.otter.canal.parse.driver.mysql.packets.MysqlGTIDSet)1 UUIDSet (com.alibaba.otter.canal.parse.driver.mysql.packets.UUIDSet)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1