@Test public void testModsWhileSyncing () { final TestDB one = new TestDB(), two = new TestDB(); Protocol.Session session = new Protocol.Session(new TestServer()) { @Override protected void onSyncSuccess (SyncDB db, Map<String,Integer> mods, Protocol.Response rsp) { if (rsp.cleanSync) { one.maxInt.update(50); one.maxLong.update(400L); } super.onSyncSuccess(db, mods, rsp); } @Override protected void onSyncFailure (SyncDB db, Throwable cause) { System.err.println("Sync failure " + cause); } }; one.trueBool.update(true); one.maxInt.update(42); one.serverString.update("foo"); session.sync(one); session.sync(two); assertEquals(Sets.newHashSet("maxInt", "maxLong"), one.getMods().keySet()); assertEquals(0, two.getMods().size()); }
public Map<String,Integer> getMods () { return new HashMap<String,Integer>(_mods); }
SyncDB { public Map<String,Integer> getMods () { return new HashMap<String,Integer>(_mods); } }
SyncDB { public Map<String,Integer> getMods () { return new HashMap<String,Integer>(_mods); } protected  SyncDB(Platform platform); }
SyncDB { public Map<String,Integer> getMods () { return new HashMap<String,Integer>(_mods); } protected  SyncDB(Platform platform); int version(); boolean hasUnsyncedChanges(); Map<String,String> getDelta(); Map<String,Integer> getMods(); void noteSync(int version, Map<String,Integer> syncedMods); boolean containsMerges(Map<String,String> delta); void applyDelta(int version, Map<String,String> delta); void prepareToMeld(); void processPurges(); }
SyncDB { public Map<String,Integer> getMods () { return new HashMap<String,Integer>(_mods); } protected  SyncDB(Platform platform); int version(); boolean hasUnsyncedChanges(); Map<String,String> getDelta(); Map<String,Integer> getMods(); void noteSync(int version, Map<String,Integer> syncedMods); boolean containsMerges(Map<String,String> delta); void applyDelta(int version, Map<String,String> delta); void prepareToMeld(); void processPurges();  }