bejancsaba commented on code in PR #6031:
URL: https://github.com/apache/nifi/pull/6031#discussion_r869448082
##########
nifi-manifest/nifi-runtime-manifest-core/src/main/java/org/apache/nifi/runtime/manifest/impl/StandardRuntimeManifestBuilder.java:
##########
@@ -348,6 +351,24 @@ private void populateExtensionComponent(final
ExtensionManifest extensionManifes
providedServiceApis.forEach(providedServiceApi ->
providedApiTypes.add(createProvidedApiType(providedServiceApi)));
extensionComponent.setProvidedApiImplementations(providedApiTypes);
}
+
+ final Restricted restricted = extension.getRestricted();
+ if (restricted != null) {
+ extensionComponent.setRestricted(true);
+
extensionComponent.setRestrictedExplanation(restricted.getGeneralRestrictionExplanation());
+ if (restricted.getRestrictions() != null) {
Review Comment:
It is minor / cosmetic but what do you think about something like this. (Not
sure whether functional coding style is preferred or not):
```
Optional.ofNullable(restricted.getRestrictions())
.map(r ->
r.stream().map(this::createRestriction).collect(Collectors.toSet()))
.ifPresent(restrictions ->
extensionComponent.setExplicitRestrictions(restrictions));
```
##########
nifi-manifest/nifi-runtime-manifest-test/src/test/java/org/apache/nifi/runtime/manifest/TestRuntimeManifest.java:
##########
@@ -139,6 +142,20 @@ public void testRuntimeManifest() throws IOException {
assertEquals(1, resourceDefinition.getResourceTypes().size());
assertEquals(ResourceType.FILE,
resourceDefinition.getResourceTypes().stream().findFirst().get());
+ // Verify FetchHDFS definition has restrictions
Review Comment:
What do you think about adding assertion for a negative case too? I mean
where the ExtensionComponnet is not set to be restricted.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]