test_class.declarator: initializer
test_class.modifier: private
test_class.original_string: private PrivilegeInitializer initializer;
test_class.type: PrivilegeInitializer
test_class.var_name: initializer
test_class.file: oak-core/src/test/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeInitializerTest.java
test_class.identifier: PrivilegeInitializerTest
test_class.superclass: extends AbstractSecurityTest
test_case.body: @Test
      public void testAlreadyInitialized() {
          NodeBuilder nb = when(mock(NodeBuilder.class).hasChildNode(JCR_SYSTEM)).thenReturn(true).getMock();
          when(nb.getChildNode(JCR_SYSTEM)).thenReturn(nb);
          when(nb.hasChildNode(REP_PRIVILEGES)).thenReturn(true);
  
          initializer.initialize(nb);
  
          verify(nb, never()).child(anyString());
      }
test_case.class_method_signature: PrivilegeInitializerTest.testAlreadyInitialized()
test_case.full_signature: @Test public void testAlreadyInitialized()
test_case.identifier: testAlreadyInitialized
test_case.invocations: getMock thenReturn when hasChildNode mock thenReturn when getChildNode thenReturn when hasChildNode initialize child verify never anyString
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testAlreadyInitialized()
focal_class.declarator: log = LoggerFactory.getLogger(PrivilegeInitializer.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(PrivilegeInitializer.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: rootProvider
focal_class.modifier: private final
focal_class.original_string: private final RootProvider rootProvider;
focal_class.type: RootProvider
focal_class.var_name: rootProvider
focal_class.file: oak-core/src/main/java/org/apache/jackrabbit/oak/security/privilege/PrivilegeInitializer.java
focal_class.identifier: PrivilegeInitializer
focal_class.interfaces: implements RepositoryInitializer, PrivilegeConstants
focal_class.class_method_signature: PrivilegeInitializer.PrivilegeInitializer(@NotNull RootProvider rootProvider)
focal_class.full_signature:   PrivilegeInitializer(@NotNull RootProvider rootProvider)
focal_class.identifier: PrivilegeInitializer
focal_class.parameters: (@NotNull RootProvider rootProvider)
focal_class.signature:  PrivilegeInitializer(@NotNull RootProvider rootProvider)
focal_class.class_method_signature: PrivilegeInitializer.initialize(@NotNull NodeBuilder builder)
focal_class.full_signature: @Override public void initialize(@NotNull NodeBuilder builder)
focal_class.identifier: initialize
focal_class.modifiers: @Override public
focal_class.parameters: (@NotNull NodeBuilder builder)
focal_class.return: void
focal_class.signature: void initialize(@NotNull NodeBuilder builder)
focal_method.body: @Override
      public void initialize(@NotNull NodeBuilder builder) {
          if (!builder.hasChildNode(JcrConstants.JCR_SYSTEM)) {
              throw new IllegalStateException("Missing " + JcrConstants.JCR_SYSTEM + " node, NodeStore not initialized.");
          }
          NodeBuilder system = builder.getChildNode(JcrConstants.JCR_SYSTEM);
          if (!system.hasChildNode(REP_PRIVILEGES)) {
              NodeBuilder privileges = system.child(REP_PRIVILEGES);
              privileges.setProperty(JcrConstants.JCR_PRIMARYTYPE, NT_REP_PRIVILEGES, Type.NAME);
  
              // squeeze node state before it is passed to store (OAK-2411)
              NodeState base = squeeze(builder.getNodeState());
              NodeStore store = new MemoryNodeStore(base);
              try {
                  Root systemRoot = rootProvider.createSystemRoot(store, null);
                  new PrivilegeDefinitionWriter(systemRoot).writeBuiltInDefinitions();
              } catch (RepositoryException e) {
                  log.error("Failed to register built-in privileges", e);
                  throw new RuntimeException(e);
              }
              NodeState target = store.getRoot();
              target.compareAgainstBaseState(base, new ApplyDiff(builder));
          }
      }
focal_method.class_method_signature: PrivilegeInitializer.initialize(@NotNull NodeBuilder builder)
focal_method.full_signature: @Override public void initialize(@NotNull NodeBuilder builder)
focal_method.identifier: initialize
focal_method.invocations: hasChildNode getChildNode hasChildNode child setProperty squeeze getNodeState createSystemRoot writeBuiltInDefinitions error getRoot compareAgainstBaseState
focal_method.modifiers: @Override public
focal_method.parameters: (@NotNull NodeBuilder builder)
focal_method.return: void
focal_method.signature: void initialize(@NotNull NodeBuilder builder)