PrincipalBasedAuthorizationConfiguration extends ConfigurationBase implements AuthorizationConfiguration { @NotNull @Override public RepositoryInitializer getRepositoryInitializer() { return builder -> { NodeState base = builder.getNodeState(); NodeStore store = new MemoryNodeStore(base); Root root = getRootProvider().createSystemRoot(store, null); if (registerNodeTypes(root)) { NodeState target = store.getRoot(); target.compareAgainstBaseState(base, new ApplyDiff(builder)); } }; } @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 testGetRepositoryInitializer() { RepositoryInitializer ri = new PrincipalBasedAuthorizationConfiguration().getRepositoryInitializer(); assertNotSame(RepositoryInitializer.DEFAULT, ri); }
@Test public void testGetRepositoryInitializerInitialized() { Root r = getRootProvider().createReadOnlyRoot(root); CompositeConfiguration<AuthorizationConfiguration> cc = (CompositeConfiguration) getSecurityProvider().getConfiguration(AuthorizationConfiguration.class); PrincipalBasedAuthorizationConfiguration pbac = null; for (AuthorizationConfiguration ac : cc.getConfigurations()) { if (ac instanceof PrincipalBasedAuthorizationConfiguration) { pbac = (PrincipalBasedAuthorizationConfiguration) ac; break; } } assertNotNull(pbac); RepositoryInitializer ri = pbac.getRepositoryInitializer(); ri.initialize(new ReadOnlyBuilder(getTreeProvider().asNodeState(r.getTree("/")))); }