Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ public ContainerDataProto getProtoBufMessage() {
builder.setContainerID(this.getContainerID());
builder.setContainerPath(this.getContainerPath());
builder.setState(this.getState());
builder.setBlockCount(this.getBlockCount());

for (Map.Entry<String, String> entry : getMetadata().entrySet()) {
ContainerProtos.KeyValue.Builder keyValBuilder =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -596,4 +596,31 @@ public void testDBProfileAffectsDBOptions() throws Exception {
Assert.assertNotEquals(outProfile1.getDBOptions().compactionReadaheadSize(),
outProfile2.getDBOptions().compactionReadaheadSize());
}

@Test
public void testKeyValueDataProtoBufMsg() throws Exception {
createContainer();
populate(10);
closeContainer();
ContainerProtos.ContainerDataProto proto =
keyValueContainerData.getProtoBufMessage();

assertEquals(keyValueContainerData.getContainerID(),
proto.getContainerID());
assertEquals(keyValueContainerData.getContainerType(),
proto.getContainerType());
assertEquals(keyValueContainerData.getContainerPath(),
proto.getContainerPath());
assertEquals(keyValueContainerData.getBlockCount(),
proto.getBlockCount());
assertEquals(keyValueContainerData.getBytesUsed(),
proto.getBytesUsed());
assertEquals(keyValueContainerData.getState(),
proto.getState());

for (ContainerProtos.KeyValue kv : proto.getMetadataList()) {
assertEquals(keyValueContainerData.getMetadata().get(kv.getKey()),
kv.getValue());
}
}
}