use of com.github.ambry.store.MockMessageWriteSet in project ambry by linkedin.
the class CloudBlobStoreIntegrationTest method testGet.
/**
* Test {@link CloudBlobStore#get} method.
*/
@Test
public void testGet() throws StoreException {
MockMessageWriteSet messageWriteSet = new MockMessageWriteSet();
addBlobToMessageSet(messageWriteSet, Utils.Infinite_Time, accountId, containerId, partitionId, operationTime, (short) 2);
cloudBlobStore.put(messageWriteSet);
// verify that the blob was uploaded with expected metadata.
StoreInfo storeInfo = cloudBlobStore.get(messageWriteSet.getMessageSetInfo().stream().map(MessageInfo::getStoreKey).collect(Collectors.toList()), EnumSet.allOf(StoreGetOptions.class));
assertEquals("Unexpected blob id", messageWriteSet.getMessageSetInfo().get(0).getStoreKey(), storeInfo.getMessageReadSetInfo().get(0).getStoreKey());
assertEquals("Unexpected live version", messageWriteSet.getMessageSetInfo().get(0).getLifeVersion(), storeInfo.getMessageReadSetInfo().get(0).getLifeVersion());
assertEquals("Unexpected delete status", messageWriteSet.getMessageSetInfo().get(0).isDeleted(), storeInfo.getMessageReadSetInfo().get(0).isDeleted());
assertEquals("Unexpected blob size", messageWriteSet.getMessageSetInfo().get(0).getSize(), storeInfo.getMessageReadSetInfo().get(0).getSize());
assertEquals("Unexpected ttl update status", messageWriteSet.getMessageSetInfo().get(0).isTtlUpdated(), storeInfo.getMessageReadSetInfo().get(0).isTtlUpdated());
assertEquals("Unexpected account id", messageWriteSet.getMessageSetInfo().get(0).getAccountId(), storeInfo.getMessageReadSetInfo().get(0).getAccountId());
assertEquals("Unexpected container id", messageWriteSet.getMessageSetInfo().get(0).getContainerId(), storeInfo.getMessageReadSetInfo().get(0).getContainerId());
assertEquals("Unexpected operation time", messageWriteSet.getMessageSetInfo().get(0).getOperationTimeMs(), storeInfo.getMessageReadSetInfo().get(0).getOperationTimeMs());
}
Aggregations