@Test void testGetAllowedComponentsForTemplate() { Set<String> allowedComponents = underTest.getAllowedComponentsForTemplate(BASE_PAGE_COMPONENT, context.resourceResolver()); assertNotNull(allowedComponents, "Allowed components for template cannot be null"); assertTrue(allowedComponents.contains("dummy/components/comp1"), "Component 'comp1' must be allowed in page " + BASE_PAGE_COMPONENT + "."); assertTrue(allowedComponents.contains("dummy/components/nestedComp2"), "Component 'nestedComp2' must be allowed in page " + BASE_PAGE_COMPONENT + "."); assertFalse(allowedComponents.contains("dummy/components/comp3"), "Component 'comp3' should not be allowed in page " + BASE_PAGE_COMPONENT + "."); }
@Override public @NotNull Set<String> getAllowedComponentsForTemplate(@NotNull String pageComponentPath, @NotNull ResourceResolver resolver) { Resource pageComponentResource = resolver.getResource(pageComponentPath); if (pageComponentResource != null) { Iterable<ParsysConfig> parSysConfigs = parsysConfigManager.getParsysConfigs(pageComponentResource.getPath(), resolver); SortedSet<String> allowedChildren = new TreeSet<>(); for (ParsysConfig parSysConfig : parSysConfigs) { allowedChildren.addAll(parSysConfig.getAllowedChildren()); } return allowedChildren; } return ImmutableSet.of(); }
AllowedComponentsProviderImpl implements AllowedComponentsProvider { @Override public @NotNull Set<String> getAllowedComponentsForTemplate(@NotNull String pageComponentPath, @NotNull ResourceResolver resolver) { Resource pageComponentResource = resolver.getResource(pageComponentPath); if (pageComponentResource != null) { Iterable<ParsysConfig> parSysConfigs = parsysConfigManager.getParsysConfigs(pageComponentResource.getPath(), resolver); SortedSet<String> allowedChildren = new TreeSet<>(); for (ParsysConfig parSysConfig : parSysConfigs) { allowedChildren.addAll(parSysConfig.getAllowedChildren()); } return allowedChildren; } return ImmutableSet.of(); } }
AllowedComponentsProviderImpl implements AllowedComponentsProvider { @Override public @NotNull Set<String> getAllowedComponentsForTemplate(@NotNull String pageComponentPath, @NotNull ResourceResolver resolver) { Resource pageComponentResource = resolver.getResource(pageComponentPath); if (pageComponentResource != null) { Iterable<ParsysConfig> parSysConfigs = parsysConfigManager.getParsysConfigs(pageComponentResource.getPath(), resolver); SortedSet<String> allowedChildren = new TreeSet<>(); for (ParsysConfig parSysConfig : parSysConfigs) { allowedChildren.addAll(parSysConfig.getAllowedChildren()); } return allowedChildren; } return ImmutableSet.of(); }  }
AllowedComponentsProviderImpl implements AllowedComponentsProvider { @Override public @NotNull Set<String> getAllowedComponentsForTemplate(@NotNull String pageComponentPath, @NotNull ResourceResolver resolver) { Resource pageComponentResource = resolver.getResource(pageComponentPath); if (pageComponentResource != null) { Iterable<ParsysConfig> parSysConfigs = parsysConfigManager.getParsysConfigs(pageComponentResource.getPath(), resolver); SortedSet<String> allowedChildren = new TreeSet<>(); for (ParsysConfig parSysConfig : parSysConfigs) { allowedChildren.addAll(parSysConfig.getAllowedChildren()); } return allowedChildren; } return ImmutableSet.of(); }  @Override @NotNull Set<String> getAllowedComponents(@NotNull String resourcePath, @NotNull ResourceResolver resolver); @Override @NotNull Set<String> getAllowedComponents(@NotNull Page page, @NotNull String relativeResourcePath,
      @Nullable String resourceType, @NotNull ResourceResolver resolver); @Override @NotNull Set<String> getAllowedComponentsForTemplate(@NotNull String pageComponentPath, @NotNull ResourceResolver resolver); }
AllowedComponentsProviderImpl implements AllowedComponentsProvider { @Override public @NotNull Set<String> getAllowedComponentsForTemplate(@NotNull String pageComponentPath, @NotNull ResourceResolver resolver) { Resource pageComponentResource = resolver.getResource(pageComponentPath); if (pageComponentResource != null) { Iterable<ParsysConfig> parSysConfigs = parsysConfigManager.getParsysConfigs(pageComponentResource.getPath(), resolver); SortedSet<String> allowedChildren = new TreeSet<>(); for (ParsysConfig parSysConfig : parSysConfigs) { allowedChildren.addAll(parSysConfig.getAllowedChildren()); } return allowedChildren; } return ImmutableSet.of(); }  @Override @NotNull Set<String> getAllowedComponents(@NotNull String resourcePath, @NotNull ResourceResolver resolver); @Override @NotNull Set<String> getAllowedComponents(@NotNull Page page, @NotNull String relativeResourcePath,
      @Nullable String resourceType, @NotNull ResourceResolver resolver); @Override @NotNull Set<String> getAllowedComponentsForTemplate(@NotNull String pageComponentPath, @NotNull ResourceResolver resolver);  }