mirror of https://github.com/apache/nifi.git
NIFI-4154 Fixing line endings in .java,.html files
Signed-off-by: James Wing <jvwing@gmail.com> This closes #1982.
This commit is contained in:
parent
affc88e599
commit
2dc45a4dd7
|
@ -1,30 +1,30 @@
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
* this work for additional information regarding copyright ownership.
|
* this work for additional information regarding copyright ownership.
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
* 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 not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at
|
* the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.nifi.util;
|
package org.apache.nifi.util;
|
||||||
|
|
||||||
import org.apache.nifi.flowfile.FlowFile;
|
import org.apache.nifi.flowfile.FlowFile;
|
||||||
|
|
||||||
public interface FlowFileValidator {
|
public interface FlowFileValidator {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define a verification method to validate the given FlowFile
|
* Define a verification method to validate the given FlowFile
|
||||||
*
|
*
|
||||||
* @param f Flow file
|
* @param f Flow file
|
||||||
*/
|
*/
|
||||||
void assertFlowFile(FlowFile f);
|
void assertFlowFile(FlowFile f);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,89 +1,89 @@
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
* this work for additional information regarding copyright ownership.
|
* this work for additional information regarding copyright ownership.
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
* 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 not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at
|
* the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.nifi.amqp.processors;
|
package org.apache.nifi.amqp.processors;
|
||||||
|
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
import org.apache.nifi.authentication.exception.ProviderCreationException;
|
import org.apache.nifi.authentication.exception.ProviderCreationException;
|
||||||
import org.apache.nifi.processor.ProcessContext;
|
import org.apache.nifi.processor.ProcessContext;
|
||||||
import org.apache.nifi.processor.ProcessSession;
|
import org.apache.nifi.processor.ProcessSession;
|
||||||
import org.apache.nifi.processor.exception.ProcessException;
|
import org.apache.nifi.processor.exception.ProcessException;
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
import org.apache.nifi.util.TestRunner;
|
import org.apache.nifi.util.TestRunner;
|
||||||
import org.apache.nifi.util.TestRunners;
|
import org.apache.nifi.util.TestRunners;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for the AbstractAMQPProcessor class
|
* Unit tests for the AbstractAMQPProcessor class
|
||||||
*/
|
*/
|
||||||
public class AbstractAMQPProcessorTest {
|
public class AbstractAMQPProcessorTest {
|
||||||
|
|
||||||
MockAbstractAMQPProcessor processor;
|
MockAbstractAMQPProcessor processor;
|
||||||
private TestRunner testRunner;
|
private TestRunner testRunner;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
processor = new MockAbstractAMQPProcessor();
|
processor = new MockAbstractAMQPProcessor();
|
||||||
testRunner = TestRunners.newTestRunner(processor);
|
testRunner = TestRunners.newTestRunner(processor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = ProviderCreationException.class)
|
@Test(expected = ProviderCreationException.class)
|
||||||
public void testConnectToCassandraWithSSLBadClientAuth() throws Exception {
|
public void testConnectToCassandraWithSSLBadClientAuth() throws Exception {
|
||||||
SSLContextService sslService = mock(SSLContextService.class);
|
SSLContextService sslService = mock(SSLContextService.class);
|
||||||
when(sslService.getIdentifier()).thenReturn("ssl-context");
|
when(sslService.getIdentifier()).thenReturn("ssl-context");
|
||||||
testRunner.addControllerService("ssl-context", sslService);
|
testRunner.addControllerService("ssl-context", sslService);
|
||||||
testRunner.enableControllerService(sslService);
|
testRunner.enableControllerService(sslService);
|
||||||
testRunner.setProperty(AbstractAMQPProcessor.SSL_CONTEXT_SERVICE, "ssl-context");
|
testRunner.setProperty(AbstractAMQPProcessor.SSL_CONTEXT_SERVICE, "ssl-context");
|
||||||
testRunner.setProperty(AbstractAMQPProcessor.USE_CERT_AUTHENTICATION, "false");
|
testRunner.setProperty(AbstractAMQPProcessor.USE_CERT_AUTHENTICATION, "false");
|
||||||
testRunner.setProperty(AbstractAMQPProcessor.HOST, "test");
|
testRunner.setProperty(AbstractAMQPProcessor.HOST, "test");
|
||||||
testRunner.setProperty(AbstractAMQPProcessor.PORT, "9999");
|
testRunner.setProperty(AbstractAMQPProcessor.PORT, "9999");
|
||||||
testRunner.setProperty(AbstractAMQPProcessor.USER, "test");
|
testRunner.setProperty(AbstractAMQPProcessor.USER, "test");
|
||||||
testRunner.setProperty(AbstractAMQPProcessor.PASSWORD, "test");
|
testRunner.setProperty(AbstractAMQPProcessor.PASSWORD, "test");
|
||||||
testRunner.assertValid(sslService);
|
testRunner.assertValid(sslService);
|
||||||
testRunner.setProperty(AbstractAMQPProcessor.CLIENT_AUTH, "BAD");
|
testRunner.setProperty(AbstractAMQPProcessor.CLIENT_AUTH, "BAD");
|
||||||
processor.onTrigger(testRunner.getProcessContext(), testRunner.getProcessSessionFactory());
|
processor.onTrigger(testRunner.getProcessContext(), testRunner.getProcessSessionFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = ProviderCreationException.class)
|
@Test(expected = ProviderCreationException.class)
|
||||||
public void testInvalidSSLConfiguration() throws Exception {
|
public void testInvalidSSLConfiguration() throws Exception {
|
||||||
// it's invalid to have use_cert_auth enabled and not have the SSL Context Service configured
|
// 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.USE_CERT_AUTHENTICATION, "true");
|
||||||
testRunner.setProperty(AbstractAMQPProcessor.HOST, "test");
|
testRunner.setProperty(AbstractAMQPProcessor.HOST, "test");
|
||||||
testRunner.setProperty(AbstractAMQPProcessor.PORT, "9999");
|
testRunner.setProperty(AbstractAMQPProcessor.PORT, "9999");
|
||||||
testRunner.setProperty(AbstractAMQPProcessor.USER, "test");
|
testRunner.setProperty(AbstractAMQPProcessor.USER, "test");
|
||||||
testRunner.setProperty(AbstractAMQPProcessor.PASSWORD, "test");
|
testRunner.setProperty(AbstractAMQPProcessor.PASSWORD, "test");
|
||||||
processor.onTrigger(testRunner.getProcessContext(), testRunner.getProcessSessionFactory());
|
processor.onTrigger(testRunner.getProcessContext(), testRunner.getProcessSessionFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a stubbed processor instance for testing
|
* Provides a stubbed processor instance for testing
|
||||||
*/
|
*/
|
||||||
public static class MockAbstractAMQPProcessor extends AbstractAMQPProcessor<AMQPConsumer> {
|
public static class MockAbstractAMQPProcessor extends AbstractAMQPProcessor<AMQPConsumer> {
|
||||||
@Override
|
@Override
|
||||||
protected void rendezvousWithAmqp(ProcessContext context, ProcessSession session) throws ProcessException {
|
protected void rendezvousWithAmqp(ProcessContext context, ProcessSession session) throws ProcessException {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected AMQPConsumer finishBuildingTargetResource(ProcessContext context) {
|
protected AMQPConsumer finishBuildingTargetResource(ProcessContext context) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,43 +1,43 @@
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
* this work for additional information regarding copyright ownership.
|
* this work for additional information regarding copyright ownership.
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
* 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 not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at
|
* the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.nifi.util;
|
package org.apache.nifi.util;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.xml.sax.SAXParseException;
|
import org.xml.sax.SAXParseException;
|
||||||
import org.xml.sax.helpers.DefaultHandler;
|
import org.xml.sax.helpers.DefaultHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ErrorHandler implementation for Logging XML schema validation errors
|
* ErrorHandler implementation for Logging XML schema validation errors
|
||||||
*/
|
*/
|
||||||
public class LoggingXmlParserErrorHandler extends DefaultHandler {
|
public class LoggingXmlParserErrorHandler extends DefaultHandler {
|
||||||
|
|
||||||
private final Logger logger;
|
private final Logger logger;
|
||||||
private final String xmlDocTitle;
|
private final String xmlDocTitle;
|
||||||
private static final String MESSAGE_FORMAT = "Schema validation %s parsing %s at line %d, col %d: %s";
|
private static final String MESSAGE_FORMAT = "Schema validation %s parsing %s at line %d, col %d: %s";
|
||||||
|
|
||||||
public LoggingXmlParserErrorHandler(String xmlDocTitle, Logger logger) {
|
public LoggingXmlParserErrorHandler(String xmlDocTitle, Logger logger) {
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.xmlDocTitle = xmlDocTitle;
|
this.xmlDocTitle = xmlDocTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void error(final SAXParseException err) throws SAXParseException {
|
public void error(final SAXParseException err) throws SAXParseException {
|
||||||
String message = String.format(MESSAGE_FORMAT, "error", xmlDocTitle, err.getLineNumber(),
|
String message = String.format(MESSAGE_FORMAT, "error", xmlDocTitle, err.getLineNumber(),
|
||||||
err.getColumnNumber(), err.getMessage());
|
err.getColumnNumber(), err.getMessage());
|
||||||
logger.warn(message);
|
logger.warn(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,104 +1,104 @@
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
* this work for additional information regarding copyright ownership.
|
* this work for additional information regarding copyright ownership.
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
* 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 not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at
|
* the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.nifi.processors.mongodb;
|
package org.apache.nifi.processors.mongodb;
|
||||||
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
import static org.mockito.Mockito.any;
|
import static org.mockito.Mockito.any;
|
||||||
|
|
||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
|
|
||||||
import org.apache.nifi.authentication.exception.ProviderCreationException;
|
import org.apache.nifi.authentication.exception.ProviderCreationException;
|
||||||
import org.apache.nifi.processor.ProcessContext;
|
import org.apache.nifi.processor.ProcessContext;
|
||||||
import org.apache.nifi.processor.ProcessSession;
|
import org.apache.nifi.processor.ProcessSession;
|
||||||
import org.apache.nifi.processor.exception.ProcessException;
|
import org.apache.nifi.processor.exception.ProcessException;
|
||||||
import org.apache.nifi.ssl.SSLContextService;
|
import org.apache.nifi.ssl.SSLContextService;
|
||||||
import org.apache.nifi.ssl.SSLContextService.ClientAuth;
|
import org.apache.nifi.ssl.SSLContextService.ClientAuth;
|
||||||
import org.apache.nifi.util.TestRunner;
|
import org.apache.nifi.util.TestRunner;
|
||||||
import org.apache.nifi.util.TestRunners;
|
import org.apache.nifi.util.TestRunners;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import com.mongodb.MongoClientOptions;
|
import com.mongodb.MongoClientOptions;
|
||||||
import com.mongodb.MongoClientOptions.Builder;
|
import com.mongodb.MongoClientOptions.Builder;
|
||||||
|
|
||||||
public class AbstractMongoProcessorTest {
|
public class AbstractMongoProcessorTest {
|
||||||
|
|
||||||
MockAbstractMongoProcessor processor;
|
MockAbstractMongoProcessor processor;
|
||||||
private TestRunner testRunner;
|
private TestRunner testRunner;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
processor = new MockAbstractMongoProcessor();
|
processor = new MockAbstractMongoProcessor();
|
||||||
testRunner = TestRunners.newTestRunner(processor);
|
testRunner = TestRunners.newTestRunner(processor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testcreateClientWithSSL() throws Exception {
|
public void testcreateClientWithSSL() throws Exception {
|
||||||
SSLContextService sslService = mock(SSLContextService.class);
|
SSLContextService sslService = mock(SSLContextService.class);
|
||||||
SSLContext sslContext = mock(SSLContext.class);
|
SSLContext sslContext = mock(SSLContext.class);
|
||||||
when(sslService.getIdentifier()).thenReturn("ssl-context");
|
when(sslService.getIdentifier()).thenReturn("ssl-context");
|
||||||
when(sslService.createSSLContext(any(ClientAuth.class))).thenReturn(sslContext);
|
when(sslService.createSSLContext(any(ClientAuth.class))).thenReturn(sslContext);
|
||||||
testRunner.addControllerService("ssl-context", sslService);
|
testRunner.addControllerService("ssl-context", sslService);
|
||||||
testRunner.enableControllerService(sslService);
|
testRunner.enableControllerService(sslService);
|
||||||
testRunner.setProperty(AbstractMongoProcessor.URI, "mongodb://localhost:27017");
|
testRunner.setProperty(AbstractMongoProcessor.URI, "mongodb://localhost:27017");
|
||||||
testRunner.setProperty(AbstractMongoProcessor.SSL_CONTEXT_SERVICE, "ssl-context");
|
testRunner.setProperty(AbstractMongoProcessor.SSL_CONTEXT_SERVICE, "ssl-context");
|
||||||
testRunner.assertValid(sslService);
|
testRunner.assertValid(sslService);
|
||||||
processor.createClient(testRunner.getProcessContext());
|
processor.createClient(testRunner.getProcessContext());
|
||||||
assertNotNull(processor.mongoClient);
|
assertNotNull(processor.mongoClient);
|
||||||
processor.mongoClient = null;
|
processor.mongoClient = null;
|
||||||
testRunner.setProperty(AbstractMongoProcessor.CLIENT_AUTH, "WANT");
|
testRunner.setProperty(AbstractMongoProcessor.CLIENT_AUTH, "WANT");
|
||||||
processor.createClient(testRunner.getProcessContext());
|
processor.createClient(testRunner.getProcessContext());
|
||||||
assertNotNull(processor.mongoClient);
|
assertNotNull(processor.mongoClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = ProviderCreationException.class)
|
@Test(expected = ProviderCreationException.class)
|
||||||
public void testcreateClientWithSSLBadClientAuth() throws Exception {
|
public void testcreateClientWithSSLBadClientAuth() throws Exception {
|
||||||
SSLContextService sslService = mock(SSLContextService.class);
|
SSLContextService sslService = mock(SSLContextService.class);
|
||||||
SSLContext sslContext = mock(SSLContext.class);
|
SSLContext sslContext = mock(SSLContext.class);
|
||||||
when(sslService.getIdentifier()).thenReturn("ssl-context");
|
when(sslService.getIdentifier()).thenReturn("ssl-context");
|
||||||
when(sslService.createSSLContext(any(ClientAuth.class))).thenReturn(sslContext);
|
when(sslService.createSSLContext(any(ClientAuth.class))).thenReturn(sslContext);
|
||||||
testRunner.addControllerService("ssl-context", sslService);
|
testRunner.addControllerService("ssl-context", sslService);
|
||||||
testRunner.enableControllerService(sslService);
|
testRunner.enableControllerService(sslService);
|
||||||
testRunner.setProperty(AbstractMongoProcessor.URI, "mongodb://localhost:27017");
|
testRunner.setProperty(AbstractMongoProcessor.URI, "mongodb://localhost:27017");
|
||||||
testRunner.setProperty(AbstractMongoProcessor.SSL_CONTEXT_SERVICE, "ssl-context");
|
testRunner.setProperty(AbstractMongoProcessor.SSL_CONTEXT_SERVICE, "ssl-context");
|
||||||
testRunner.assertValid(sslService);
|
testRunner.assertValid(sslService);
|
||||||
processor.createClient(testRunner.getProcessContext());
|
processor.createClient(testRunner.getProcessContext());
|
||||||
assertNotNull(processor.mongoClient);
|
assertNotNull(processor.mongoClient);
|
||||||
processor.mongoClient = null;
|
processor.mongoClient = null;
|
||||||
testRunner.setProperty(AbstractMongoProcessor.CLIENT_AUTH, "BAD");
|
testRunner.setProperty(AbstractMongoProcessor.CLIENT_AUTH, "BAD");
|
||||||
processor.createClient(testRunner.getProcessContext());
|
processor.createClient(testRunner.getProcessContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a stubbed processor instance for testing
|
* Provides a stubbed processor instance for testing
|
||||||
*/
|
*/
|
||||||
public static class MockAbstractMongoProcessor extends AbstractMongoProcessor {
|
public static class MockAbstractMongoProcessor extends AbstractMongoProcessor {
|
||||||
@Override
|
@Override
|
||||||
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
|
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Builder getClientOptions(SSLContext sslContext) {
|
protected Builder getClientOptions(SSLContext sslContext) {
|
||||||
return MongoClientOptions.builder();
|
return MongoClientOptions.builder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,69 +1,69 @@
|
||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
* contributor license agreements. See the NOTICE file distributed with
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
* this work for additional information regarding copyright ownership.
|
* this work for additional information regarding copyright ownership.
|
||||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
* 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 not use this file except in compliance with
|
||||||
* the License. You may obtain a copy of the License at
|
* the License. You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.apache.nifi.processors.standard.util;
|
package org.apache.nifi.processors.standard.util;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.Proxy;
|
import java.net.Proxy;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.burgstaller.okhttp.DispatchingAuthenticator;
|
import com.burgstaller.okhttp.DispatchingAuthenticator;
|
||||||
import com.squareup.okhttp.Authenticator;
|
import com.squareup.okhttp.Authenticator;
|
||||||
import com.squareup.okhttp.Credentials;
|
import com.squareup.okhttp.Credentials;
|
||||||
import com.squareup.okhttp.Request;
|
import com.squareup.okhttp.Request;
|
||||||
import com.squareup.okhttp.Response;
|
import com.squareup.okhttp.Response;
|
||||||
|
|
||||||
public class MultiAuthenticator extends DispatchingAuthenticator {
|
public class MultiAuthenticator extends DispatchingAuthenticator {
|
||||||
|
|
||||||
public MultiAuthenticator(Map<String, Authenticator> registry) {
|
public MultiAuthenticator(Map<String, Authenticator> registry) {
|
||||||
super(registry);
|
super(registry);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String proxyUsername;
|
private String proxyUsername;
|
||||||
private String proxyPassword;
|
private String proxyPassword;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Request authenticateProxy(Proxy proxy, Response response) throws IOException {
|
public Request authenticateProxy(Proxy proxy, Response response) throws IOException {
|
||||||
String credential = Credentials.basic(proxyUsername, proxyPassword);
|
String credential = Credentials.basic(proxyUsername, proxyPassword);
|
||||||
return response.request()
|
return response.request()
|
||||||
.newBuilder()
|
.newBuilder()
|
||||||
.header("Proxy-Authorization", credential)
|
.header("Proxy-Authorization", credential)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProxyUsername(String proxyUsername) {
|
public void setProxyUsername(String proxyUsername) {
|
||||||
this.proxyUsername = proxyUsername;
|
this.proxyUsername = proxyUsername;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProxyPassword(String proxyPassword) {
|
public void setProxyPassword(String proxyPassword) {
|
||||||
this.proxyPassword = proxyPassword;
|
this.proxyPassword = proxyPassword;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final class Builder {
|
public static final class Builder {
|
||||||
Map<String, Authenticator> registry = new HashMap<>();
|
Map<String, Authenticator> registry = new HashMap<>();
|
||||||
|
|
||||||
public Builder with(String scheme, Authenticator authenticator) {
|
public Builder with(String scheme, Authenticator authenticator) {
|
||||||
registry.put(scheme, authenticator);
|
registry.put(scheme, authenticator);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MultiAuthenticator build() {
|
public MultiAuthenticator build() {
|
||||||
return new MultiAuthenticator(registry);
|
return new MultiAuthenticator(registry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,48 +1,48 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<!--
|
<!--
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
this work for additional information regarding copyright ownership.
|
this work for additional information regarding copyright ownership.
|
||||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
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 not use this file except in compliance with
|
||||||
the License. You may obtain a copy of the License at
|
the License. You may obtain a copy of the License at
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<title>DebugFlow</title>
|
<title>DebugFlow</title>
|
||||||
<link rel="stylesheet" href="../../../../../css/component-usage.css" type="text/css"/>
|
<link rel="stylesheet" href="../../../../../css/component-usage.css" type="text/css"/>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<!-- Processor Documentation ================================================== -->
|
<!-- Processor Documentation ================================================== -->
|
||||||
<p>
|
<p>
|
||||||
When triggered, the processor loops through the appropriate response list (based on whether or not it
|
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
|
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.
|
response list, as long as the processor is running.
|
||||||
</p><p>
|
</p><p>
|
||||||
Triggered by a FlowFile, the processor can produce the following responses.
|
Triggered by a FlowFile, the processor can produce the following responses.
|
||||||
<ol>
|
<ol>
|
||||||
<li>transfer FlowFile to success relationship.</li>
|
<li>transfer FlowFile to success relationship.</li>
|
||||||
<li>transfer FlowFile to failure relationship.</li>
|
<li>transfer FlowFile to failure relationship.</li>
|
||||||
<li>rollback the FlowFile without penalty.</li>
|
<li>rollback the FlowFile without penalty.</li>
|
||||||
<li>rollback the FlowFile and yield the context.</li>
|
<li>rollback the FlowFile and yield the context.</li>
|
||||||
<li>rollback the FlowFile with penalty.</li>
|
<li>rollback the FlowFile with penalty.</li>
|
||||||
<li>throw an exception.</li>
|
<li>throw an exception.</li>
|
||||||
</ol>
|
</ol>
|
||||||
</p><p>
|
</p><p>
|
||||||
Triggered without a FlowFile, the processor can produce the following responses.
|
Triggered without a FlowFile, the processor can produce the following responses.
|
||||||
<ol>
|
<ol>
|
||||||
<li>do nothing and return.</li>
|
<li>do nothing and return.</li>
|
||||||
<li>throw an exception.</li>
|
<li>throw an exception.</li>
|
||||||
<li>yield the context.</li>
|
<li>yield the context.</li>
|
||||||
</ol>
|
</ol>
|
||||||
</p>
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,30 +1,30 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<!--
|
<!--
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
this work for additional information regarding copyright ownership.
|
this work for additional information regarding copyright ownership.
|
||||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
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 not use this file except in compliance with
|
||||||
the License. You may obtain a copy of the License at
|
the License. You may obtain a copy of the License at
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
Unless required by applicable law or agreed to in writing, software
|
Unless required by applicable law or agreed to in writing, software
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<title>EncryptContent</title>
|
<title>EncryptContent</title>
|
||||||
<link rel="stylesheet" href="../../../../../css/component-usage.css" type="text/css"/>
|
<link rel="stylesheet" href="../../../../../css/component-usage.css" type="text/css"/>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<!-- Processor Documentation ================================================== -->
|
<!-- Processor Documentation ================================================== -->
|
||||||
<p>
|
<p>
|
||||||
<strong>Note:</strong> This processor supports OpenPGP algorithms that are compatible with third party programs.
|
<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.
|
However, it currently cannot add a digital signature to an encrypted FlowFile.
|
||||||
</p>
|
</p>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue