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_r376573123
 
 

 ##########
 File path: 
extensions-contrib/azure-extensions/src/test/java/org/apache/druid/data/input/azure/AzureInputSourceTest.java
 ##########
 @@ -0,0 +1,207 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.data.input.azure;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.druid.data.input.InputSplit;
+import org.apache.druid.data.input.impl.CloudObjectLocation;
+import org.apache.druid.data.input.impl.SplittableInputSource;
+import 
org.apache.druid.storage.azure.AzureCloudBlobHolderToCloudObjectLocationConverter;
+import org.apache.druid.storage.azure.AzureCloudBlobIterable;
+import org.apache.druid.storage.azure.AzureCloudBlobIterableFactory;
+import org.apache.druid.storage.azure.AzureStorage;
+import org.apache.druid.storage.azure.CloudBlobHolder;
+import org.easymock.EasyMock;
+import org.easymock.EasyMockSupport;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.net.URI;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Spliterators;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public class AzureInputSourceTest extends EasyMockSupport
+{
+  private static final String CONTAINER_NAME = "container";
+  private static final String BLOB_NAME = "blob";
+  private static final URI PREFIX_URI;
+  private final List<URI> EMPTY_URIS = ImmutableList.of();
+  private final List<URI> EMPTY_PREFIXES = ImmutableList.of();
+  private final List<CloudObjectLocation> EMPTY_OBJECTS = ImmutableList.of();
+  private static final String CONTAINER = "CONTAINER";
+  private static final String BLOB_PATH = "BLOB_PATH";
+  private static final CloudObjectLocation CLOUD_OBJECT_LOCATION_1 = new 
CloudObjectLocation(CONTAINER, BLOB_PATH);
+
+  private AzureStorage storage;
+  private AzureEntityFactory entityFactory;
+  private AzureCloudBlobIterableFactory azureCloudBlobIterableFactory;
+  private AzureCloudBlobHolderToCloudObjectLocationConverter 
azureCloudBlobToLocationConverter;
+
+  private InputSplit<CloudObjectLocation> inputSplit;
+  private AzureEntity azureEntity1;
+  private CloudBlobHolder cloudBlobDruid1;
+  private AzureCloudBlobIterable azureCloudBlobIterable;
+
+  private AzureInputSource azureInputSource;
+
+  static {
+    try {
+      PREFIX_URI = new URI(AzureInputSource.SCHEME + "://" + CONTAINER_NAME + 
"/" + BLOB_NAME);
+    }
+    catch (Exception e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  @Before
+  public void setup()
+  {
+    storage = createMock(AzureStorage.class);
+    entityFactory = createMock(AzureEntityFactory.class);
+    inputSplit = createMock(InputSplit.class);
+    azureEntity1 = createMock(AzureEntity.class);
+    azureCloudBlobIterableFactory = 
createMock(AzureCloudBlobIterableFactory.class);
+    azureCloudBlobToLocationConverter = 
createMock(AzureCloudBlobHolderToCloudObjectLocationConverter.class);
+    cloudBlobDruid1 = createMock(CloudBlobHolder.class);
+    azureCloudBlobIterable = createMock(AzureCloudBlobIterable.class);
+  }
+
+  @Test(expected = IllegalArgumentException.class)
+  public void 
test_Constructor_emptyUrisEmptyPrefixesEmptyObjects_throwsIllegalArgumentException()
+  {
+    replayAll();
+    azureInputSource = new AzureInputSource(
+        storage,
+        entityFactory,
+        azureCloudBlobIterableFactory,
+        azureCloudBlobToLocationConverter,
+        EMPTY_URIS,
+        EMPTY_PREFIXES,
+        EMPTY_OBJECTS
+    );
 
 Review comment:
   Do we want tests for uris and prefixes or uris and objects, etc. Or is that 
covered by another test

----------------------------------------------------------------
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

Reply via email to