PrincipalBasedAuthorizationConfiguration extends ConfigurationBase implements AuthorizationConfiguration { @Activate public void activate(@NotNull BundleContext context, @NotNull Configuration configuration) { checkConflictingMount(); setParameters(ConfigurationParameters.of(CompositeConfiguration.PARAM_RANKING, configuration.configurationRanking(), PARAM_ENABLE_AGGREGATION_FILTER, configuration.enableAggregationFilter())); if (configuration.enableAggregationFilter()) { registerAggregationFilter(context); } else { unregisterAggregationFilter(); } } @SuppressWarnings("UnusedDeclaration")  PrincipalBasedAuthorizationConfiguration(); @NotNull @Override AccessControlManager getAccessControlManager(@NotNull Root root, @NotNull NamePathMapper namePathMapper); @NotNull @Override RestrictionProvider getRestrictionProvider(); @NotNull @Override PermissionProvider getPermissionProvider(@NotNull Root root, @NotNull String workspaceName, @NotNull Set<Principal> principals); @NotNull @Override String getName(); @NotNull @Override RepositoryInitializer getRepositoryInitializer(); @NotNull @Override List<? extends CommitHook> getCommitHooks(@NotNull String workspaceName); @NotNull @Override List<? extends ValidatorProvider> getValidators(@NotNull String workspaceName, @NotNull Set<Principal> principals, @NotNull MoveTracker moveTracker); @NotNull @Override List<ProtectedItemImporter> getProtectedItemImporters(); @NotNull @Override Context getContext(); @Activate void activate(@NotNull BundleContext context, @NotNull Configuration configuration); @Modified void modified(@NotNull BundleContext context, @NotNull Configuration configuration); @Deactivate void deactivate(@NotNull BundleContext context, @NotNull Configuration configuration); @Reference(name = "filterProvider", cardinality = ReferenceCardinality.MANDATORY) void bindFilterProvider(@NotNull FilterProvider filterProvider); void unbindFilterProvider(@NotNull FilterProvider filterProvider); @Reference(name = "mountInfoProvider", cardinality = ReferenceCardinality.MANDATORY) void bindMountInfoProvider(@NotNull MountInfoProvider mountInfoProvider); void unbindMountInfoProvider(@NotNull MountInfoProvider mountInfoProvider);  }
@Test public void testActivate() { PrincipalBasedAuthorizationConfiguration pbac = getPrincipalBasedAuthorizationConfiguration(); BundleContext ctx = mock(BundleContext.class); PrincipalBasedAuthorizationConfiguration.Configuration config = mock(PrincipalBasedAuthorizationConfiguration.Configuration.class); when(config.configurationRanking()).thenReturn(50); when(config.enableAggregationFilter()).thenReturn(true); pbac.activate(ctx, config); ConfigurationParameters params = pbac.getParameters(); assertEquals(50, params.get(PARAM_RANKING)); assertEquals(Boolean.TRUE, params.get(PARAM_ENABLE_AGGREGATION_FILTER)); verify(ctx, times(1)).registerService(anyString(), any(AggregationFilter.class), any(Hashtable.class)); }