@Test public void testLevelSet() throws Exception { TestUtil.testBlock(() -> { ProgressCheck check = new AcHandling().newInstance(obj().key("levelSet", "no_unsafe").get()); CheckReport report = scanWithCheck(check, "test_childnodeorder.zip"); logViolations("level_set:no_unsafe", report); Assert.assertEquals("no violations", 0, report.getViolations().size()); assertTrue("all violations have packageIds", report.getViolations().stream() .allMatch(viol -> !viol.getPackages().isEmpty())); }); TestUtil.testBlock(() -> { ProgressCheck check = new AcHandling().newInstance(obj().key("levelSet", "only_ignore").get()); CheckReport report = scanWithCheck(check, "test_childnodeorder.zip"); logViolations("level_set:only_ignore", report); Assert.assertEquals("one violation", 1, report.getViolations().size()); assertTrue("all violations have packageIds", report.getViolations().stream() .allMatch(viol -> !viol.getPackages().isEmpty())); }); }
@Override public ProgressCheck newInstance(final JsonObject config) { if (hasNonNull(config, keys().allowedModes())) { List<AccessControlHandling> allowedModes = mapArrayOfStrings(arrayOrEmpty(config, keys().allowedModes()), compose1(String::toUpperCase, AccessControlHandling::valueOf), true); return new Check(ACHandlingLevelSet.EXPLICIT, allowedModes); } else if (hasNonNull(config, keys().levelSet())) { ACHandlingLevelSet levelSet = ACHandlingLevelSet.valueOf(config.getString(keys().levelSet()).toUpperCase()); return new Check(levelSet, Collections.emptyList()); } else { return new Check(DEFAULT_LEVEL_SET, Collections.emptyList()); } }
AcHandling implements ProgressCheckFactory { @Override public ProgressCheck newInstance(final JsonObject config) { if (hasNonNull(config, keys().allowedModes())) { List<AccessControlHandling> allowedModes = mapArrayOfStrings(arrayOrEmpty(config, keys().allowedModes()), compose1(String::toUpperCase, AccessControlHandling::valueOf), true); return new Check(ACHandlingLevelSet.EXPLICIT, allowedModes); } else if (hasNonNull(config, keys().levelSet())) { ACHandlingLevelSet levelSet = ACHandlingLevelSet.valueOf(config.getString(keys().levelSet()).toUpperCase()); return new Check(levelSet, Collections.emptyList()); } else { return new Check(DEFAULT_LEVEL_SET, Collections.emptyList()); } } }
AcHandling implements ProgressCheckFactory { @Override public ProgressCheck newInstance(final JsonObject config) { if (hasNonNull(config, keys().allowedModes())) { List<AccessControlHandling> allowedModes = mapArrayOfStrings(arrayOrEmpty(config, keys().allowedModes()), compose1(String::toUpperCase, AccessControlHandling::valueOf), true); return new Check(ACHandlingLevelSet.EXPLICIT, allowedModes); } else if (hasNonNull(config, keys().levelSet())) { ACHandlingLevelSet levelSet = ACHandlingLevelSet.valueOf(config.getString(keys().levelSet()).toUpperCase()); return new Check(levelSet, Collections.emptyList()); } else { return new Check(DEFAULT_LEVEL_SET, Collections.emptyList()); } }  }
AcHandling implements ProgressCheckFactory { @Override public ProgressCheck newInstance(final JsonObject config) { if (hasNonNull(config, keys().allowedModes())) { List<AccessControlHandling> allowedModes = mapArrayOfStrings(arrayOrEmpty(config, keys().allowedModes()), compose1(String::toUpperCase, AccessControlHandling::valueOf), true); return new Check(ACHandlingLevelSet.EXPLICIT, allowedModes); } else if (hasNonNull(config, keys().levelSet())) { ACHandlingLevelSet levelSet = ACHandlingLevelSet.valueOf(config.getString(keys().levelSet()).toUpperCase()); return new Check(levelSet, Collections.emptyList()); } else { return new Check(DEFAULT_LEVEL_SET, Collections.emptyList()); } }  static JsonKeys keys(); @Override ProgressCheck newInstance(final JsonObject config); }
AcHandling implements ProgressCheckFactory { @Override public ProgressCheck newInstance(final JsonObject config) { if (hasNonNull(config, keys().allowedModes())) { List<AccessControlHandling> allowedModes = mapArrayOfStrings(arrayOrEmpty(config, keys().allowedModes()), compose1(String::toUpperCase, AccessControlHandling::valueOf), true); return new Check(ACHandlingLevelSet.EXPLICIT, allowedModes); } else if (hasNonNull(config, keys().levelSet())) { ACHandlingLevelSet levelSet = ACHandlingLevelSet.valueOf(config.getString(keys().levelSet()).toUpperCase()); return new Check(levelSet, Collections.emptyList()); } else { return new Check(DEFAULT_LEVEL_SET, Collections.emptyList()); } }  static JsonKeys keys(); @Override ProgressCheck newInstance(final JsonObject config); @Deprecated
    static final String CONFIG_ALLOWED_MODES; @Deprecated
    static final String CONFIG_LEVEL_SET; }