CugConfiguration extends ConfigurationBase implements AuthorizationConfiguration, CugConstants { @NotNull @Override public RepositoryInitializer getRepositoryInitializer() { return builder -> { NodeState base = builder.getNodeState(); NodeStore store = new MemoryNodeStore(base); Root root = getRootProvider().createSystemRoot(store, null); if (registerCugNodeTypes(root)) { NodeState target = store.getRoot(); target.compareAgainstBaseState(base, new ApplyDiff(builder)); } }; } @SuppressWarnings("UnusedDeclaration")  CugConfiguration();  CugConfiguration(@NotNull SecurityProvider securityProvider); @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(); @Override void setParameters(@NotNull ConfigurationParameters config); @Reference(name="mountInfoProvider") void bindMountInfoProvider(MountInfoProvider mountInfoProvider); void unbindMountInfoProvider(MountInfoProvider mountInfoProvider); @Reference(name="exclude", cardinality = ReferenceCardinality.MANDATORY) void bindExclude(CugExclude exclude); void unbindExclude(CugExclude exclude);  }
@Test public void testRepositoryInitializerAlreadyInitialized() { AuthorizationConfiguration ac = getConfig(AuthorizationConfiguration.class); assertTrue(ac instanceof CompositeAuthorizationConfiguration); AuthorizationConfiguration cugConfig = null; for (AuthorizationConfiguration config : ((CompositeAuthorizationConfiguration) ac).getConfigurations()) { if (config instanceof CugConfiguration) { cugConfig = config; break; } } assertNotNull(cugConfig); RepositoryInitializer ri = cugConfig.getRepositoryInitializer(); NodeBuilder rootBuilder = spy(getTreeProvider().asNodeState(root.getTree(PathUtils.ROOT_PATH)).builder()); ri.initialize(rootBuilder); verify(rootBuilder, times(1)).getNodeState(); }