turcsanyip commented on a change in pull request #5486:
URL: https://github.com/apache/nifi/pull/5486#discussion_r739539239



##########
File path: 
nifi-nar-bundles/nifi-azure-bundle/nifi-azure-processors/src/test/java/org/apache/nifi/processors/azure/storage/AbstractAzureBlobStorage_v12IT.java
##########
@@ -0,0 +1,137 @@
+/*
+ * 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.nifi.processors.azure.storage;
+
+import com.azure.storage.blob.BlobClient;
+import com.azure.storage.blob.BlobContainerClient;
+import com.azure.storage.blob.BlobServiceClient;
+import com.azure.storage.blob.BlobServiceClientBuilder;
+import com.azure.storage.blob.models.BlobType;
+import com.azure.storage.common.StorageSharedKeyCredential;
+import org.apache.nifi.processors.azure.AbstractAzureBlobProcessor_v12;
+import org.apache.nifi.processors.azure.storage.utils.AzureStorageUtils;
+import org.apache.nifi.processors.azure.storage.utils.BlobAttributes;
+import 
org.apache.nifi.services.azure.storage.AzureStorageCredentialsControllerService_v12;
+import 
org.apache.nifi.services.azure.storage.AzureStorageCredentialsService_v12;
+import org.apache.nifi.util.MockFlowFile;
+import org.junit.After;
+import org.junit.Before;
+
+import java.io.ByteArrayInputStream;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+public abstract class AbstractAzureBlobStorage_v12IT extends 
AbstractAzureStorageIT {
+
+    protected static final String BLOB_NAME = "blob1";
+    protected static final byte[] BLOB_DATA = "0123456789".getBytes();
+
+    protected static final String EL_CONTAINER_NAME = "az.containername";
+    protected static final String EL_BLOB_NAME = "az.blobname";
+
+    protected static final byte[] EMPTY_CONTENT = new byte[0];
+
+    private static final String TEST_CONTAINER_NAME_PREFIX = 
"nifi-test-container";
+
+    private BlobServiceClient storageClient;
+    private BlobContainerClient containerClient;
+    private String containerName;
+
+    @Override
+    protected void setUpCredentials() throws Exception {
+        String serviceId = "credentials-service";
+        AzureStorageCredentialsService_v12 service = new 
AzureStorageCredentialsControllerService_v12();
+        runner.addControllerService(serviceId, service);
+        runner.setProperty(service, 
AzureStorageCredentialsControllerService_v12.ACCOUNT_NAME, getAccountName());
+        runner.setProperty(service, 
AzureStorageCredentialsControllerService_v12.ACCOUNT_KEY, getAccountKey());
+        runner.enableControllerService(service);
+
+        
runner.setProperty(AbstractAzureBlobProcessor_v12.STORAGE_CREDENTIALS_SERVICE, 
serviceId);
+    }
+
+    @Before
+    public void setUpAzureBlobStorage_v12IT() {
+        containerName = generateContainerName();
+
+        runner.setProperty(AzureStorageUtils.CONTAINER, containerName);
+
+        storageClient = createStorageClient();
+        containerClient = storageClient.createBlobContainer(containerName);
+    }
+
+    @After
+    public void tearDownAzureBlobStorage_v12IT() {
+        containerClient.delete();
+    }
+
+    protected String generateContainerName() {
+        return String.format("%s-%s", TEST_CONTAINER_NAME_PREFIX, 
UUID.randomUUID());
+    }
+
+    protected BlobServiceClient getStorageClient() {
+        return storageClient;
+    }
+
+    protected BlobContainerClient getContainerClient() {
+        return containerClient;
+    }
+
+    protected String getContainerName() {
+        return containerName;
+    }
+
+    private BlobServiceClient createStorageClient() {
+        return new BlobServiceClientBuilder()
+                .endpoint("https://"; + getAccountName() + 
".blob.core.windows.net")

Review comment:
       "endpointSuffix" property can now be configured in 
azure-credentials.PROPERTIES for the IT tests. If not specified, the default 
endpoint will be used.




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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to