AbstractMetaStore implements MetaStore { public static ReplicationStoreMeta deserializeFromString(String str){ return Codec.DEFAULT.decode(str, ReplicationStoreMeta.class); } AbstractMetaStore(File baseDir, String keeperRunid); static ReplicationStoreMeta deserializeFromString(String str); @Override void updateKeeperRunid(String keeperRunid); @Override final ReplicationStoreMeta dupReplicationStoreMeta(); @Override final void loadMeta(); static ReplicationStoreMeta loadMetaCreateIfEmpty(File baseDir, String fileName); @Override void setRdbFileSize(long rdbFileSize); @Override ReplicationStoreMeta rdbUpdated(String rdbFile, EofType eofType, long rdbOffset); @Override void setMasterAddress(DefaultEndPoint endpoint); @Override boolean isFresh(); @Override void becomeActive(); @Override void becomeBackup(); @Override String toString();  }
@Test public void testDeserializeFromString() { ReplicationStoreMeta actual = metaStore.deserializeFromString(readFileAsString("src/test/resources/meta.json")); ReplicationStoreMeta expected = new ReplicationStoreMeta(); expected.setBeginOffset(539004786L); expected.setCmdFilePrefix("cmd_9116b193-9063-46f4-a677-04bcfe450171_"); expected.setKeeperRunid("20180118165046194-20180118165046194-294c90b4c9ed4d747a77b1b0f22ec28a8068013b"); expected.setKeeperState(KeeperState.BACKUP); expected.setMasterAddress(new DefaultEndPoint(new InetSocketAddress("10.2.24.215", 7379))); expected.setRdbFile("rdb_1589113559631_c58ed564-f393-4ca7-bb1e-9806e54a01bc"); expected.setReplId("4d6bc3b1c0d9f147a5c905f4b9275095102d4efd"); expected.setReplId2("0000000000000000000000000000000000000000"); expected.setSecondReplIdOffset(-1L); expected.setRdbLastOffset(539004785L); expected.setRdbFileSize(178); Assert.assertEquals(expected, actual); }