http://git-wip-us.apache.org/repos/asf/nifi/blob/4c787799/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateCounter.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateCounter.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateCounter.java index 291736a..5115817 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateCounter.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateCounter.java @@ -21,6 +21,7 @@ import org.apache.nifi.annotation.behavior.ReadsAttribute; import org.apache.nifi.annotation.documentation.CapabilityDescription; import org.apache.nifi.annotation.documentation.Tags; import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.expression.ExpressionLanguageScope; import org.apache.nifi.flowfile.FlowFile; import org.apache.nifi.processor.Relationship; import org.apache.nifi.processor.AbstractProcessor; @@ -51,7 +52,7 @@ public class UpdateCounter extends AbstractProcessor { .required(true) .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) .addValidator(StandardValidators.ATTRIBUTE_EXPRESSION_LANGUAGE_VALIDATOR) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .build(); static final PropertyDescriptor DELTA = new PropertyDescriptor.Builder() @@ -62,7 +63,7 @@ public class UpdateCounter extends AbstractProcessor { .defaultValue("1") .addValidator(StandardValidators.INTEGER_VALIDATOR) .addValidator(StandardValidators.ATTRIBUTE_EXPRESSION_LANGUAGE_VALIDATOR) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .build(); static final Relationship SUCCESS = new Relationship.Builder()
http://git-wip-us.apache.org/repos/asf/nifi/blob/4c787799/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateRecord.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateRecord.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateRecord.java index 63e05ab..9b5d209 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateRecord.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/UpdateRecord.java @@ -40,6 +40,7 @@ import org.apache.nifi.components.PropertyDescriptor; import org.apache.nifi.components.PropertyValue; import org.apache.nifi.components.ValidationContext; import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.expression.ExpressionLanguageScope; import org.apache.nifi.flowfile.FlowFile; import org.apache.nifi.processor.ProcessContext; import org.apache.nifi.record.path.FieldValue; @@ -87,7 +88,7 @@ public class UpdateRecord extends AbstractRecordProcessor { .description("Specifies how to interpret the configured replacement values") .allowableValues(LITERAL_VALUES, RECORD_PATH_VALUES) .defaultValue(LITERAL_VALUES.getValue()) - .expressionLanguageSupported(false) + .expressionLanguageSupported(ExpressionLanguageScope.NONE) .required(true) .build(); @@ -105,7 +106,7 @@ public class UpdateRecord extends AbstractRecordProcessor { .description("Specifies the value to use to replace fields in the record that match the RecordPath: " + propertyDescriptorName) .required(false) .dynamic(true) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .addValidator(new RecordPathPropertyNameValidator()) .build(); } @@ -179,7 +180,7 @@ public class UpdateRecord extends AbstractRecordProcessor { fieldVal.updateValue(evaluatedReplacementVal); }); } else { - final String evaluatedReplacementVal = replacementValue.getValue(); + final String evaluatedReplacementVal = replacementValue.evaluateAttributeExpressions(flowFile).getValue(); result.getSelectedFields().forEach(fieldVal -> fieldVal.updateValue(evaluatedReplacementVal)); } } http://git-wip-us.apache.org/repos/asf/nifi/blob/4c787799/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java index b661245..667d4f9 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ValidateCsv.java @@ -44,6 +44,7 @@ import org.apache.nifi.components.PropertyDescriptor; import org.apache.nifi.components.PropertyValue; import org.apache.nifi.components.ValidationContext; import org.apache.nifi.components.ValidationResult; +import org.apache.nifi.expression.ExpressionLanguageScope; import org.apache.nifi.flowfile.FlowFile; import org.apache.nifi.logging.ComponentLog; import org.apache.nifi.processor.AbstractProcessor; @@ -120,7 +121,7 @@ public class ValidateCsv extends AbstractProcessor { + "processors to apply. The following cell processors are allowed in the schema definition: " + allowedOperators.toString() + ". Note: cell processors cannot be nested except with Optional.") .required(true) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .addValidator(StandardValidators.NON_EMPTY_EL_VALIDATOR) .build(); @@ -140,7 +141,7 @@ public class ValidateCsv extends AbstractProcessor { .description("Character used as 'quote' in the incoming data. Example: \"") .required(true) .defaultValue("\"") - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) .build(); @@ -150,7 +151,7 @@ public class ValidateCsv extends AbstractProcessor { .description("Character used as 'delimiter' in the incoming data. Example: ,") .required(true) .defaultValue(",") - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) .build(); @@ -160,7 +161,7 @@ public class ValidateCsv extends AbstractProcessor { .description("Symbols used as 'end of line' in the incoming data. Example: \\n") .required(true) .defaultValue("\\n") - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) .build(); http://git-wip-us.apache.org/repos/asf/nifi/blob/4c787799/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/Wait.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/Wait.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/Wait.java index 928d179..cfec15e 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/Wait.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/Wait.java @@ -48,6 +48,7 @@ import org.apache.nifi.components.PropertyDescriptor; import org.apache.nifi.components.PropertyValue; import org.apache.nifi.distributed.cache.client.AtomicDistributedMapCacheClient; import org.apache.nifi.expression.AttributeExpression.ResultType; +import org.apache.nifi.expression.ExpressionLanguageScope; import org.apache.nifi.flowfile.FlowFile; import org.apache.nifi.logging.ComponentLog; import org.apache.nifi.processor.AbstractProcessor; @@ -110,7 +111,7 @@ public class Wait extends AbstractProcessor { "be evaluated against a FlowFile in order to determine the release signal cache key") .required(true) .addValidator(StandardValidators.createAttributeExpressionLanguageValidator(ResultType.STRING, true)) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .build(); public static final PropertyDescriptor TARGET_SIGNAL_COUNT = new PropertyDescriptor.Builder() @@ -123,7 +124,7 @@ public class Wait extends AbstractProcessor { "otherwise checks against total count in a signal.") .required(true) .addValidator(StandardValidators.NON_NEGATIVE_INTEGER_VALIDATOR) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .defaultValue("1") .build(); @@ -135,7 +136,7 @@ public class Wait extends AbstractProcessor { "If not specified, this processor checks the total count in a signal.") .required(false) .addValidator(StandardValidators.createAttributeExpressionLanguageValidator(ResultType.STRING, true)) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .build(); public static final PropertyDescriptor WAIT_BUFFER_COUNT = new PropertyDescriptor.Builder() @@ -159,7 +160,7 @@ public class Wait extends AbstractProcessor { "Zero (0) has a special meaning, any number of FlowFiles can be released as long as signal count matches target.") .required(true) .addValidator(StandardValidators.NON_NEGATIVE_INTEGER_VALIDATOR) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .defaultValue("1") .build(); @@ -171,7 +172,7 @@ public class Wait extends AbstractProcessor { .required(true) .defaultValue("10 min") .addValidator(StandardValidators.TIME_PERIOD_VALIDATOR) - .expressionLanguageSupported(false) + .expressionLanguageSupported(ExpressionLanguageScope.NONE) .build(); public static final AllowableValue ATTRIBUTE_COPY_REPLACE = new AllowableValue("replace", "Replace if present", @@ -187,7 +188,7 @@ public class Wait extends AbstractProcessor { .defaultValue(ATTRIBUTE_COPY_KEEP_ORIGINAL.getValue()) .required(true) .allowableValues(ATTRIBUTE_COPY_REPLACE, ATTRIBUTE_COPY_KEEP_ORIGINAL) - .expressionLanguageSupported(false) + .expressionLanguageSupported(ExpressionLanguageScope.NONE) .build(); public static final AllowableValue WAIT_MODE_TRANSFER_TO_WAIT = new AllowableValue("wait", "Transfer to wait relationship", @@ -207,7 +208,7 @@ public class Wait extends AbstractProcessor { .defaultValue(WAIT_MODE_TRANSFER_TO_WAIT.getValue()) .required(true) .allowableValues(WAIT_MODE_TRANSFER_TO_WAIT, WAIT_MODE_KEEP_IN_UPSTREAM) - .expressionLanguageSupported(false) + .expressionLanguageSupported(ExpressionLanguageScope.NONE) .build(); public static final Relationship REL_SUCCESS = new Relationship.Builder() http://git-wip-us.apache.org/repos/asf/nifi/blob/4c787799/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java index 7a40612..91a5ac2 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FTPTransfer.java @@ -39,6 +39,7 @@ import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.net.ftp.FTPHTTPClient; import org.apache.commons.net.ftp.FTPReply; import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.expression.ExpressionLanguageScope; import org.apache.nifi.flowfile.FlowFile; import org.apache.nifi.logging.ComponentLog; import org.apache.nifi.processor.DataUnit; @@ -75,7 +76,7 @@ public class FTPTransfer implements FileTransfer { .addValidator(StandardValidators.PORT_VALIDATOR) .required(true) .defaultValue("21") - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .build(); public static final PropertyDescriptor PROXY_TYPE = new PropertyDescriptor.Builder() .name("Proxy Type") http://git-wip-us.apache.org/repos/asf/nifi/blob/4c787799/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FileTransfer.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FileTransfer.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FileTransfer.java index ac7f728..1163ea8 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FileTransfer.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/FileTransfer.java @@ -24,6 +24,7 @@ import java.util.List; import org.apache.nifi.components.PropertyDescriptor; import org.apache.nifi.components.Validator; +import org.apache.nifi.expression.ExpressionLanguageScope; import org.apache.nifi.flowfile.FlowFile; import org.apache.nifi.processor.util.StandardValidators; @@ -62,14 +63,14 @@ public interface FileTransfer extends Closeable { .description("The fully qualified hostname or IP address of the remote system") .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) .required(true) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .build(); public static final PropertyDescriptor USERNAME = new PropertyDescriptor.Builder() .name("Username") .description("Username") .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) .required(true) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .build(); public static final PropertyDescriptor PASSWORD = new PropertyDescriptor.Builder() .name("Password") @@ -77,7 +78,7 @@ public interface FileTransfer extends Closeable { .addValidator(Validator.VALID) .required(false) .sensitive(true) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .build(); public static final PropertyDescriptor DATA_TIMEOUT = new PropertyDescriptor.Builder() .name("Data Timeout") @@ -98,7 +99,7 @@ public interface FileTransfer extends Closeable { .description("The path on the remote system from which to pull or push files") .required(false) .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY) .build(); public static final PropertyDescriptor CREATE_DIRECTORY = new PropertyDescriptor.Builder() .name("Create Directory") @@ -217,7 +218,7 @@ public interface FileTransfer extends Closeable { .description("If set, the filename of the sent file will be equal to the value specified during the transfer and after successful " + "completion will be renamed to the original filename. If this value is set, the Dot Rename property is ignored.") .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .required(false) .build(); public static final PropertyDescriptor LAST_MODIFIED_TIME = new PropertyDescriptor.Builder() @@ -227,7 +228,7 @@ public interface FileTransfer extends Closeable { + "is invalid, the processor will not be invalid but will fail to change lastModifiedTime of the file.") .required(false) .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .build(); public static final PropertyDescriptor PERMISSIONS = new PropertyDescriptor.Builder() .name("Permissions") @@ -237,7 +238,7 @@ public interface FileTransfer extends Closeable { + "fail to change permissions of the file.") .required(false) .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .build(); public static final PropertyDescriptor REMOTE_OWNER = new PropertyDescriptor.Builder() .name("Remote Owner") @@ -246,7 +247,7 @@ public interface FileTransfer extends Closeable { + "will fail to change the owner of the file.") .required(false) .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .build(); public static final PropertyDescriptor REMOTE_GROUP = new PropertyDescriptor.Builder() .name("Remote Group") @@ -255,7 +256,7 @@ public interface FileTransfer extends Closeable { + "will fail to change the group of the file.") .required(false) .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .build(); public static final PropertyDescriptor BATCH_SIZE = new PropertyDescriptor.Builder() .name("Batch Size") http://git-wip-us.apache.org/repos/asf/nifi/blob/4c787799/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JdbcCommon.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JdbcCommon.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JdbcCommon.java index 1cee441..b203c31 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JdbcCommon.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JdbcCommon.java @@ -97,6 +97,7 @@ import org.apache.avro.io.DatumWriter; import org.apache.commons.lang3.StringUtils; import org.apache.nifi.avro.AvroTypeUtil; import org.apache.nifi.components.PropertyDescriptor; +import org.apache.nifi.expression.ExpressionLanguageScope; import org.apache.nifi.processor.util.StandardValidators; import javax.xml.bind.DatatypeConverter; @@ -154,7 +155,7 @@ public class JdbcCommon { + " 'Default Decimal Precision' is used when writing those undefined precision numbers.") .defaultValue(String.valueOf(DEFAULT_PRECISION_VALUE)) .addValidator(StandardValidators.POSITIVE_INTEGER_VALIDATOR) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .required(true) .build(); @@ -170,7 +171,7 @@ public class JdbcCommon { + " e.g. 1.53 becomes 2 with scale 0, and 1.5 with scale 1.") .defaultValue(String.valueOf(DEFAULT_SCALE_VALUE)) .addValidator(StandardValidators.NON_NEGATIVE_INTEGER_VALIDATOR) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .required(true) .build(); http://git-wip-us.apache.org/repos/asf/nifi/blob/4c787799/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JmsProperties.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JmsProperties.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JmsProperties.java index f538624..7a3ee0a 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JmsProperties.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/JmsProperties.java @@ -18,6 +18,7 @@ package org.apache.nifi.processors.standard.util; import org.apache.nifi.components.PropertyDescriptor; import org.apache.nifi.components.Validator; +import org.apache.nifi.expression.ExpressionLanguageScope; import org.apache.nifi.processor.util.StandardValidators; import org.apache.nifi.ssl.SSLContextService; @@ -155,14 +156,14 @@ public class JmsProperties { .description("The Priority of the Message") .required(false) .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .build(); public static final PropertyDescriptor REPLY_TO_QUEUE = new PropertyDescriptor.Builder() .name("Reply-To Queue") .description("The name of the queue to which a reply to should be added") .required(false) .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .build(); public static final PropertyDescriptor MESSAGE_TTL = new PropertyDescriptor.Builder() .name("Message Time to Live") http://git-wip-us.apache.org/repos/asf/nifi/blob/4c787799/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/SFTPTransfer.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/SFTPTransfer.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/SFTPTransfer.java index 99de60c..d7aa6e3 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/SFTPTransfer.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/util/SFTPTransfer.java @@ -35,6 +35,7 @@ import java.util.regex.Pattern; import org.apache.nifi.components.PropertyDescriptor; import org.apache.nifi.components.PropertyValue; +import org.apache.nifi.expression.ExpressionLanguageScope; import org.apache.nifi.flowfile.FlowFile; import org.apache.nifi.logging.ComponentLog; import org.apache.nifi.processor.ProcessContext; @@ -56,14 +57,14 @@ public class SFTPTransfer implements FileTransfer { .description("The fully qualified path to the Private Key file") .required(false) .addValidator(StandardValidators.FILE_EXISTS_VALIDATOR) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .build(); public static final PropertyDescriptor PRIVATE_KEY_PASSPHRASE = new PropertyDescriptor.Builder() .name("Private Key Passphrase") .description("Password for the private key") .required(false) .addValidator(StandardValidators.NON_EMPTY_VALIDATOR) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .sensitive(true) .build(); public static final PropertyDescriptor HOST_KEY_FILE = new PropertyDescriptor.Builder() @@ -83,7 +84,7 @@ public class SFTPTransfer implements FileTransfer { .name("Port") .description("The port that the remote system is listening on for file transfers") .addValidator(StandardValidators.PORT_VALIDATOR) - .expressionLanguageSupported(true) + .expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES) .required(true) .defaultValue("22") .build(); http://git-wip-us.apache.org/repos/asf/nifi/blob/4c787799/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExecuteStreamCommand.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExecuteStreamCommand.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExecuteStreamCommand.java index 0988137..cdeec44 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExecuteStreamCommand.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestExecuteStreamCommand.java @@ -54,7 +54,6 @@ public class TestExecuteStreamCommand { String jarPath = exJar.getAbsolutePath(); exJar.setExecutable(true); final TestRunner controller = TestRunners.newTestRunner(ExecuteStreamCommand.class); - controller.setValidateExpressionUsage(false); controller.enqueue(dummy.toPath()); controller.setProperty(ExecuteStreamCommand.EXECUTION_COMMAND, "java"); controller.setProperty(ExecuteStreamCommand.EXECUTION_ARGUMENTS, "-jar;" + jarPath); @@ -87,7 +86,6 @@ public class TestExecuteStreamCommand { String jarPath = exJar.getAbsolutePath(); exJar.setExecutable(true); final TestRunner controller = TestRunners.newTestRunner(ExecuteStreamCommand.class); - controller.setValidateExpressionUsage(false); controller.enqueue(dummy.toPath()); controller.setProperty(ExecuteStreamCommand.EXECUTION_COMMAND, "java"); controller.setProperty(ExecuteStreamCommand.EXECUTION_ARGUMENTS, "-jar;" + jarPath); @@ -117,7 +115,6 @@ public class TestExecuteStreamCommand { String jarPath = exJar.getAbsolutePath(); exJar.setExecutable(true); final TestRunner controller = TestRunners.newTestRunner(ExecuteStreamCommand.class); - controller.setValidateExpressionUsage(false); controller.enqueue(dummy10MBytes.toPath()); controller.setProperty(ExecuteStreamCommand.EXECUTION_COMMAND, "java"); controller.setProperty(ExecuteStreamCommand.EXECUTION_ARGUMENTS, "-jar;" + jarPath); @@ -138,7 +135,6 @@ public class TestExecuteStreamCommand { String jarPath = exJar.getAbsolutePath(); exJar.setExecutable(true); final TestRunner controller = TestRunners.newTestRunner(ExecuteStreamCommand.class); - controller.setValidateExpressionUsage(false); controller.enqueue(dummy.toPath()); controller.setProperty(ExecuteStreamCommand.WORKING_DIR, "target"); controller.setProperty(ExecuteStreamCommand.EXECUTION_COMMAND, "java"); @@ -161,7 +157,6 @@ public class TestExecuteStreamCommand { String jarPath = exJar.getAbsolutePath(); exJar.setExecutable(true); final TestRunner controller = TestRunners.newTestRunner(ExecuteStreamCommand.class); - controller.setValidateExpressionUsage(false); controller.enqueue(dummy.toPath()); controller.setProperty(ExecuteStreamCommand.WORKING_DIR, "target"); controller.setProperty(ExecuteStreamCommand.EXECUTION_COMMAND, "java"); @@ -185,7 +180,6 @@ public class TestExecuteStreamCommand { testFile.delete(); File dummy = new File("src/test/resources/ExecuteCommand/1000bytes.txt"); final TestRunner controller = TestRunners.newTestRunner(ExecuteStreamCommand.class); - controller.setValidateExpressionUsage(false); controller.enqueue(dummy.toPath()); controller.enqueue(dummy.toPath()); controller.enqueue(dummy.toPath()); @@ -212,7 +206,6 @@ public class TestExecuteStreamCommand { final TestRunner controller = TestRunners.newTestRunner(ExecuteStreamCommand.class); controller.setProperty("NIFI_TEST_1", "testvalue1"); controller.setProperty("NIFI_TEST_2", "testvalue2"); - controller.setValidateExpressionUsage(false); controller.enqueue(dummy.toPath()); controller.setProperty(ExecuteStreamCommand.WORKING_DIR, "target"); controller.setProperty(ExecuteStreamCommand.EXECUTION_COMMAND, "java"); @@ -234,7 +227,6 @@ public class TestExecuteStreamCommand { File dummy = new File("src/test/resources/hello.txt"); assertTrue(dummy.exists()); final TestRunner controller = TestRunners.newTestRunner(ExecuteStreamCommand.class); - controller.setValidateExpressionUsage(false); controller.enqueue("".getBytes()); if(isWindows()) { @@ -268,7 +260,6 @@ public class TestExecuteStreamCommand { String jarPath = exJar.getAbsolutePath(); exJar.setExecutable(true); final TestRunner controller = TestRunners.newTestRunner(ExecuteStreamCommand.class); - controller.setValidateExpressionUsage(false); controller.enqueue(dummy.toPath()); controller.setProperty(ExecuteStreamCommand.EXECUTION_COMMAND, "java"); controller.setProperty(ExecuteStreamCommand.EXECUTION_ARGUMENTS, "-jar;" + jarPath); @@ -296,7 +287,6 @@ public class TestExecuteStreamCommand { String jarPath = exJar.getAbsolutePath(); exJar.setExecutable(true); final TestRunner controller = TestRunners.newTestRunner(ExecuteStreamCommand.class); - controller.setValidateExpressionUsage(false); controller.enqueue("small test".getBytes()); controller.setProperty(ExecuteStreamCommand.EXECUTION_COMMAND, "java"); controller.setProperty(ExecuteStreamCommand.EXECUTION_ARGUMENTS, "-jar;" + jarPath); @@ -335,7 +325,6 @@ public class TestExecuteStreamCommand { String jarPath = exJar.getAbsolutePath(); exJar.setExecutable(true); final TestRunner controller = TestRunners.newTestRunner(ExecuteStreamCommand.class); - controller.setValidateExpressionUsage(false); controller.enqueue(dummy10MBytes.toPath()); controller.setProperty(ExecuteStreamCommand.EXECUTION_COMMAND, "java"); controller.setProperty(ExecuteStreamCommand.EXECUTION_ARGUMENTS, "-jar;" + jarPath); @@ -361,7 +350,6 @@ public class TestExecuteStreamCommand { } final TestRunner controller = TestRunners.newTestRunner(ExecuteStreamCommand.class); - controller.setValidateExpressionUsage(false); controller.enqueue("".getBytes()); if(isWindows()) { controller.setProperty(ExecuteStreamCommand.EXECUTION_COMMAND, "cmd.exe"); @@ -392,8 +380,6 @@ public class TestExecuteStreamCommand { String jarPath = exJar.getAbsolutePath(); exJar.setExecutable(true); final TestRunner controller = TestRunners.newTestRunner(ExecuteStreamCommand.class); - controller.setValidateExpressionUsage(false); - controller.enqueue(dummy.toPath()); controller.setProperty(ExecuteStreamCommand.WORKING_DIR, "target"); controller.setProperty(ExecuteStreamCommand.EXECUTION_COMMAND, "java"); @@ -415,7 +401,6 @@ public class TestExecuteStreamCommand { String jarPath = exJar.getAbsolutePath(); exJar.setExecutable(true); final TestRunner controller = TestRunners.newTestRunner(ExecuteStreamCommand.class); - controller.setValidateExpressionUsage(false); controller.enqueue(dummy.toPath()); controller.setProperty(ExecuteStreamCommand.WORKING_DIR, "target"); controller.setProperty(ExecuteStreamCommand.EXECUTION_COMMAND, "java"); @@ -439,7 +424,6 @@ public class TestExecuteStreamCommand { final TestRunner controller = TestRunners.newTestRunner(ExecuteStreamCommand.class); controller.setProperty("NIFI_TEST_1", "testvalue1"); controller.setProperty("NIFI_TEST_2", "testvalue2"); - controller.setValidateExpressionUsage(false); controller.enqueue(dummy.toPath()); controller.setProperty(ExecuteStreamCommand.WORKING_DIR, "target"); controller.setProperty(ExecuteStreamCommand.EXECUTION_COMMAND, "java"); @@ -481,7 +465,6 @@ public class TestExecuteStreamCommand { String jarPath = exJar.getAbsolutePath(); exJar.setExecutable(true); final TestRunner controller = TestRunners.newTestRunner(ExecuteStreamCommand.class); - controller.setValidateExpressionUsage(false); controller.enqueue(dummy.toPath()); controller.setProperty(ExecuteStreamCommand.EXECUTION_COMMAND, "java"); controller.setProperty(ExecuteStreamCommand.EXECUTION_ARGUMENTS, "-jar;" + jarPath); http://git-wip-us.apache.org/repos/asf/nifi/blob/4c787799/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestFTP.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestFTP.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestFTP.java index 96a4236..450119f 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestFTP.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestFTP.java @@ -16,6 +16,16 @@ */ package org.apache.nifi.processors.standard; +import static org.junit.Assert.assertEquals; + +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.concurrent.TimeUnit; + import org.apache.nifi.components.ValidationResult; import org.apache.nifi.flowfile.attributes.CoreAttributes; import org.apache.nifi.processor.ProcessContext; @@ -36,16 +46,6 @@ import org.mockftpserver.fake.filesystem.FileEntry; import org.mockftpserver.fake.filesystem.FileSystem; import org.mockftpserver.fake.filesystem.WindowsFakeFileSystem; -import java.io.FileInputStream; -import java.io.IOException; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -import static org.junit.Assert.assertEquals; - public class TestFTP { final FakeFtpServer fakeFtpServer = new FakeFtpServer(); @@ -226,6 +226,7 @@ public class TestFTP { // Ensure wait for enough lag time. Thread.sleep(AbstractListProcessor.LISTING_LAG_MILLIS.get(TimeUnit.MILLISECONDS) * 2); + runner.run(); runner.assertTransferCount(FetchFTP.REL_SUCCESS, 1); http://git-wip-us.apache.org/repos/asf/nifi/blob/4c787799/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGetFile.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGetFile.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGetFile.java index baa8919..7ffdfd8 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGetFile.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestGetFile.java @@ -89,6 +89,7 @@ public class TestGetFile { runner.run(); fail(); } catch (AssertionError e) { + Throwable ex = e.getCause(); assertTrue(e.getCause().getMessage() .endsWith("does not have sufficient permissions (i.e., not writable and readable)")); } http://git-wip-us.apache.org/repos/asf/nifi/blob/4c787799/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestJoltTransformJSON.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestJoltTransformJSON.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestJoltTransformJSON.java index 821aacc..14a2531 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestJoltTransformJSON.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestJoltTransformJSON.java @@ -16,6 +16,8 @@ */ package org.apache.nifi.processors.standard; +import static org.junit.Assert.assertTrue; + import java.io.ByteArrayInputStream; import java.io.IOException; import java.nio.file.Files; @@ -35,8 +37,6 @@ import org.junit.Test; import com.bazaarvoice.jolt.Diffy; import com.bazaarvoice.jolt.JsonUtils; -import static org.junit.Assert.assertTrue; - public class TestJoltTransformJSON { final static Path JSON_INPUT = Paths.get("src/test/resources/TestJoltTransformJson/input.json"); @@ -118,7 +118,6 @@ public class TestJoltTransformJSON { @Test public void testCustomTransformationWithNoModule() throws IOException { final TestRunner runner = TestRunners.newTestRunner(new JoltTransformJSON()); - runner.setValidateExpressionUsage(false); final String spec = new String(Files.readAllBytes(Paths.get("src/test/resources/TestJoltTransformJson/customChainrSpec.json"))); runner.setProperty(JoltTransformJSON.JOLT_SPEC, spec); runner.setProperty(JoltTransformJSON.CUSTOM_CLASS, "TestCustomJoltTransform"); @@ -169,7 +168,6 @@ public class TestJoltTransformJSON { @Test public void testTransformInputWithChainr() throws IOException { final TestRunner runner = TestRunners.newTestRunner(new JoltTransformJSON()); - runner.setValidateExpressionUsage(false); final String spec = new String(Files.readAllBytes(Paths.get("src/test/resources/TestJoltTransformJson/chainrSpec.json"))); runner.setProperty(JoltTransformJSON.JOLT_SPEC, spec); runner.enqueue(JSON_INPUT); @@ -186,7 +184,6 @@ public class TestJoltTransformJSON { @Test public void testTransformInputWithShiftr() throws IOException { final TestRunner runner = TestRunners.newTestRunner(new JoltTransformJSON()); - runner.setValidateExpressionUsage(false); final String spec = new String(Files.readAllBytes(Paths.get("src/test/resources/TestJoltTransformJson/shiftrSpec.json"))); runner.setProperty(JoltTransformJSON.JOLT_SPEC, spec); runner.setProperty(JoltTransformJSON.JOLT_TRANSFORM, JoltTransformJSON.SHIFTR); @@ -204,7 +201,6 @@ public class TestJoltTransformJSON { @Test public void testTransformInputWithDefaultr() throws IOException { final TestRunner runner = TestRunners.newTestRunner(new JoltTransformJSON()); - runner.setValidateExpressionUsage(false); final String spec = new String(Files.readAllBytes(Paths.get("src/test/resources/TestJoltTransformJson/defaultrSpec.json"))); runner.setProperty(JoltTransformJSON.JOLT_SPEC, spec); runner.setProperty(JoltTransformJSON.JOLT_TRANSFORM, JoltTransformJSON.DEFAULTR); @@ -220,7 +216,6 @@ public class TestJoltTransformJSON { @Test public void testTransformInputWithRemovr() throws IOException { final TestRunner runner = TestRunners.newTestRunner(new JoltTransformJSON()); - runner.setValidateExpressionUsage(false); final String spec = new String(Files.readAllBytes(Paths.get("src/test/resources/TestJoltTransformJson/removrSpec.json"))); runner.setProperty(JoltTransformJSON.JOLT_SPEC, spec); runner.setProperty(JoltTransformJSON.JOLT_TRANSFORM, JoltTransformJSON.REMOVR); @@ -236,7 +231,6 @@ public class TestJoltTransformJSON { @Test public void testTransformInputWithCardinality() throws IOException { final TestRunner runner = TestRunners.newTestRunner(new JoltTransformJSON()); - runner.setValidateExpressionUsage(false); final String spec = new String(Files.readAllBytes(Paths.get("src/test/resources/TestJoltTransformJson/cardrSpec.json"))); runner.setProperty(JoltTransformJSON.JOLT_SPEC, spec); runner.setProperty(JoltTransformJSON.JOLT_TRANSFORM, JoltTransformJSON.CARDINALITY); @@ -252,7 +246,6 @@ public class TestJoltTransformJSON { @Test public void testTransformInputWithSortr() throws IOException { final TestRunner runner = TestRunners.newTestRunner(new JoltTransformJSON()); - runner.setValidateExpressionUsage(false); runner.setProperty(JoltTransformJSON.JOLT_TRANSFORM, JoltTransformJSON.SORTR); runner.enqueue(JSON_INPUT); runner.run(); @@ -270,7 +263,6 @@ public class TestJoltTransformJSON { @Test public void testTransformInputWithDefaultrExpressionLanguage() throws IOException { final TestRunner runner = TestRunners.newTestRunner(new JoltTransformJSON()); - runner.setValidateExpressionUsage(false); final String spec = new String(Files.readAllBytes(Paths.get("src/test/resources/TestJoltTransformJson/defaultrELSpec.json"))); runner.setProperty(JoltTransformJSON.JOLT_SPEC, spec); runner.setProperty(JoltTransformJSON.JOLT_TRANSFORM, JoltTransformJSON.DEFAULTR); @@ -287,7 +279,6 @@ public class TestJoltTransformJSON { @Test public void testTransformInputWithModifierDefault() throws IOException { final TestRunner runner = TestRunners.newTestRunner(new JoltTransformJSON()); - runner.setValidateExpressionUsage(false); final String spec = new String(Files.readAllBytes(Paths.get("src/test/resources/TestJoltTransformJson/modifierDefaultSpec.json"))); runner.setProperty(JoltTransformJSON.JOLT_SPEC, spec); runner.setProperty(JoltTransformJSON.JOLT_TRANSFORM, JoltTransformJSON.MODIFIER_DEFAULTR); @@ -303,7 +294,6 @@ public class TestJoltTransformJSON { @Test public void testTransformInputWithModifierDefine() throws IOException { final TestRunner runner = TestRunners.newTestRunner(new JoltTransformJSON()); - runner.setValidateExpressionUsage(false); final String spec = new String(Files.readAllBytes(Paths.get("src/test/resources/TestJoltTransformJson/modifierDefineSpec.json"))); runner.setProperty(JoltTransformJSON.JOLT_SPEC, spec); runner.setProperty(JoltTransformJSON.JOLT_TRANSFORM, JoltTransformJSON.MODIFIER_DEFAULTR); @@ -319,7 +309,6 @@ public class TestJoltTransformJSON { @Test public void testTransformInputWithModifierOverwrite() throws IOException { final TestRunner runner = TestRunners.newTestRunner(new JoltTransformJSON()); - runner.setValidateExpressionUsage(false); final String spec = new String(Files.readAllBytes(Paths.get("src/test/resources/TestJoltTransformJson/modifierOverwriteSpec.json"))); runner.setProperty(JoltTransformJSON.JOLT_SPEC, spec); runner.setProperty(JoltTransformJSON.JOLT_TRANSFORM, JoltTransformJSON.MODIFIER_DEFAULTR); @@ -335,7 +324,6 @@ public class TestJoltTransformJSON { @Test public void testTransformInputWithSortrPopulatedSpec() throws IOException { final TestRunner runner = TestRunners.newTestRunner(new JoltTransformJSON()); - runner.setValidateExpressionUsage(false); runner.setProperty(JoltTransformJSON.JOLT_TRANSFORM, JoltTransformJSON.SORTR); runner.setProperty(JoltTransformJSON.JOLT_SPEC, "abcd"); runner.enqueue(JSON_INPUT); @@ -354,7 +342,6 @@ public class TestJoltTransformJSON { @Test public void testTransformInputWithCustomTransformationWithJar() throws IOException { final TestRunner runner = TestRunners.newTestRunner(new JoltTransformJSON()); - runner.setValidateExpressionUsage(false); final String customJarPath = "src/test/resources/TestJoltTransformJson/TestCustomJoltTransform.jar"; final String spec = new String(Files.readAllBytes(Paths.get("src/test/resources/TestJoltTransformJson/chainrSpec.json"))); runner.setProperty(JoltTransformJSON.JOLT_SPEC, spec); @@ -375,7 +362,6 @@ public class TestJoltTransformJSON { @Test public void testTransformInputWithCustomTransformationWithDir() throws IOException { final TestRunner runner = TestRunners.newTestRunner(new JoltTransformJSON()); - runner.setValidateExpressionUsage(false); final String customJarPath = "src/test/resources/TestJoltTransformJson"; final String spec = new String(Files.readAllBytes(Paths.get("src/test/resources/TestJoltTransformJson/chainrSpec.json"))); runner.setProperty(JoltTransformJSON.JOLT_SPEC, spec); @@ -396,7 +382,6 @@ public class TestJoltTransformJSON { @Test public void testTransformInputWithChainrEmbeddedCustomTransformation() throws IOException { final TestRunner runner = TestRunners.newTestRunner(new JoltTransformJSON()); - runner.setValidateExpressionUsage(false); final String customJarPath = "src/test/resources/TestJoltTransformJson"; final String spec = new String(Files.readAllBytes(Paths.get("src/test/resources/TestJoltTransformJson/customChainrSpec.json"))); runner.setProperty(JoltTransformJSON.JOLT_SPEC,spec); @@ -415,7 +400,6 @@ public class TestJoltTransformJSON { @Test public void testTransformInputCustomTransformationIgnored() throws IOException { final TestRunner runner = TestRunners.newTestRunner(new JoltTransformJSON()); - runner.setValidateExpressionUsage(false); final String customJarPath = "src/test/resources/TestJoltTransformJson/TestCustomJoltTransform.jar"; final String spec = new String(Files.readAllBytes(Paths.get("src/test/resources/TestJoltTransformJson/defaultrSpec.json"))); runner.setProperty(JoltTransformJSON.JOLT_SPEC, spec); http://git-wip-us.apache.org/repos/asf/nifi/blob/4c787799/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestLogMessage.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestLogMessage.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestLogMessage.java index 98a8952..a07bfb1 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestLogMessage.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestLogMessage.java @@ -17,6 +17,10 @@ package org.apache.nifi.processors.standard; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; + import org.apache.nifi.logging.ComponentLog; import org.apache.nifi.reporting.InitializationException; import org.apache.nifi.util.MockComponentLog; @@ -28,10 +32,6 @@ import org.junit.Assert; import org.junit.Before; import org.junit.Test; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; - public class TestLogMessage { private TestableLogMessage testableLogMessage; @@ -75,8 +75,6 @@ public class TestLogMessage { flowAttributes.put("foobar", "baz"); runner.enqueue("This is a message!", flowAttributes); - runner.setValidateExpressionUsage(false); - runner.run(); List<MockFlowFile> successFlowFiles = runner.getFlowFilesForRelationship(LogMessage.REL_SUCCESS); @@ -106,8 +104,6 @@ public class TestLogMessage { flowAttributes.put("foobar", "baz"); runner.enqueue("This is a message!", flowAttributes); - runner.setValidateExpressionUsage(false); - runner.run(); List<MockFlowFile> successFlowFiles = runner.getFlowFilesForRelationship(LogMessage.REL_SUCCESS); http://git-wip-us.apache.org/repos/asf/nifi/blob/4c787799/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestMergeContent.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestMergeContent.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestMergeContent.java index 0af5f8b..d63d058 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestMergeContent.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestMergeContent.java @@ -564,11 +564,20 @@ public class TestMergeContent { runner.setProperty(MergeContent.MAX_BIN_AGE, "1 sec"); runner.setProperty(MergeContent.MERGE_FORMAT, MergeContent.MERGE_FORMAT_CONCAT); runner.setProperty(MergeContent.DELIMITER_STRATEGY, MergeContent.DELIMITER_STRATEGY_FILENAME); - runner.setProperty(MergeContent.HEADER, "src/test/resources/TestMergeContent/head"); - runner.setProperty(MergeContent.DEMARCATOR, "src/test/resources/TestMergeContent/demarcate"); - runner.setProperty(MergeContent.FOOTER, "src/test/resources/TestMergeContent/foot"); + runner.setProperty(MergeContent.HEADER, "${header}"); + runner.setProperty(MergeContent.DEMARCATOR, "${demarcator}"); + runner.setProperty(MergeContent.FOOTER, "${footer}"); - createFlowFiles(runner); + + final Map<String, String> attributes = new HashMap<>(); + attributes.put(CoreAttributes.MIME_TYPE.key(), "application/plain-text"); + attributes.put("header", "src/test/resources/TestMergeContent/head"); + attributes.put("demarcator", "src/test/resources/TestMergeContent/demarcate"); + attributes.put("footer", "src/test/resources/TestMergeContent/foot"); + + runner.enqueue("Hello".getBytes("UTF-8"), attributes); + runner.enqueue(", ".getBytes("UTF-8"), attributes); + runner.enqueue("World!".getBytes("UTF-8"), attributes); runner.run(); runner.assertQueueEmpty(); http://git-wip-us.apache.org/repos/asf/nifi/blob/4c787799/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestQueryRecord.java ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestQueryRecord.java b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestQueryRecord.java index 4e93253..345f8e4 100644 --- a/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestQueryRecord.java +++ b/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestQueryRecord.java @@ -57,6 +57,19 @@ public class TestQueryRecord { private static final String REL_NAME = "success"; + public TestRunner getRunner() { + TestRunner runner = TestRunners.newTestRunner(QueryRecord.class); + + /** + * we have to disable validation of expression language because the scope of the evaluation + * depends of the value of another property: if we are caching the schema/queries or not. If + * we don't disable the validation, it'll throw an error saying that the scope is incorrect. + */ + runner.setValidateExpressionUsage(false); + + return runner; + } + @Test public void testSimple() throws InitializationException, IOException, SQLException { final MockRecordParser parser = new MockRecordParser(); @@ -66,7 +79,7 @@ public class TestQueryRecord { final MockRecordWriter writer = new MockRecordWriter("\"name\",\"points\""); - final TestRunner runner = TestRunners.newTestRunner(QueryRecord.class); + TestRunner runner = getRunner(); runner.addControllerService("parser", parser); runner.enableControllerService(parser); runner.addControllerService("writer", writer); @@ -99,7 +112,7 @@ public class TestQueryRecord { final MockRecordWriter writer = new MockRecordWriter("\"name\",\"points\""); - final TestRunner runner = TestRunners.newTestRunner(QueryRecord.class); + TestRunner runner = getRunner(); runner.addControllerService("parser", parser); runner.enableControllerService(parser); runner.addControllerService("writer", writer); @@ -139,7 +152,7 @@ public class TestQueryRecord { final MockRecordWriter writer = new MockRecordWriter("\"NAME\",\"POINTS\""); - final TestRunner runner = TestRunners.newTestRunner(QueryRecord.class); + TestRunner runner = getRunner(); runner.addControllerService("parser", parser); runner.enableControllerService(parser); runner.addControllerService("writer", writer); @@ -169,7 +182,7 @@ public class TestQueryRecord { final MockRecordWriter writer = new MockRecordWriter("\"name\",\"points\""); - final TestRunner runner = TestRunners.newTestRunner(QueryRecord.class); + TestRunner runner = getRunner(); runner.enforceReadStreamsClosed(false); runner.addControllerService("parser", parser); runner.enableControllerService(parser); @@ -200,7 +213,7 @@ public class TestQueryRecord { final MockRecordWriter writer = new MockRecordWriter("\"name\",\"points\""); - final TestRunner runner = TestRunners.newTestRunner(QueryRecord.class); + TestRunner runner = getRunner(); runner.addControllerService("parser", parser); runner.enableControllerService(parser); runner.addControllerService("writer", writer); @@ -235,7 +248,7 @@ public class TestQueryRecord { colNames.add("FAV_GREETING"); final ResultSetValidatingRecordWriter writer = new ResultSetValidatingRecordWriter(colNames); - final TestRunner runner = TestRunners.newTestRunner(QueryRecord.class); + TestRunner runner = getRunner(); runner.addControllerService("parser", parser); runner.enableControllerService(parser); runner.addControllerService("writer", writer);