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) {
83
83
return map .get (uuid );
84
84
}
85
85
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
+
86
96
/**
87
97
* @param gtid GTID ("source_id:transaction_id")
88
98
* @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 {
170
180
private String uuid ;
171
181
private List <Interval > intervals ;
172
182
173
- UUIDSet (String uuid , List <Interval > intervals ) {
183
+ public UUIDSet (String uuid , List <Interval > intervals ) {
174
184
this .uuid = uuid ;
175
185
this .intervals = intervals ;
176
186
if (intervals .size () > 1 ) {
@@ -339,7 +349,7 @@ public static final class Interval implements Comparable<Interval> {
339
349
private long start ;
340
350
private long end ;
341
351
342
- Interval (long start , long end ) {
352
+ public Interval (long start , long end ) {
343
353
this .start = start ;
344
354
this .end = end ;
345
355
}
Original file line number Diff line number Diff line change @@ -154,4 +154,14 @@ public void testMultipleIntervalsThatMayBeAdjacent() {
154
154
assertEquals (gtidSet .toString (), UUID + ":1-199:1000-1033:1035-1036:1038-1039" );
155
155
}
156
156
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
+
157
167
}
You can’t perform that action at this time.
0 commit comments