suneet-s commented on a change in pull request #9306: implement Azure InputSource reader and deprecate Azure FireHose URL: https://github.com/apache/druid/pull/9306#discussion_r376575486
########## File path: extensions-contrib/azure-extensions/src/test/java/org/apache/druid/storage/azure/AzureStorageDruidModuleTest.java ########## @@ -101,6 +126,108 @@ public void test_getAzureStorageContainer_expectedClient() Assert.assertSame(cloudBlobClient, azureStorage.getCloudBlobClient()); } + @Test + public void test_getAzureCloudBlobToLocationConverter_expectedConverted() + { + final Properties props = new Properties(); + props.put("druid.azure.account", AZURE_ACCOUNT_NAME); + props.put("druid.azure.key", AZURE_ACCOUNT_KEY); + props.put("druid.azure.container", AZURE_CONTAINER); + injector = makeInjectorWithProperties(props); + AzureCloudBlobHolderToCloudObjectLocationConverter azureCloudBlobLocationConverter1 = injector.getInstance( + AzureCloudBlobHolderToCloudObjectLocationConverter.class); + AzureCloudBlobHolderToCloudObjectLocationConverter azureCloudBlobLocationConverter2 = injector.getInstance( + AzureCloudBlobHolderToCloudObjectLocationConverter.class); + Assert.assertSame(azureCloudBlobLocationConverter1, azureCloudBlobLocationConverter2); + } + + @Test + public void test_getAzureByteSourceFactory_canCreateAzureByteSource() + { + final Properties props = new Properties(); + props.put("druid.azure.account", AZURE_ACCOUNT_NAME); + props.put("druid.azure.key", AZURE_ACCOUNT_KEY); + props.put("druid.azure.container", AZURE_CONTAINER); + injector = makeInjectorWithProperties(props); + AzureByteSourceFactory factory = injector.getInstance(AzureByteSourceFactory.class); + Object object1 = factory.create("container1", "blob1"); + Object object2 = factory.create("container2", "blob2"); + Assert.assertNotNull(object1); + Assert.assertNotNull(object2); + Assert.assertNotSame(object1, object2); + } + + @Test + public void test_getAzureEntityFactory_canCreateAzureEntity() + { + final Properties props = new Properties(); + props.put("druid.azure.account", AZURE_ACCOUNT_NAME); + props.put("druid.azure.key", AZURE_ACCOUNT_KEY); + props.put("druid.azure.container", AZURE_CONTAINER); + + EasyMock.expect(cloudObjectLocation1.getBucket()).andReturn(AZURE_CONTAINER); + EasyMock.expect(cloudObjectLocation2.getBucket()).andReturn(AZURE_CONTAINER); + EasyMock.expect(cloudObjectLocation1.getPath()).andReturn(PATH); + EasyMock.expect(cloudObjectLocation2.getPath()).andReturn(PATH); + replayAll(); + + injector = makeInjectorWithProperties(props); + AzureEntityFactory factory = injector.getInstance(AzureEntityFactory.class); + Object object1 = factory.create(cloudObjectLocation1); + Object object2 = factory.create(cloudObjectLocation2); + Assert.assertNotNull(object1); + Assert.assertNotNull(object2); + Assert.assertNotSame(object1, object2); + } + + @Test + public void test_getAzureCloudBlobIteratorFactory_canCreateAzureCloudBlobIterator() + { + final Properties props = new Properties(); + props.put("druid.azure.account", AZURE_ACCOUNT_NAME); + props.put("druid.azure.key", AZURE_ACCOUNT_KEY); + props.put("druid.azure.container", AZURE_CONTAINER); + injector = makeInjectorWithProperties(props); + AzureCloudBlobIteratorFactory factory = injector.getInstance(AzureCloudBlobIteratorFactory.class); + Object object1 = factory.create(EMPTY_PREFIXES_ITERABLE, 10); + Object object2 = factory.create(EMPTY_PREFIXES_ITERABLE, 10); + Assert.assertNotNull(object1); + Assert.assertNotNull(object2); + Assert.assertNotSame(object1, object2); + } + + @Test + public void test_getAzureCloudBlobIterableFactory_canCreateAzureCloudBlobIterable() + { + final Properties props = new Properties(); + props.put("druid.azure.account", AZURE_ACCOUNT_NAME); + props.put("druid.azure.key", AZURE_ACCOUNT_KEY); + props.put("druid.azure.container", AZURE_CONTAINER); + injector = makeInjectorWithProperties(props); + AzureCloudBlobIterableFactory factory = injector.getInstance(AzureCloudBlobIterableFactory.class); + AzureCloudBlobIterable object1 = factory.create(EMPTY_PREFIXES_ITERABLE, 10); + AzureCloudBlobIterable object2 = factory.create(EMPTY_PREFIXES_ITERABLE, 10); + Assert.assertNotNull(object1); + Assert.assertNotNull(object2); + Assert.assertNotSame(object1, object2); + } + + @Test + public void test_getListBlobItemDruidFactory_canCreateListBlobItemDruid() + { + final Properties props = new Properties(); + props.put("druid.azure.account", AZURE_ACCOUNT_NAME); + props.put("druid.azure.key", AZURE_ACCOUNT_KEY); + props.put("druid.azure.container", AZURE_CONTAINER); + injector = makeInjectorWithProperties(props); + 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); + } + Review comment: Test to verify the AzureInputSource is registered to the scheme `azure` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org