Skip to content

Commit

Permalink
NIFI-14164: Fixed integration tests that were missed in initial imple…
Browse files Browse the repository at this point in the history
…mentation of NIFI-14164

Signed-off-by: Pierre Villard <[email protected]>

This closes #9644.
  • Loading branch information
markap14 authored and pvillard31 committed Jan 17, 2025
1 parent 2c0d840 commit 4570423
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ protected AwsClientBuilder.EndpointConfiguration getEndpointConfiguration(final
return null;
}

final String endpointOverride = overrideValue.getValue();
final String endpointOverride = overrideValue.evaluateAttributeExpressions().getValue();
return new AwsClientBuilder.EndpointConfiguration(endpointOverride, region.getName());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.commons.codec.binary.Base64;
import org.apache.nifi.fileresource.service.StandardFileResourceService;
import org.apache.nifi.fileresource.service.api.FileResourceService;
import org.apache.nifi.flowfile.FlowFile;
import org.apache.nifi.flowfile.attributes.CoreAttributes;
import org.apache.nifi.processor.DataUnit;
import org.apache.nifi.processor.ProcessContext;
Expand Down Expand Up @@ -508,7 +509,7 @@ public void testMultipartProperties() {
runner.setProperty(PutS3Object.BUCKET_WITHOUT_DEFAULT_VALUE, BUCKET_NAME);
runner.setProperty(PutS3Object.KEY, AbstractS3IT.SAMPLE_FILE_RESOURCE_NAME);

assertEquals(BUCKET_NAME, context.getProperty(PutS3Object.BUCKET_WITHOUT_DEFAULT_VALUE).toString());
assertEquals(BUCKET_NAME, context.getProperty(PutS3Object.BUCKET_WITHOUT_DEFAULT_VALUE).evaluateAttributeExpressions((FlowFile) null).toString());
assertEquals(SAMPLE_FILE_RESOURCE_NAME, context.getProperty(PutS3Object.KEY).evaluateAttributeExpressions(Collections.emptyMap()).toString());
assertEquals(TEST_PARTSIZE_LONG.longValue(),
context.getProperty(PutS3Object.MULTIPART_PART_SIZE).asDataSize(DataUnit.B).longValue());
Expand All @@ -518,7 +519,7 @@ public void testMultipartProperties() {
public void testLocalStatePersistence() throws IOException {
final TestRunner runner = initTestRunner();

final String bucket = runner.getProcessContext().getProperty(PutS3Object.BUCKET_WITHOUT_DEFAULT_VALUE).getValue();
final String bucket = runner.getProcessContext().getProperty(PutS3Object.BUCKET_WITHOUT_DEFAULT_VALUE).evaluateAttributeExpressions((FlowFile) null).getValue();
final String key = runner.getProcessContext().getProperty(PutS3Object.KEY).evaluateAttributeExpressions(Collections.emptyMap()).getValue();
final String cacheKey1 = runner.getProcessor().getIdentifier() + "/" + bucket + "/" + key;
final String cacheKey2 = runner.getProcessor().getIdentifier() + "/" + bucket + "/" + key + "-v2";
Expand Down Expand Up @@ -592,7 +593,7 @@ public void testStatePersistsETags() throws IOException {
final TestRunner runner = initTestRunner();
final PutS3Object processor = (PutS3Object) runner.getProcessor();

final String bucket = runner.getProcessContext().getProperty(PutS3Object.BUCKET_WITHOUT_DEFAULT_VALUE).getValue();
final String bucket = runner.getProcessContext().getProperty(PutS3Object.BUCKET_WITHOUT_DEFAULT_VALUE).evaluateAttributeExpressions((FlowFile) null).getValue();
final String key = runner.getProcessContext().getProperty(PutS3Object.KEY).evaluateAttributeExpressions(Collections.emptyMap()).getValue();
final String cacheKey1 = runner.getProcessor().getIdentifier() + "/" + bucket + "/" + key + "-bv1";
final String cacheKey2 = runner.getProcessor().getIdentifier() + "/" + bucket + "/" + key + "-bv2";
Expand Down Expand Up @@ -668,7 +669,7 @@ public void testStateRemove() throws IOException {
final TestRunner runner = initTestRunner();
final PutS3Object processor = (PutS3Object) runner.getProcessor();

final String bucket = runner.getProcessContext().getProperty(PutS3Object.BUCKET_WITHOUT_DEFAULT_VALUE).getValue();
final String bucket = runner.getProcessContext().getProperty(PutS3Object.BUCKET_WITHOUT_DEFAULT_VALUE).evaluateAttributeExpressions((FlowFile) null).getValue();
final String key = runner.getProcessContext().getProperty(PutS3Object.KEY).evaluateAttributeExpressions(Collections.emptyMap()).getValue();
final String cacheKey = runner.getProcessor().getIdentifier() + "/" + bucket + "/" + key + "-sr";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public void setUp() {
runner.setProperty(ConsumeElasticsearch.RANGE_FIELD, RANGE_FIELD);
runner.setProperty(ConsumeElasticsearch.RANGE_FIELD_SORT_ORDER, RANGE_SORT_ORDER);
runner.removeProperty(ConsumeElasticsearch.RANGE_INITIAL_VALUE);
runner.setValidateExpressionUsage(false);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ private Properties getClientProperties(final PropertyContext propertyContext) {
final int requestTimeoutMs = getRequestTimeoutMs(propertyContext);
properties.put(AdminClientConfig.REQUEST_TIMEOUT_MS_CONFIG, requestTimeoutMs);

final long timePeriod = propertyContext.getProperty(METADATA_WAIT_TIME).asTimePeriod(TimeUnit.MILLISECONDS);
final long timePeriod = propertyContext.getProperty(METADATA_WAIT_TIME).evaluateAttributeExpressions().asTimePeriod(TimeUnit.MILLISECONDS);
properties.put(ProducerConfig.MAX_BLOCK_MS_CONFIG, timePeriod);

return properties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ public void testRecordTransformWithDynamicProperties() throws InitializationExce

private TestRunner createRecordTransformRunner(final String type) throws InitializationException {
final TestRunner runner = createProcessor("SetRecordField");
runner.setValidateExpressionUsage(false);

final JsonTreeReader reader = new JsonTreeReader();
final JsonRecordSetWriter writer = new JsonRecordSetWriter();
Expand Down Expand Up @@ -724,6 +725,7 @@ private TestRunner createProcessor(final String type, final String version) {
final AsyncLoadedProcessor processor = bridge.createProcessor(createId(), type, version, true, true);

final TestRunner runner = TestRunners.newTestRunner(processor);
runner.setValidateExpressionUsage(false);

final long maxInitTime = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(30L);
while (true) {
Expand Down

0 comments on commit 4570423

Please sign in to comment.