Search in sources :

Example 11 with StoreInfo

use of com.github.ambry.store.StoreInfo 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());
}
Also used : MockMessageWriteSet(com.github.ambry.store.MockMessageWriteSet) StoreGetOptions(com.github.ambry.store.StoreGetOptions) StoreInfo(com.github.ambry.store.StoreInfo) MessageInfo(com.github.ambry.store.MessageInfo) Test(org.junit.Test)

Aggregations

StoreInfo (com.github.ambry.store.StoreInfo)11 MessageInfo (com.github.ambry.store.MessageInfo)9 StoreGetOptions (com.github.ambry.store.StoreGetOptions)8 StoreException (com.github.ambry.store.StoreException)6 MockMessageWriteSet (com.github.ambry.store.MockMessageWriteSet)4 ArrayList (java.util.ArrayList)4 Store (com.github.ambry.store.Store)3 StoreKey (com.github.ambry.store.StoreKey)3 IOException (java.io.IOException)3 ByteBuffer (java.nio.ByteBuffer)3 Histogram (com.codahale.metrics.Histogram)2 CloudConfig (com.github.ambry.config.CloudConfig)2 StoreConfig (com.github.ambry.config.StoreConfig)2 MessageFormatException (com.github.ambry.messageformat.MessageFormatException)2 MessageFormatSend (com.github.ambry.messageformat.MessageFormatSend)2 Send (com.github.ambry.network.Send)2 ByteBufferOutputStream (com.github.ambry.utils.ByteBufferOutputStream)2 DataInputStream (java.io.DataInputStream)2 Test (org.junit.Test)2 Timer (com.codahale.metrics.Timer)1