alopresto commented on a change in pull request #3672: NIFI-6363 Additional 
Sensitive Property Providers
URL: https://github.com/apache/nifi/pull/3672#discussion_r318206764
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-properties-loader/src/test/java/org/apache/nifi/properties/sensitive/aws/kms/AWSKMSSensitivePropertyProviderIT.java
 ##########
 @@ -0,0 +1,220 @@
+/*
+ * 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.properties.sensitive.aws.kms;
+
+import com.amazonaws.auth.PropertiesCredentials;
+import com.amazonaws.services.kms.AWSKMSClient;
+import com.amazonaws.services.kms.AWSKMSClientBuilder;
+import com.amazonaws.services.kms.model.CreateAliasRequest;
+import com.amazonaws.services.kms.model.CreateKeyRequest;
+import com.amazonaws.services.kms.model.CreateKeyResult;
+import com.amazonaws.services.kms.model.DescribeKeyRequest;
+import com.amazonaws.services.kms.model.DescribeKeyResult;
+import com.amazonaws.services.kms.model.GenerateDataKeyRequest;
+import com.amazonaws.services.kms.model.GenerateDataKeyResult;
+import com.amazonaws.services.kms.model.ScheduleKeyDeletionRequest;
+
+import junit.framework.TestCase;
+import org.apache.commons.lang3.StringUtils;
+import 
org.apache.nifi.properties.sensitive.AbstractSensitivePropertyProviderTest;
+import 
org.apache.nifi.properties.sensitive.SensitivePropertyConfigurationException;
+import org.apache.nifi.properties.sensitive.SensitivePropertyProvider;
+import org.apache.nifi.security.util.CipherUtils;
+
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import java.util.regex.Pattern;
+
+
+public class AWSKMSSensitivePropertyProviderIT extends 
AbstractSensitivePropertyProviderTest {
+    private static final Logger logger = 
LoggerFactory.getLogger(AWSKMSSensitivePropertyProviderIT.class);
+
+    private static final Map<String, String> credentialsBeforeTest = new 
HashMap<>();
+    private static final Map<String, String> credentialsDuringTest = new 
HashMap<>();
+    private static final String CREDENTIALS_FILE = 
System.getProperty("user.home") + "/aws-credentials.properties";
+
+    private static String[] knownGoodKeys;
+    private static AWSKMSClient client;
+
+    /**
+     * Before the tests are run, this method reads the aws credentials file, 
and when successful, sets those values as
+     * system properties.
+     */
+    @BeforeClass
+    public static void setUpOnce() throws Exception {
 
 Review comment:
   I suggest adding a comment explaining the user's required steps to run this 
test successfully (i.e. get the AWS API key & secret key & put them in ENV 
variables or a credentials file on disk) and add a validator which skips the 
test if those values are not present. 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to