Repository: nifi Updated Branches: refs/heads/master affc88e59 -> 2dc45a4dd
NIFI-4154 Fixing line endings in .java,.html files Signed-off-by: James Wing <[email protected]> This closes #1982. Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/2dc45a4d Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/2dc45a4d Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/2dc45a4d Branch: refs/heads/master Commit: 2dc45a4dd74c42f456ed0135fc8c5a04d0036410 Parents: affc88e Author: Tony Kurc <[email protected]> Authored: Wed Jul 5 21:34:01 2017 -0400 Committer: James Wing <[email protected]> Committed: Sun Jul 9 12:13:15 2017 -0700 ---------------------------------------------------------------------- .../org/apache/nifi/util/FlowFileValidator.java | 60 +++--- .../processors/AbstractAMQPProcessorTest.java | 178 ++++++++-------- .../nifi/util/LoggingXmlParserErrorHandler.java | 84 ++++---- .../mongodb/AbstractMongoProcessorTest.java | 208 +++++++++---------- .../standard/util/MultiAuthenticator.java | 138 ++++++------ .../additionalDetails.html | 96 ++++----- .../additionalDetails.html | 60 +++--- 7 files changed, 412 insertions(+), 412 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/2dc45a4d/nifi-mock/src/main/java/org/apache/nifi/util/FlowFileValidator.java ---------------------------------------------------------------------- diff --git a/nifi-mock/src/main/java/org/apache/nifi/util/FlowFileValidator.java b/nifi-mock/src/main/java/org/apache/nifi/util/FlowFileValidator.java index aacc3cb..7613037 100644 --- a/nifi-mock/src/main/java/org/apache/nifi/util/FlowFileValidator.java +++ b/nifi-mock/src/main/java/org/apache/nifi/util/FlowFileValidator.java @@ -1,30 +1,30 @@ -/* - * 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.util; - -import org.apache.nifi.flowfile.FlowFile; - -public interface FlowFileValidator { - - /** - * Define a verification method to validate the given FlowFile - * - * @param f Flow file - */ - void assertFlowFile(FlowFile f); - -} +/* + * 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.util; + +import org.apache.nifi.flowfile.FlowFile; + +public interface FlowFileValidator { + + /** + * Define a verification method to validate the given FlowFile + * + * @param f Flow file + */ + void assertFlowFile(FlowFile f); + +} http://git-wip-us.apache.org/repos/asf/nifi/blob/2dc45a4d/nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/test/java/org/apache/nifi/amqp/processors/AbstractAMQPProcessorTest.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/test/java/org/apache/nifi/amqp/processors/AbstractAMQPProcessorTest.java b/nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/test/java/org/apache/nifi/amqp/processors/AbstractAMQPProcessorTest.java index 662e0e5..0657a65 100644 --- a/nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/test/java/org/apache/nifi/amqp/processors/AbstractAMQPProcessorTest.java +++ b/nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/test/java/org/apache/nifi/amqp/processors/AbstractAMQPProcessorTest.java @@ -1,89 +1,89 @@ -/* - * 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.amqp.processors; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import org.apache.nifi.authentication.exception.ProviderCreationException; -import org.apache.nifi.processor.ProcessContext; -import org.apache.nifi.processor.ProcessSession; -import org.apache.nifi.processor.exception.ProcessException; -import org.apache.nifi.ssl.SSLContextService; -import org.apache.nifi.util.TestRunner; -import org.apache.nifi.util.TestRunners; -import org.junit.Before; -import org.junit.Test; - - -/** - * Unit tests for the AbstractAMQPProcessor class - */ -public class AbstractAMQPProcessorTest { - - MockAbstractAMQPProcessor processor; - private TestRunner testRunner; - - @Before - public void setUp() throws Exception { - processor = new MockAbstractAMQPProcessor(); - testRunner = TestRunners.newTestRunner(processor); - } - - @Test(expected = ProviderCreationException.class) - public void testConnectToCassandraWithSSLBadClientAuth() throws Exception { - SSLContextService sslService = mock(SSLContextService.class); - when(sslService.getIdentifier()).thenReturn("ssl-context"); - testRunner.addControllerService("ssl-context", sslService); - testRunner.enableControllerService(sslService); - testRunner.setProperty(AbstractAMQPProcessor.SSL_CONTEXT_SERVICE, "ssl-context"); - testRunner.setProperty(AbstractAMQPProcessor.USE_CERT_AUTHENTICATION, "false"); - testRunner.setProperty(AbstractAMQPProcessor.HOST, "test"); - testRunner.setProperty(AbstractAMQPProcessor.PORT, "9999"); - testRunner.setProperty(AbstractAMQPProcessor.USER, "test"); - testRunner.setProperty(AbstractAMQPProcessor.PASSWORD, "test"); - testRunner.assertValid(sslService); - testRunner.setProperty(AbstractAMQPProcessor.CLIENT_AUTH, "BAD"); - processor.onTrigger(testRunner.getProcessContext(), testRunner.getProcessSessionFactory()); - } - - @Test(expected = ProviderCreationException.class) - public void testInvalidSSLConfiguration() throws Exception { - // it's invalid to have use_cert_auth enabled and not have the SSL Context Service configured - testRunner.setProperty(AbstractAMQPProcessor.USE_CERT_AUTHENTICATION, "true"); - testRunner.setProperty(AbstractAMQPProcessor.HOST, "test"); - testRunner.setProperty(AbstractAMQPProcessor.PORT, "9999"); - testRunner.setProperty(AbstractAMQPProcessor.USER, "test"); - testRunner.setProperty(AbstractAMQPProcessor.PASSWORD, "test"); - processor.onTrigger(testRunner.getProcessContext(), testRunner.getProcessSessionFactory()); - } - - /** - * Provides a stubbed processor instance for testing - */ - public static class MockAbstractAMQPProcessor extends AbstractAMQPProcessor<AMQPConsumer> { - @Override - protected void rendezvousWithAmqp(ProcessContext context, ProcessSession session) throws ProcessException { - // nothing to do - } - - @Override - protected AMQPConsumer finishBuildingTargetResource(ProcessContext context) { - return null; - } - } -} +/* + * 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.amqp.processors; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.apache.nifi.authentication.exception.ProviderCreationException; +import org.apache.nifi.processor.ProcessContext; +import org.apache.nifi.processor.ProcessSession; +import org.apache.nifi.processor.exception.ProcessException; +import org.apache.nifi.ssl.SSLContextService; +import org.apache.nifi.util.TestRunner; +import org.apache.nifi.util.TestRunners; +import org.junit.Before; +import org.junit.Test; + + +/** + * Unit tests for the AbstractAMQPProcessor class + */ +public class AbstractAMQPProcessorTest { + + MockAbstractAMQPProcessor processor; + private TestRunner testRunner; + + @Before + public void setUp() throws Exception { + processor = new MockAbstractAMQPProcessor(); + testRunner = TestRunners.newTestRunner(processor); + } + + @Test(expected = ProviderCreationException.class) + public void testConnectToCassandraWithSSLBadClientAuth() throws Exception { + SSLContextService sslService = mock(SSLContextService.class); + when(sslService.getIdentifier()).thenReturn("ssl-context"); + testRunner.addControllerService("ssl-context", sslService); + testRunner.enableControllerService(sslService); + testRunner.setProperty(AbstractAMQPProcessor.SSL_CONTEXT_SERVICE, "ssl-context"); + testRunner.setProperty(AbstractAMQPProcessor.USE_CERT_AUTHENTICATION, "false"); + testRunner.setProperty(AbstractAMQPProcessor.HOST, "test"); + testRunner.setProperty(AbstractAMQPProcessor.PORT, "9999"); + testRunner.setProperty(AbstractAMQPProcessor.USER, "test"); + testRunner.setProperty(AbstractAMQPProcessor.PASSWORD, "test"); + testRunner.assertValid(sslService); + testRunner.setProperty(AbstractAMQPProcessor.CLIENT_AUTH, "BAD"); + processor.onTrigger(testRunner.getProcessContext(), testRunner.getProcessSessionFactory()); + } + + @Test(expected = ProviderCreationException.class) + public void testInvalidSSLConfiguration() throws Exception { + // it's invalid to have use_cert_auth enabled and not have the SSL Context Service configured + testRunner.setProperty(AbstractAMQPProcessor.USE_CERT_AUTHENTICATION, "true"); + testRunner.setProperty(AbstractAMQPProcessor.HOST, "test"); + testRunner.setProperty(AbstractAMQPProcessor.PORT, "9999"); + testRunner.setProperty(AbstractAMQPProcessor.USER, "test"); + testRunner.setProperty(AbstractAMQPProcessor.PASSWORD, "test"); + processor.onTrigger(testRunner.getProcessContext(), testRunner.getProcessSessionFactory()); + } + + /** + * Provides a stubbed processor instance for testing + */ + public static class MockAbstractAMQPProcessor extends AbstractAMQPProcessor<AMQPConsumer> { + @Override + protected void rendezvousWithAmqp(ProcessContext context, ProcessSession session) throws ProcessException { + // nothing to do + } + + @Override + protected AMQPConsumer finishBuildingTargetResource(ProcessContext context) { + return null; + } + } +} http://git-wip-us.apache.org/repos/asf/nifi/blob/2dc45a4d/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/util/LoggingXmlParserErrorHandler.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/util/LoggingXmlParserErrorHandler.java b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/util/LoggingXmlParserErrorHandler.java index 6fdbd60..6c7f7bf 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/util/LoggingXmlParserErrorHandler.java +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/util/LoggingXmlParserErrorHandler.java @@ -1,43 +1,43 @@ -/* - * 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.util; - -import org.slf4j.Logger; -import org.xml.sax.SAXParseException; -import org.xml.sax.helpers.DefaultHandler; - -/** - * ErrorHandler implementation for Logging XML schema validation errors - */ -public class LoggingXmlParserErrorHandler extends DefaultHandler { - - private final Logger logger; - private final String xmlDocTitle; - private static final String MESSAGE_FORMAT = "Schema validation %s parsing %s at line %d, col %d: %s"; - - public LoggingXmlParserErrorHandler(String xmlDocTitle, Logger logger) { - this.logger = logger; - this.xmlDocTitle = xmlDocTitle; - } - - @Override - public void error(final SAXParseException err) throws SAXParseException { - String message = String.format(MESSAGE_FORMAT, "error", xmlDocTitle, err.getLineNumber(), - err.getColumnNumber(), err.getMessage()); - logger.warn(message); - } +/* + * 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.util; + +import org.slf4j.Logger; +import org.xml.sax.SAXParseException; +import org.xml.sax.helpers.DefaultHandler; + +/** + * ErrorHandler implementation for Logging XML schema validation errors + */ +public class LoggingXmlParserErrorHandler extends DefaultHandler { + + private final Logger logger; + private final String xmlDocTitle; + private static final String MESSAGE_FORMAT = "Schema validation %s parsing %s at line %d, col %d: %s"; + + public LoggingXmlParserErrorHandler(String xmlDocTitle, Logger logger) { + this.logger = logger; + this.xmlDocTitle = xmlDocTitle; + } + + @Override + public void error(final SAXParseException err) throws SAXParseException { + String message = String.format(MESSAGE_FORMAT, "error", xmlDocTitle, err.getLineNumber(), + err.getColumnNumber(), err.getMessage()); + logger.warn(message); + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/nifi/blob/2dc45a4d/nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/test/java/org/apache/nifi/processors/mongodb/AbstractMongoProcessorTest.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/test/java/org/apache/nifi/processors/mongodb/AbstractMongoProcessorTest.java b/nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/test/java/org/apache/nifi/processors/mongodb/AbstractMongoProcessorTest.java index 1750cc2..9951fdf 100644 --- a/nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/test/java/org/apache/nifi/processors/mongodb/AbstractMongoProcessorTest.java +++ b/nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/test/java/org/apache/nifi/processors/mongodb/AbstractMongoProcessorTest.java @@ -1,104 +1,104 @@ -/* - * 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.mongodb; - -import static org.junit.Assert.assertNotNull; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import static org.mockito.Mockito.any; - -import javax.net.ssl.SSLContext; - -import org.apache.nifi.authentication.exception.ProviderCreationException; -import org.apache.nifi.processor.ProcessContext; -import org.apache.nifi.processor.ProcessSession; -import org.apache.nifi.processor.exception.ProcessException; -import org.apache.nifi.ssl.SSLContextService; -import org.apache.nifi.ssl.SSLContextService.ClientAuth; -import org.apache.nifi.util.TestRunner; -import org.apache.nifi.util.TestRunners; -import org.junit.Before; -import org.junit.Test; - -import com.mongodb.MongoClientOptions; -import com.mongodb.MongoClientOptions.Builder; - -public class AbstractMongoProcessorTest { - - MockAbstractMongoProcessor processor; - private TestRunner testRunner; - - @Before - public void setUp() throws Exception { - processor = new MockAbstractMongoProcessor(); - testRunner = TestRunners.newTestRunner(processor); - } - - @Test - public void testcreateClientWithSSL() throws Exception { - SSLContextService sslService = mock(SSLContextService.class); - SSLContext sslContext = mock(SSLContext.class); - when(sslService.getIdentifier()).thenReturn("ssl-context"); - when(sslService.createSSLContext(any(ClientAuth.class))).thenReturn(sslContext); - testRunner.addControllerService("ssl-context", sslService); - testRunner.enableControllerService(sslService); - testRunner.setProperty(AbstractMongoProcessor.URI, "mongodb://localhost:27017"); - testRunner.setProperty(AbstractMongoProcessor.SSL_CONTEXT_SERVICE, "ssl-context"); - testRunner.assertValid(sslService); - processor.createClient(testRunner.getProcessContext()); - assertNotNull(processor.mongoClient); - processor.mongoClient = null; - testRunner.setProperty(AbstractMongoProcessor.CLIENT_AUTH, "WANT"); - processor.createClient(testRunner.getProcessContext()); - assertNotNull(processor.mongoClient); - } - - @Test(expected = ProviderCreationException.class) - public void testcreateClientWithSSLBadClientAuth() throws Exception { - SSLContextService sslService = mock(SSLContextService.class); - SSLContext sslContext = mock(SSLContext.class); - when(sslService.getIdentifier()).thenReturn("ssl-context"); - when(sslService.createSSLContext(any(ClientAuth.class))).thenReturn(sslContext); - testRunner.addControllerService("ssl-context", sslService); - testRunner.enableControllerService(sslService); - testRunner.setProperty(AbstractMongoProcessor.URI, "mongodb://localhost:27017"); - testRunner.setProperty(AbstractMongoProcessor.SSL_CONTEXT_SERVICE, "ssl-context"); - testRunner.assertValid(sslService); - processor.createClient(testRunner.getProcessContext()); - assertNotNull(processor.mongoClient); - processor.mongoClient = null; - testRunner.setProperty(AbstractMongoProcessor.CLIENT_AUTH, "BAD"); - processor.createClient(testRunner.getProcessContext()); - } - - - /** - * Provides a stubbed processor instance for testing - */ - public static class MockAbstractMongoProcessor extends AbstractMongoProcessor { - @Override - public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException { - // nothing to do - } - - @Override - protected Builder getClientOptions(SSLContext sslContext) { - return MongoClientOptions.builder(); - } - } - -} +/* + * 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.mongodb; + +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static org.mockito.Mockito.any; + +import javax.net.ssl.SSLContext; + +import org.apache.nifi.authentication.exception.ProviderCreationException; +import org.apache.nifi.processor.ProcessContext; +import org.apache.nifi.processor.ProcessSession; +import org.apache.nifi.processor.exception.ProcessException; +import org.apache.nifi.ssl.SSLContextService; +import org.apache.nifi.ssl.SSLContextService.ClientAuth; +import org.apache.nifi.util.TestRunner; +import org.apache.nifi.util.TestRunners; +import org.junit.Before; +import org.junit.Test; + +import com.mongodb.MongoClientOptions; +import com.mongodb.MongoClientOptions.Builder; + +public class AbstractMongoProcessorTest { + + MockAbstractMongoProcessor processor; + private TestRunner testRunner; + + @Before + public void setUp() throws Exception { + processor = new MockAbstractMongoProcessor(); + testRunner = TestRunners.newTestRunner(processor); + } + + @Test + public void testcreateClientWithSSL() throws Exception { + SSLContextService sslService = mock(SSLContextService.class); + SSLContext sslContext = mock(SSLContext.class); + when(sslService.getIdentifier()).thenReturn("ssl-context"); + when(sslService.createSSLContext(any(ClientAuth.class))).thenReturn(sslContext); + testRunner.addControllerService("ssl-context", sslService); + testRunner.enableControllerService(sslService); + testRunner.setProperty(AbstractMongoProcessor.URI, "mongodb://localhost:27017"); + testRunner.setProperty(AbstractMongoProcessor.SSL_CONTEXT_SERVICE, "ssl-context"); + testRunner.assertValid(sslService); + processor.createClient(testRunner.getProcessContext()); + assertNotNull(processor.mongoClient); + processor.mongoClient = null; + testRunner.setProperty(AbstractMongoProcessor.CLIENT_AUTH, "WANT"); + processor.createClient(testRunner.getProcessContext()); + assertNotNull(processor.mongoClient); + } + + @Test(expected = ProviderCreationException.class) + public void testcreateClientWithSSLBadClientAuth() throws Exception { + SSLContextService sslService = mock(SSLContextService.class); + SSLContext sslContext = mock(SSLContext.class); + when(sslService.getIdentifier()).thenReturn("ssl-context"); + when(sslService.createSSLContext(any(ClientAuth.class))).thenReturn(sslContext); + testRunner.addControllerService("ssl-context", sslService); + testRunner.enableControllerService(sslService); + testRunner.setProperty(AbstractMongoProcessor.URI, "mongodb://localhost:27017"); + testRunner.setProperty(AbstractMongoProcessor.SSL_CONTEXT_SERVICE, "ssl-context"); + testRunner.assertValid(sslService); + processor.createClient(testRunner.getProcessContext()); + assertNotNull(processor.mongoClient); + processor.mongoClient = null; + testRunner.setProperty(AbstractMongoProcessor.CLIENT_AUTH, "BAD"); + processor.createClient(testRunner.getProcessContext()); + } + + + /** + * Provides a stubbed processor instance for testing + */ + public static class MockAbstractMongoProcessor extends AbstractMongoProcessor { + @Override + public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException { + // nothing to do + } + + @Override + protected Builder getClientOptions(SSLContext sslContext) { + return MongoClientOptions.builder(); + } + } + +} http://git-wip-us.apache.org/repos/asf/nifi/blob/2dc45a4d/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/MultiAuthenticator.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/MultiAuthenticator.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/MultiAuthenticator.java index 62075d2..e9aec42 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/MultiAuthenticator.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/MultiAuthenticator.java @@ -1,69 +1,69 @@ -/* - * 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.standard.util; - -import java.io.IOException; -import java.net.Proxy; -import java.util.HashMap; -import java.util.Map; - -import com.burgstaller.okhttp.DispatchingAuthenticator; -import com.squareup.okhttp.Authenticator; -import com.squareup.okhttp.Credentials; -import com.squareup.okhttp.Request; -import com.squareup.okhttp.Response; - -public class MultiAuthenticator extends DispatchingAuthenticator { - - public MultiAuthenticator(Map<String, Authenticator> registry) { - super(registry); - } - - private String proxyUsername; - private String proxyPassword; - - @Override - public Request authenticateProxy(Proxy proxy, Response response) throws IOException { - String credential = Credentials.basic(proxyUsername, proxyPassword); - return response.request() - .newBuilder() - .header("Proxy-Authorization", credential) - .build(); - } - - public void setProxyUsername(String proxyUsername) { - this.proxyUsername = proxyUsername; - } - - public void setProxyPassword(String proxyPassword) { - this.proxyPassword = proxyPassword; - } - - public static final class Builder { - Map<String, Authenticator> registry = new HashMap<>(); - - public Builder with(String scheme, Authenticator authenticator) { - registry.put(scheme, authenticator); - return this; - } - - public MultiAuthenticator build() { - return new MultiAuthenticator(registry); - } - } - -} +/* + * 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.standard.util; + +import java.io.IOException; +import java.net.Proxy; +import java.util.HashMap; +import java.util.Map; + +import com.burgstaller.okhttp.DispatchingAuthenticator; +import com.squareup.okhttp.Authenticator; +import com.squareup.okhttp.Credentials; +import com.squareup.okhttp.Request; +import com.squareup.okhttp.Response; + +public class MultiAuthenticator extends DispatchingAuthenticator { + + public MultiAuthenticator(Map<String, Authenticator> registry) { + super(registry); + } + + private String proxyUsername; + private String proxyPassword; + + @Override + public Request authenticateProxy(Proxy proxy, Response response) throws IOException { + String credential = Credentials.basic(proxyUsername, proxyPassword); + return response.request() + .newBuilder() + .header("Proxy-Authorization", credential) + .build(); + } + + public void setProxyUsername(String proxyUsername) { + this.proxyUsername = proxyUsername; + } + + public void setProxyPassword(String proxyPassword) { + this.proxyPassword = proxyPassword; + } + + public static final class Builder { + Map<String, Authenticator> registry = new HashMap<>(); + + public Builder with(String scheme, Authenticator authenticator) { + registry.put(scheme, authenticator); + return this; + } + + public MultiAuthenticator build() { + return new MultiAuthenticator(registry); + } + } + +} http://git-wip-us.apache.org/repos/asf/nifi/blob/2dc45a4d/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.DebugFlow/additionalDetails.html ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.DebugFlow/additionalDetails.html b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.DebugFlow/additionalDetails.html index 76249ef..9981b4a 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.DebugFlow/additionalDetails.html +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.DebugFlow/additionalDetails.html @@ -1,48 +1,48 @@ -<!DOCTYPE html> -<html lang="en"> - <!-- - 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. - --> - <head> - <meta charset="utf-8"/> - <title>DebugFlow</title> - <link rel="stylesheet" href="../../../../../css/component-usage.css" type="text/css"/> - </head> - - <body> - <!-- Processor Documentation ================================================== --> - <p> - When triggered, the processor loops through the appropriate response list (based on whether or not it - received a FlowFile). A response is produced the configured number of times for each pass through its - response list, as long as the processor is running. - </p><p> - Triggered by a FlowFile, the processor can produce the following responses. - <ol> - <li>transfer FlowFile to success relationship.</li> - <li>transfer FlowFile to failure relationship.</li> - <li>rollback the FlowFile without penalty.</li> - <li>rollback the FlowFile and yield the context.</li> - <li>rollback the FlowFile with penalty.</li> - <li>throw an exception.</li> - </ol> - </p><p> - Triggered without a FlowFile, the processor can produce the following responses. - <ol> - <li>do nothing and return.</li> - <li>throw an exception.</li> - <li>yield the context.</li> - </ol> - </p> - </body> -</html> +<!DOCTYPE html> +<html lang="en"> + <!-- + 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. + --> + <head> + <meta charset="utf-8"/> + <title>DebugFlow</title> + <link rel="stylesheet" href="../../../../../css/component-usage.css" type="text/css"/> + </head> + + <body> + <!-- Processor Documentation ================================================== --> + <p> + When triggered, the processor loops through the appropriate response list (based on whether or not it + received a FlowFile). A response is produced the configured number of times for each pass through its + response list, as long as the processor is running. + </p><p> + Triggered by a FlowFile, the processor can produce the following responses. + <ol> + <li>transfer FlowFile to success relationship.</li> + <li>transfer FlowFile to failure relationship.</li> + <li>rollback the FlowFile without penalty.</li> + <li>rollback the FlowFile and yield the context.</li> + <li>rollback the FlowFile with penalty.</li> + <li>throw an exception.</li> + </ol> + </p><p> + Triggered without a FlowFile, the processor can produce the following responses. + <ol> + <li>do nothing and return.</li> + <li>throw an exception.</li> + <li>yield the context.</li> + </ol> + </p> + </body> +</html> http://git-wip-us.apache.org/repos/asf/nifi/blob/2dc45a4d/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.EncryptContent/additionalDetails.html ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.EncryptContent/additionalDetails.html b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.EncryptContent/additionalDetails.html index eee9848..7dab982 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.EncryptContent/additionalDetails.html +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/resources/docs/org.apache.nifi.processors.standard.EncryptContent/additionalDetails.html @@ -1,30 +1,30 @@ -<!DOCTYPE html> -<html lang="en"> - <!-- - 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. - --> - <head> - <meta charset="utf-8"/> - <title>EncryptContent</title> - <link rel="stylesheet" href="../../../../../css/component-usage.css" type="text/css"/> - </head> - - <body> - <!-- Processor Documentation ================================================== --> - <p> - <strong>Note:</strong> This processor supports OpenPGP algorithms that are compatible with third party programs. - However, it currently cannot add a digital signature to an encrypted FlowFile. - </p> - </body> -</html> +<!DOCTYPE html> +<html lang="en"> + <!-- + 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. + --> + <head> + <meta charset="utf-8"/> + <title>EncryptContent</title> + <link rel="stylesheet" href="../../../../../css/component-usage.css" type="text/css"/> + </head> + + <body> + <!-- Processor Documentation ================================================== --> + <p> + <strong>Note:</strong> This processor supports OpenPGP algorithms that are compatible with third party programs. + However, it currently cannot add a digital signature to an encrypted FlowFile. + </p> + </body> +</html>
