File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
main/java/com/github/shyiko/mysql/binlog
test/java/com/github/shyiko/mysql/binlog Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,16 @@ public UUIDSet getUUIDSet(String uuid) {
8383 return map .get (uuid );
8484 }
8585
86+ /**
87+ * Add or replace the UUIDSet
88+ * @param uuidSet UUIDSet to be added
89+ * @return the old {@link UUIDSet} for the server given in uuidSet param,
90+ * or {@code null} if there are no UUIDSet for the given server.
91+ */
92+ public UUIDSet putUUIDSet (UUIDSet uuidSet ) {
93+ return map .put (uuidSet .getUUID (), uuidSet );
94+ }
95+
8696 /**
8797 * @param gtid GTID ("source_id:transaction_id")
8898 * @return whether or not gtid was added to the set (false if it was already there)
@@ -170,7 +180,7 @@ public static final class UUIDSet {
170180 private String uuid ;
171181 private List <Interval > intervals ;
172182
173- UUIDSet (String uuid , List <Interval > intervals ) {
183+ public UUIDSet (String uuid , List <Interval > intervals ) {
174184 this .uuid = uuid ;
175185 this .intervals = intervals ;
176186 if (intervals .size () > 1 ) {
@@ -339,7 +349,7 @@ public static final class Interval implements Comparable<Interval> {
339349 private long start ;
340350 private long end ;
341351
342- Interval (long start , long end ) {
352+ public Interval (long start , long end ) {
343353 this .start = start ;
344354 this .end = end ;
345355 }
Original file line number Diff line number Diff line change @@ -154,4 +154,14 @@ public void testMultipleIntervalsThatMayBeAdjacent() {
154154 assertEquals (gtidSet .toString (), UUID + ":1-199:1000-1033:1035-1036:1038-1039" );
155155 }
156156
157+ @ Test
158+ public void testPutUUIDSet () {
159+ GtidSet gtidSet = new GtidSet (UUID + ":1-191" );
160+ UUIDSet uuidSet = gtidSet .getUUIDSet (UUID );
161+ GtidSet gtidSet2 = new GtidSet (UUID + ":1-190" );
162+ UUIDSet uuidSet2 = gtidSet2 .getUUIDSet (UUID );
163+ gtidSet .putUUIDSet (uuidSet2 );
164+ assertEquals (gtidSet , gtidSet2 );
165+ }
166+
157167}
You can’t perform that action at this time.
0 commit comments