use of com.github.ambry.named.PutResult in project ambry by linkedin.
the class AmbryIdConverterFactoryTest method ambryIdConverterNamedBlobTest.
@Test
public void ambryIdConverterNamedBlobTest() throws Exception {
Properties properties = new Properties();
VerifiableProperties verifiableProperties = new VerifiableProperties(properties);
IdSigningService idSigningService = mock(IdSigningService.class);
NamedBlobDb namedBlobDb = mock(NamedBlobDb.class);
AmbryIdConverterFactory ambryIdConverterFactory = new AmbryIdConverterFactory(verifiableProperties, new MetricRegistry(), idSigningService, namedBlobDb);
IdConverter idConverter = ambryIdConverterFactory.getIdConverter();
assertNotNull("No IdConverter returned", idConverter);
PartitionId partitionId = new MockPartitionId(partition, MockClusterMap.DEFAULT_PARTITION_CLASS);
BlobId blobId = new BlobId(BLOB_ID_V6, BlobIdType.NATIVE, dataCenterId, accountId, containerId, partitionId, false, BlobDataType.DATACHUNK);
List<String> idList = new ArrayList<>();
idList.add(blobId.getID());
for (String id : idList) {
reset(idSigningService);
reset(namedBlobDb);
when(namedBlobDb.put(any())).thenReturn(CompletableFuture.completedFuture(new PutResult(new NamedBlobRecord("", "", "", id, Utils.Infinite_Time))));
testConversionForNamedBlob(idConverter, RestMethod.PUT, null, id, id);
verify(idSigningService, never()).getSignedId(any(), any());
verify(namedBlobDb).put(any());
}
}
Aggregations