use of org.apache.druid.storage.azure.blob.ListBlobItemHolder in project druid by druid-io.
the class AzureStorageDruidModuleTest method testGetListBlobItemDruidFactoryCanCreateListBlobItemDruid.
@Test
public void testGetListBlobItemDruidFactoryCanCreateListBlobItemDruid() {
injector = makeInjectorWithProperties(PROPERTIES);
ListBlobItemHolderFactory factory = injector.getInstance(ListBlobItemHolderFactory.class);
ListBlobItemHolder object1 = factory.create(blobItem1);
ListBlobItemHolder object2 = factory.create(blobItem2);
Assert.assertNotNull(object1);
Assert.assertNotNull(object2);
Assert.assertNotSame(object1, object2);
}
use of org.apache.druid.storage.azure.blob.ListBlobItemHolder in project druid by druid-io.
the class AzureCloudBlobIteratorTest method test_next_emptyObjects_skipEmptyObjects.
@Test
public void test_next_emptyObjects_skipEmptyObjects() throws URISyntaxException, StorageException {
EasyMock.expect(config.getMaxTries()).andReturn(MAX_TRIES).atLeastOnce();
EasyMock.expect(cloudBlobItemPrefixWithOnlyCloudBlobs1.isCloudBlob()).andReturn(true);
EasyMock.expect(cloudBlobItemPrefixWithOnlyCloudBlobs1.getCloudBlob()).andReturn(cloudBlobDruidPrefixWithOnlyCloudBlobs1).anyTimes();
EasyMock.expect(blobItemDruidFactory.create(blobItemPrefixWithOnlyCloudBlobs1)).andReturn(cloudBlobItemPrefixWithOnlyCloudBlobs1);
ListBlobItem emptyBlobItem = createMock(ListBlobItem.class);
ListBlobItemHolder emptyBlobItemHolder = createMock(ListBlobItemHolder.class);
CloudBlobHolder emptyBlobHolder = createMock(CloudBlobHolder.class);
EasyMock.expect(emptyBlobHolder.getBlobLength()).andReturn(0L).anyTimes();
EasyMock.expect(emptyBlobItemHolder.isCloudBlob()).andReturn(true);
EasyMock.expect(emptyBlobItemHolder.getCloudBlob()).andReturn(emptyBlobHolder).anyTimes();
EasyMock.expect(blobItemDruidFactory.create(emptyBlobItem)).andReturn(emptyBlobItemHolder);
EasyMock.expect(storage.listBlobsWithPrefixInContainerSegmented(CONTAINER1, PREFIX_ONLY_CLOUD_BLOBS, nullResultContinuationToken, MAX_LISTING_LENGTH)).andReturn(resultSegmentPrefixOnlyAndFailLessThanMaxTriesCloudBlobs1);
EasyMock.expect(resultSegmentPrefixOnlyAndFailLessThanMaxTriesCloudBlobs1.getContinuationToken()).andReturn(nullResultContinuationToken);
ArrayList<ListBlobItem> resultBlobItemsPrefixWithOnlyCloudBlobs1 = new ArrayList<>();
resultBlobItemsPrefixWithOnlyCloudBlobs1.add(blobItemPrefixWithOnlyCloudBlobs1);
resultBlobItemsPrefixWithOnlyCloudBlobs1.add(emptyBlobItem);
EasyMock.expect(resultSegmentPrefixOnlyAndFailLessThanMaxTriesCloudBlobs1.getResults()).andReturn(resultBlobItemsPrefixWithOnlyCloudBlobs1);
replayAll();
azureCloudBlobIterator = new AzureCloudBlobIterator(storage, blobItemDruidFactory, config, ImmutableList.of(PREFIX_ONLY_CLOUD_BLOBS_URI), MAX_LISTING_LENGTH);
List<CloudBlobHolder> expectedBlobItems = ImmutableList.of(cloudBlobDruidPrefixWithOnlyCloudBlobs1);
List<CloudBlobHolder> actualBlobItems = Lists.newArrayList(azureCloudBlobIterator);
Assert.assertEquals(expectedBlobItems.size(), actualBlobItems.size());
Assert.assertTrue(expectedBlobItems.containsAll(actualBlobItems));
verifyAll();
}
Aggregations