RemoteBlobMetadata { public static HashMap<String, String> toSegmentMetadata(RemoteSegmentArchiveEntry indexEntry) { HashMap<String, String> map = new HashMap<>(); map.put(METADATA_TYPE, TYPE_SEGMENT); map.put(METADATA_SEGMENT_UUID, new UUID(indexEntry.getMsb(), indexEntry.getLsb()).toString()); map.put(METADATA_SEGMENT_POSITION, String.valueOf(indexEntry.getPosition())); map.put(METADATA_SEGMENT_GENERATION, String.valueOf(indexEntry.getGeneration())); map.put(METADATA_SEGMENT_FULL_GENERATION, String.valueOf(indexEntry.getFullGeneration())); map.put(METADATA_SEGMENT_COMPACTED, String.valueOf(indexEntry.isCompacted())); return map; }  static HashMap<String, String> toSegmentMetadata(RemoteSegmentArchiveEntry indexEntry); static RemoteSegmentArchiveEntry toIndexEntry(Map<String, String> metadata, int length); static boolean isSegment(Map<String, String> metadata); static final String METADATA_TYPE; static final String METADATA_SEGMENT_UUID; static final String METADATA_SEGMENT_POSITION; static final String METADATA_SEGMENT_GENERATION; static final String METADATA_SEGMENT_FULL_GENERATION; static final String METADATA_SEGMENT_COMPACTED; static final String TYPE_SEGMENT; }
@Test public void toSegmentMetadata() { RemoteSegmentArchiveEntry entry = new RemoteSegmentArchiveEntry(-7554506325726244935L, -5874985927363300041L, 3, 5, 50, 60, true); HashMap<String, String> map = RemoteBlobMetadata.toSegmentMetadata(entry); assertEquals("segment", map.get(RemoteBlobMetadata.METADATA_TYPE)); assertEquals("97290085-b1a5-4fb9-ae77-db6d13177537", map.get(RemoteBlobMetadata.METADATA_SEGMENT_UUID)); assertEquals("3", map.get(RemoteBlobMetadata.METADATA_SEGMENT_POSITION)); assertEquals("50", map.get(RemoteBlobMetadata.METADATA_SEGMENT_GENERATION)); assertEquals("60", map.get(RemoteBlobMetadata.METADATA_SEGMENT_FULL_GENERATION)); assertEquals("true", map.get(RemoteBlobMetadata.METADATA_SEGMENT_COMPACTED)); }