You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/02/24 16:09:43 UTC
[GitHub] [nifi] MikeThomsen commented on a change in pull request #5790: NIFI-9104-9113 Multiple JUnit 5 refactorings (Druid -> GRPC)
MikeThomsen commented on a change in pull request #5790:
URL: https://github.com/apache/nifi/pull/5790#discussion_r814037010
##########
File path: nifi-nar-bundles/nifi-grpc-bundle/nifi-grpc-processors/src/test/java/org/apache/nifi/processors/grpc/ITListenGRPC.java
##########
@@ -19,26 +19,57 @@
import com.google.common.collect.Sets;
import com.google.protobuf.ByteString;
import io.grpc.ManagedChannel;
+import io.grpc.StatusRuntimeException;
import org.apache.nifi.flowfile.attributes.CoreAttributes;
import org.apache.nifi.processor.ProcessContext;
import org.apache.nifi.processor.ProcessSessionFactory;
+import org.apache.nifi.ssl.SSLContextService;
+import org.apache.nifi.ssl.StandardSSLContextService;
import org.apache.nifi.util.MockFlowFile;
import org.apache.nifi.util.TestRunner;
import org.apache.nifi.util.TestRunners;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.StringContains.containsString;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
public class ITListenGRPC {
private static final String HOST = "localhost";
private static final String SOURCE_SYSTEM_UUID = "FAKE_UUID";
+ private static Map<String, String> getTruststoreProperties() {
+ final Map<String, String> props = new HashMap<>();
+ props.put(StandardSSLContextService.TRUSTSTORE.getName(), "src/test/resources/truststore.jks");
+ props.put(StandardSSLContextService.TRUSTSTORE_PASSWORD.getName(), "passwordpassword");
+ props.put(StandardSSLContextService.TRUSTSTORE_TYPE.getName(), "JKS");
+ return props;
+ }
+
+ private static Map<String, String> getKeystoreProperties() {
+ final Map<String, String> properties = new HashMap<>();
+ properties.put(StandardSSLContextService.KEYSTORE.getName(), "src/test/resources/keystore.jks");
+ properties.put(StandardSSLContextService.KEYSTORE_PASSWORD.getName(), "passwordpassword");
+ properties.put(StandardSSLContextService.KEYSTORE_TYPE.getName(), "JKS");
+ return properties;
+ }
+
+ private static void useSSLContextService(final TestRunner controller, final Map<String, String> sslProperties) {
+ final SSLContextService service = new StandardSSLContextService();
+ assertDoesNotThrow(() -> controller.addControllerService("ssl-service", service, sslProperties));
+ controller.enableControllerService(service);
+
+ controller.setProperty(InvokeGRPC.PROP_SSL_CONTEXT_SERVICE, "ssl-service");
+ }
+
Review comment:
Might be a rebase. I'll copy pasta the current contents in and then fix those up since it feels like some rebase ugliness.
--
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: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org