Skip to content

Commit

Permalink
NIFI-10597 Change 'App Config File' property to external resource in …
Browse files Browse the repository at this point in the history
…Box processors

This closes apache#6489.

Signed-off-by: Tamas Palfy <[email protected]>
  • Loading branch information
krisztina-zsihovszki authored and tpalfy committed Oct 6, 2022
1 parent 2405b0e commit 1ec8c84
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.components.ValidationContext;
import org.apache.nifi.components.ValidationResult;
import org.apache.nifi.components.resource.ResourceCardinality;
import org.apache.nifi.components.resource.ResourceType;
import org.apache.nifi.controller.AbstractControllerService;
import org.apache.nifi.controller.ConfigurationContext;
import org.apache.nifi.expression.ExpressionLanguageScope;
Expand Down Expand Up @@ -59,7 +61,7 @@ public class JsonConfigBasedBoxClientService extends AbstractControllerService i
.displayName("App Config File")
.description("Full path of an App config JSON file. See Additional Details for more information.")
.required(false)
.addValidator(StandardValidators.FILE_EXISTS_VALIDATOR)
.identifiesExternalResource(ResourceCardinality.SINGLE, ResourceType.FILE)
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ void invalidWhenAppConfigFileAndAppConfigJsonIsMissing() {
testRunner.assertNotValid(testSubject);
}

@Test
void invalidWhenAppConfigFileDoesNotExist() {
testRunner.setProperty(testSubject, JsonConfigBasedBoxClientService.ACCOUNT_ID, "account_id");
testRunner.setProperty(testSubject, JsonConfigBasedBoxClientService.APP_CONFIG_FILE, "doesnotexist.xml");
testRunner.assertNotValid(testSubject);
}

@Test
void invalidWhenBothAppConfigFileAndAppConfigJsonIsSet() {
testRunner.setProperty(testSubject, JsonConfigBasedBoxClientService.ACCOUNT_ID, "account_id");
Expand Down

0 comments on commit 1ec8c84

Please sign in to comment.