DefaultRepoInitFactory { public static OakMachine.RepoInitProcessor bindParser(final @NotNull RepoInitParser parser) { final JcrRepoInitOpsProcessor processor = newOpsProcessor(); return (admin, reader) -> { final List<Operation> parsed = parser.parse(reader); processor.apply(admin, parsed); }; } DefaultRepoInitFactory(final @Nullable Class<? extends RepoInitParser> parserClazz); static DefaultRepoInitFactory newFactoryInstance(final @NotNull ClassLoader parserCl); static OakMachine.RepoInitProcessor newDefaultRepoInitProcessor(
            final @NotNull ClassLoader defaultClassLoader); static OakMachine.RepoInitProcessor bindParser(final @NotNull RepoInitParser parser);  }
@Test public void testBindParserProcessor_realDefaults() throws Exception { final OakMachine.RepoInitProcessor processor = DefaultRepoInitFactory.bindParser(new RepoInitParserService()); new OakMachine.Builder().build().adminInitAndInspect(admin -> { try (Reader reader = readSlingExampleRepoInit()) { processor.apply(admin, reader); } }); }
@Test(expected = RepoInitParsingException.class) public void testBindParserProcessor_throws() throws Exception { final OakMachine.RepoInitProcessor processor = DefaultRepoInitFactory.bindParser( new ParserType(reader -> { throw new RepoInitParsingException("expected error", null); })); processor.apply(null, new StringReader("")); }
@Test public void testBindParserProcessor() throws Exception { final OakMachine.RepoInitProcessor processor = DefaultRepoInitFactory.bindParser(new ParserType()); processor.apply(null, new StringReader("")); }