@Test public void testWriteNodetypesWithBuiltins() throws Exception { final File tempDir = new File(testBaseDir, "testWriteNodetypesWithBuiltins"); final File fromRepoDir = new File(tempDir, "fromRepo/segmentstore"); final File explicitTypesCnd = new File(tempDir, "explicitTypes.cnd"); final File allTypesCnd = new File(tempDir, "allTypes.cnd"); TestUtil.prepareRepo(fromRepoDir, session -> { final URL slingNodetypes = getClass().getResource("/sling_nodetypes.cnd"); TestUtil.installCndFromURL(session, slingNodetypes); }); if (explicitTypesCnd.exists()) { explicitTypesCnd.delete(); } if (allTypesCnd.exists()) { allTypesCnd.delete(); } TestUtil.withReadOnlyFixture(fromRepoDir, session -> { new CndExporter.Builder().withIncludeBuiltins(true).build() .writeNodetypes(explicitTypesCnd, session, Arrays.asList("sling:Folder", "nt:folder")); try (Scanner scanner = new Scanner(explicitTypesCnd, StandardCharsets.UTF_8.name())) { assertNull("nt:query should not be defined", scanner.findWithinHorizon("\\[nt:query]", 0)); } try (Scanner scanner = new Scanner(explicitTypesCnd, StandardCharsets.UTF_8.name())) { assertNull("sling:OrderedFolder should not be defined", scanner.findWithinHorizon("\\[sling:OrderedFolder]", 0)); } try (Scanner scanner = new Scanner(explicitTypesCnd, StandardCharsets.UTF_8.name())) { assertNotNull("nt:folder should be defined", scanner.findWithinHorizon("\\[nt:folder]", 0)); } try (Scanner scanner = new Scanner(explicitTypesCnd, StandardCharsets.UTF_8.name())) { assertNotNull("sling:Folder should be defined", scanner.findWithinHorizon("\\[sling:Folder]", 0)); } }); }
public void writeNodetypes(final @NotNull File cndFile, final @NotNull Session session, final @NotNull List<String> desiredTypeNames) throws RepositoryException, IOException, ParseException { writeNodetypes(() -> new OutputStreamWriter(new FileOutputStream(cndFile), StandardCharsets.UTF_8), session, desiredTypeNames, cndFile); }
CndExporter { public void writeNodetypes(final @NotNull File cndFile, final @NotNull Session session, final @NotNull List<String> desiredTypeNames) throws RepositoryException, IOException, ParseException { writeNodetypes(() -> new OutputStreamWriter(new FileOutputStream(cndFile), StandardCharsets.UTF_8), session, desiredTypeNames, cndFile); } }
CndExporter { public void writeNodetypes(final @NotNull File cndFile, final @NotNull Session session, final @NotNull List<String> desiredTypeNames) throws RepositoryException, IOException, ParseException { writeNodetypes(() -> new OutputStreamWriter(new FileOutputStream(cndFile), StandardCharsets.UTF_8), session, desiredTypeNames, cndFile); } private  CndExporter(final List<Rule> scopeExportNames,
                        final List<Rule> scopeReplaceNames,
                        final boolean includeBuiltins); }
CndExporter { public void writeNodetypes(final @NotNull File cndFile, final @NotNull Session session, final @NotNull List<String> desiredTypeNames) throws RepositoryException, IOException, ParseException { writeNodetypes(() -> new OutputStreamWriter(new FileOutputStream(cndFile), StandardCharsets.UTF_8), session, desiredTypeNames, cndFile); } private  CndExporter(final List<Rule> scopeExportNames,
                        final List<Rule> scopeReplaceNames,
                        final boolean includeBuiltins); void writeNodetypes(final @NotNull File cndFile,
                               final @NotNull Session session,
                               final @NotNull List<String> desiredTypeNames); void writeNodetypes(final @NotNull WriterOpener writerOpener,
                               final @NotNull Session session,
                               final @NotNull List<String> desiredTypeNames,
                               final @Nullable File initialCnd); static Map<Name, NodeTypeDefinition> retrieveNodeTypes(final @NotNull Session session,
                                                                  final @NotNull Collection<Name> desiredTypeNames); static Map<Name, NodeTypeDefinition> retrieveNodeTypes(final @NotNull Session session,
                      final @NotNull Collection<Name> desiredTypeNames,
                      final @Nullable BiPredicate<NamePathResolver, NodeType> nodeTypeSelector); }
CndExporter { public void writeNodetypes(final @NotNull File cndFile, final @NotNull Session session, final @NotNull List<String> desiredTypeNames) throws RepositoryException, IOException, ParseException { writeNodetypes(() -> new OutputStreamWriter(new FileOutputStream(cndFile), StandardCharsets.UTF_8), session, desiredTypeNames, cndFile); } private  CndExporter(final List<Rule> scopeExportNames,
                        final List<Rule> scopeReplaceNames,
                        final boolean includeBuiltins); void writeNodetypes(final @NotNull File cndFile,
                               final @NotNull Session session,
                               final @NotNull List<String> desiredTypeNames); void writeNodetypes(final @NotNull WriterOpener writerOpener,
                               final @NotNull Session session,
                               final @NotNull List<String> desiredTypeNames,
                               final @Nullable File initialCnd); static Map<Name, NodeTypeDefinition> retrieveNodeTypes(final @NotNull Session session,
                                                                  final @NotNull Collection<Name> desiredTypeNames); static Map<Name, NodeTypeDefinition> retrieveNodeTypes(final @NotNull Session session,
                      final @NotNull Collection<Name> desiredTypeNames,
                      final @Nullable BiPredicate<NamePathResolver, NodeType> nodeTypeSelector); static final List<String> BUILTIN_NODETYPES; }