@Test public void testSelectorsFromConfigCompactForm() { List<WebsterChecklistTarget.Selector> pathSelector = selectorsFromConfigCompactForm(key("selectPaths", arr("/foo1", "/foo2")).get()); assertEquals("expect type", PATH, pathSelector.get(0).getType()); assertEquals("expect args", Arrays.asList("/foo1", "/foo2"), pathSelector.get(0).getArgs()); List<WebsterChecklistTarget.Selector> ntSelector = selectorsFromConfigCompactForm(key("selectNodeTypes", arr("foo:nt1", "foo:mix1")).get()); assertEquals("expect type", NODETYPE, ntSelector.get(0).getType()); assertEquals("expect args", Arrays.asList("foo:nt1", "foo:mix1"), ntSelector.get(0).getArgs()); List<WebsterChecklistTarget.Selector> querySelector = selectorsFromConfigCompactForm(key("selectQuery", "select * from [nt:base]").get()); assertEquals("expect type", QUERY, querySelector.get(0).getType()); assertEquals("expect args", Collections.singletonList("select * from [nt:base]"), querySelector.get(0).getArgs()); }
static List<Selector> selectorsFromConfigCompactForm(final JsonObject json) { final List<Selector> selectors = new ArrayList<>(); if (json.containsKey(COMPACT_KEY_BY_NODETYPES)) { final List<String> args = JavaxJson.mapArrayOfStrings(json.getJsonArray(COMPACT_KEY_BY_NODETYPES)); selectors.add(new Selector(ChecklistExporter.SelectorType.NODETYPE, args.toArray(new String[0]))); } if (json.containsKey(COMPACT_KEY_BY_PATHS)) { final List<String> args = JavaxJson.mapArrayOfStrings(json.getJsonArray(COMPACT_KEY_BY_PATHS)); selectors.add(new Selector(ChecklistExporter.SelectorType.PATH, args.toArray(new String[0]))); } if (json.containsKey(COMPACT_KEY_BY_QUERY)) { selectors.add(new Selector(ChecklistExporter.SelectorType.QUERY, new String[]{json.getString(COMPACT_KEY_BY_QUERY)})); } return selectors; }
WebsterChecklistTarget implements WebsterTarget { static List<Selector> selectorsFromConfigCompactForm(final JsonObject json) { final List<Selector> selectors = new ArrayList<>(); if (json.containsKey(COMPACT_KEY_BY_NODETYPES)) { final List<String> args = JavaxJson.mapArrayOfStrings(json.getJsonArray(COMPACT_KEY_BY_NODETYPES)); selectors.add(new Selector(ChecklistExporter.SelectorType.NODETYPE, args.toArray(new String[0]))); } if (json.containsKey(COMPACT_KEY_BY_PATHS)) { final List<String> args = JavaxJson.mapArrayOfStrings(json.getJsonArray(COMPACT_KEY_BY_PATHS)); selectors.add(new Selector(ChecklistExporter.SelectorType.PATH, args.toArray(new String[0]))); } if (json.containsKey(COMPACT_KEY_BY_QUERY)) { selectors.add(new Selector(ChecklistExporter.SelectorType.QUERY, new String[]{json.getString(COMPACT_KEY_BY_QUERY)})); } return selectors; } }
WebsterChecklistTarget implements WebsterTarget { static List<Selector> selectorsFromConfigCompactForm(final JsonObject json) { final List<Selector> selectors = new ArrayList<>(); if (json.containsKey(COMPACT_KEY_BY_NODETYPES)) { final List<String> args = JavaxJson.mapArrayOfStrings(json.getJsonArray(COMPACT_KEY_BY_NODETYPES)); selectors.add(new Selector(ChecklistExporter.SelectorType.NODETYPE, args.toArray(new String[0]))); } if (json.containsKey(COMPACT_KEY_BY_PATHS)) { final List<String> args = JavaxJson.mapArrayOfStrings(json.getJsonArray(COMPACT_KEY_BY_PATHS)); selectors.add(new Selector(ChecklistExporter.SelectorType.PATH, args.toArray(new String[0]))); } if (json.containsKey(COMPACT_KEY_BY_QUERY)) { selectors.add(new Selector(ChecklistExporter.SelectorType.QUERY, new String[]{json.getString(COMPACT_KEY_BY_QUERY)})); } return selectors; } private  WebsterChecklistTarget(final File checklist,
                                   final ChecklistExporter exporter,
                                   final ChecklistExporter.ForcedRootUpdatePolicy updatePolicy); }
WebsterChecklistTarget implements WebsterTarget { static List<Selector> selectorsFromConfigCompactForm(final JsonObject json) { final List<Selector> selectors = new ArrayList<>(); if (json.containsKey(COMPACT_KEY_BY_NODETYPES)) { final List<String> args = JavaxJson.mapArrayOfStrings(json.getJsonArray(COMPACT_KEY_BY_NODETYPES)); selectors.add(new Selector(ChecklistExporter.SelectorType.NODETYPE, args.toArray(new String[0]))); } if (json.containsKey(COMPACT_KEY_BY_PATHS)) { final List<String> args = JavaxJson.mapArrayOfStrings(json.getJsonArray(COMPACT_KEY_BY_PATHS)); selectors.add(new Selector(ChecklistExporter.SelectorType.PATH, args.toArray(new String[0]))); } if (json.containsKey(COMPACT_KEY_BY_QUERY)) { selectors.add(new Selector(ChecklistExporter.SelectorType.QUERY, new String[]{json.getString(COMPACT_KEY_BY_QUERY)})); } return selectors; } private  WebsterChecklistTarget(final File checklist,
                                   final ChecklistExporter exporter,
                                   final ChecklistExporter.ForcedRootUpdatePolicy updatePolicy); @Override void perform(final Session session); }
WebsterChecklistTarget implements WebsterTarget { static List<Selector> selectorsFromConfigCompactForm(final JsonObject json) { final List<Selector> selectors = new ArrayList<>(); if (json.containsKey(COMPACT_KEY_BY_NODETYPES)) { final List<String> args = JavaxJson.mapArrayOfStrings(json.getJsonArray(COMPACT_KEY_BY_NODETYPES)); selectors.add(new Selector(ChecklistExporter.SelectorType.NODETYPE, args.toArray(new String[0]))); } if (json.containsKey(COMPACT_KEY_BY_PATHS)) { final List<String> args = JavaxJson.mapArrayOfStrings(json.getJsonArray(COMPACT_KEY_BY_PATHS)); selectors.add(new Selector(ChecklistExporter.SelectorType.PATH, args.toArray(new String[0]))); } if (json.containsKey(COMPACT_KEY_BY_QUERY)) { selectors.add(new Selector(ChecklistExporter.SelectorType.QUERY, new String[]{json.getString(COMPACT_KEY_BY_QUERY)})); } return selectors; } private  WebsterChecklistTarget(final File checklist,
                                   final ChecklistExporter exporter,
                                   final ChecklistExporter.ForcedRootUpdatePolicy updatePolicy); @Override void perform(final Session session);  }