Search in sources :

Example 6 with StandardSSLContextService

use of org.apache.nifi.ssl.StandardSSLContextService in project nifi by apache.

the class TestPutTcpSSL method configureProperties.

@Override
public void configureProperties(String host, int port, String outgoingMessageDelimiter, boolean connectionPerFlowFile, boolean expectValid) throws InitializationException {
    runner.setProperty(PutTCP.HOSTNAME, host);
    runner.setProperty(PutTCP.PORT, Integer.toString(port));
    final StandardSSLContextService sslService = new StandardSSLContextService();
    runner.addControllerService("ssl-context", sslService, sslProperties);
    runner.enableControllerService(sslService);
    runner.setProperty(PutTCP.SSL_CONTEXT_SERVICE, "ssl-context");
    if (outgoingMessageDelimiter != null) {
        runner.setProperty(PutTCP.OUTGOING_MESSAGE_DELIMITER, outgoingMessageDelimiter);
    }
    runner.setProperty(PutTCP.CONNECTION_PER_FLOWFILE, String.valueOf(connectionPerFlowFile));
    if (expectValid) {
        runner.assertValid();
    } else {
        runner.assertNotValid();
    }
}
Also used : StandardSSLContextService(org.apache.nifi.ssl.StandardSSLContextService)

Example 7 with StandardSSLContextService

use of org.apache.nifi.ssl.StandardSSLContextService in project nifi by apache.

the class ITListenGRPC method useSSLContextService.

private static void useSSLContextService(final TestRunner controller, final Map<String, String> sslProperties) {
    final SSLContextService service = new StandardSSLContextService();
    try {
        controller.addControllerService("ssl-service", service, sslProperties);
        controller.enableControllerService(service);
    } catch (InitializationException ex) {
        ex.printStackTrace();
        Assert.fail("Could not create SSL Context Service");
    }
    controller.setProperty(InvokeGRPC.PROP_SSL_CONTEXT_SERVICE, "ssl-service");
}
Also used : StandardSSLContextService(org.apache.nifi.ssl.StandardSSLContextService) SSLContextService(org.apache.nifi.ssl.SSLContextService) StandardSSLContextService(org.apache.nifi.ssl.StandardSSLContextService) InitializationException(org.apache.nifi.reporting.InitializationException)

Example 8 with StandardSSLContextService

use of org.apache.nifi.ssl.StandardSSLContextService in project nifi by apache.

the class TestInvokeGRPC method useSSLContextService.

private void useSSLContextService(final TestRunner controller, final Map<String, String> sslProperties) {
    final SSLContextService service = new StandardSSLContextService();
    try {
        controller.addControllerService("ssl-service", service, sslProperties);
        controller.enableControllerService(service);
    } catch (InitializationException ex) {
        ex.printStackTrace();
        Assert.fail("Could not create SSL Context Service");
    }
    controller.setProperty(InvokeGRPC.PROP_SSL_CONTEXT_SERVICE, "ssl-service");
}
Also used : SSLContextService(org.apache.nifi.ssl.SSLContextService) StandardSSLContextService(org.apache.nifi.ssl.StandardSSLContextService) StandardSSLContextService(org.apache.nifi.ssl.StandardSSLContextService) InitializationException(org.apache.nifi.reporting.InitializationException)

Example 9 with StandardSSLContextService

use of org.apache.nifi.ssl.StandardSSLContextService in project nifi by apache.

the class TestExecuteSparkInteractiveSSL method before.

@Before
public void before() throws Exception {
    runner = TestRunners.newTestRunner(ExecuteSparkInteractive.class);
    final StandardSSLContextService sslService = new StandardSSLContextService();
    runner.addControllerService("ssl-context", sslService, sslProperties);
    runner.enableControllerService(sslService);
    // Allow time for the controller service to fully initialize
    Thread.sleep(500);
    LivySessionController livyControllerService = new LivySessionController();
    runner.addControllerService("livyCS", livyControllerService);
    runner.setProperty(livyControllerService, LivySessionController.LIVY_HOST, url.substring(url.indexOf("://") + 3, url.lastIndexOf(":")));
    runner.setProperty(livyControllerService, LivySessionController.LIVY_PORT, url.substring(url.lastIndexOf(":") + 1));
    runner.setProperty(livyControllerService, LivySessionController.SSL_CONTEXT_SERVICE, "ssl-context");
    runner.enableControllerService(livyControllerService);
    runner.setProperty(ExecuteSparkInteractive.LIVY_CONTROLLER_SERVICE, "livyCS");
    server.clearHandlers();
}
Also used : LivySessionController(org.apache.nifi.controller.livy.LivySessionController) StandardSSLContextService(org.apache.nifi.ssl.StandardSSLContextService) Before(org.junit.Before)

Example 10 with StandardSSLContextService

use of org.apache.nifi.ssl.StandardSSLContextService in project nifi by apache.

the class TestConsumeMqttSSL method init.

@Before
public void init() throws IOException, InitializationException {
    startServer();
    broker = "ssl://localhost:8883";
    testRunner = TestRunners.newTestRunner(ConsumeMQTT.class);
    testRunner.setProperty(ConsumeMQTT.PROP_BROKER_URI, broker);
    testRunner.setProperty(ConsumeMQTT.PROP_CLIENTID, "TestClient");
    testRunner.setProperty(ConsumeMQTT.PROP_TOPIC_FILTER, "testTopic");
    testRunner.setProperty(ConsumeMQTT.PROP_MAX_QUEUE_SIZE, "100");
    final StandardSSLContextService sslService = new StandardSSLContextService();
    Map<String, String> sslProperties = createSslProperties();
    testRunner.addControllerService("ssl-context", sslService, sslProperties);
    testRunner.enableControllerService(sslService);
    testRunner.setProperty(ConsumeMQTT.PROP_SSL_CONTEXT_SERVICE, "ssl-context");
}
Also used : StandardSSLContextService(org.apache.nifi.ssl.StandardSSLContextService) ConsumeMQTT(org.apache.nifi.processors.mqtt.ConsumeMQTT) Before(org.junit.Before)

Aggregations

StandardSSLContextService (org.apache.nifi.ssl.StandardSSLContextService)17 SSLContextService (org.apache.nifi.ssl.SSLContextService)11 Test (org.junit.Test)6 HashMap (java.util.HashMap)5 Before (org.junit.Before)4 InitializationException (org.apache.nifi.reporting.InitializationException)3 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ArrayList (java.util.ArrayList)1 LivySessionController (org.apache.nifi.controller.livy.LivySessionController)1 ConsumeMQTT (org.apache.nifi.processors.mqtt.ConsumeMQTT)1 PublishMQTT (org.apache.nifi.processors.mqtt.PublishMQTT)1 RELPFrame (org.apache.nifi.processors.standard.relp.frame.RELPFrame)1 StandardRestrictedSSLContextService (org.apache.nifi.ssl.StandardRestrictedSSLContextService)1 FlowFileUnpackagerV3 (org.apache.nifi.util.FlowFileUnpackagerV3)1 MockFlowFile (org.apache.nifi.util.MockFlowFile)1