WebsterNodetypesTarget implements WebsterTarget, ArchiveAware { static WebsterNodetypesTarget fromJson(final File target, final JsonObject config) { LOGGER.debug("[fromJson] fromJson: {}", config.toString()); CndExporter.Builder builder = new CndExporter.Builder(); if (config.containsKey(KEY_SCOPE_EXPORT_NAMES)) { List<Rule> scopeExportNames = Rules.fromJsonArray(config.getJsonArray(KEY_SCOPE_EXPORT_NAMES)); builder.withScopeExportNames(scopeExportNames); } if (config.containsKey(KEY_SCOPE_REPLACE_NAMES)) { List<Rule> scopeReplaceNames = Rules.fromJsonArray(config.getJsonArray(KEY_SCOPE_REPLACE_NAMES)); builder.withScopeReplaceNames(scopeReplaceNames); } if (config.containsKey(KEY_INCLUDE_BUILTINS)) { builder.withIncludeBuiltins(config.getBoolean(KEY_INCLUDE_BUILTINS, false)); } return new WebsterNodetypesTarget(target, builder.build()); } private  WebsterNodetypesTarget(final File targetFile, final CndExporter exporter); @Override void setArchive(final Archive archive, final File writeBackDir); @Override void perform(final Session session);  }
@Test public void testFromJson() throws Exception { final File targetFile = new File(testOutDir, "testFromJson.cnd"); final File writeBack = new File(testOutDir, "testFromJson_writeback"); if (targetFile.exists()) { targetFile.delete(); } if (writeBack.exists()) { FileUtils.deleteDirectory(writeBack); } OakMachine.Builder builder = TestUtil.fromPlan(obj().get()); WebsterNodetypesTarget target = WebsterNodetypesTarget.fromJson(targetFile, obj().get()); target.setArchive(new FileArchive(new File("src/test/resources/filevault/noReferences")), writeBack); builder.build().initAndInspect(target::perform); }