@Test void isAllowed() { assertTrue(this.validator.isAllowed(Arrays.asList("namespace"), "namespace")); assertTrue(this.validator.isAllowed(Arrays.asList("{root}"), null)); assertTrue(this.validator.isAllowed(Arrays.asList("{}"), null)); assertTrue(this.validator.isAllowed(Arrays.asList("[.*]"), "namespace")); assertTrue(this.validator.isAllowed(Arrays.asList("[wiki:(?!xwiki$).*]"), "wiki:test")); assertFalse(this.validator.isAllowed(Arrays.asList("namespace"), "wrong")); assertFalse(this.validator.isAllowed(Arrays.asList("{root}"), "wrong")); assertFalse(this.validator.isAllowed(Arrays.asList("[\\d*]"), "namespace")); assertFalse(this.validator.isAllowed(Arrays.asList((String) null), "namespace")); }
@Override public boolean isAllowed(Collection<String> allowedNamespaces, String namespace) { if (allowedNamespaces == null) { return true; } for (String allowedNamespace : allowedNamespaces) { if (isAllowed(allowedNamespace, namespace)) { return true; } } return false; }
DefaultNamespaceValidator implements NamespaceValidator { @Override public boolean isAllowed(Collection<String> allowedNamespaces, String namespace) { if (allowedNamespaces == null) { return true; } for (String allowedNamespace : allowedNamespaces) { if (isAllowed(allowedNamespace, namespace)) { return true; } } return false; } }
DefaultNamespaceValidator implements NamespaceValidator { @Override public boolean isAllowed(Collection<String> allowedNamespaces, String namespace) { if (allowedNamespaces == null) { return true; } for (String allowedNamespace : allowedNamespaces) { if (isAllowed(allowedNamespace, namespace)) { return true; } } return false; }  }
DefaultNamespaceValidator implements NamespaceValidator { @Override public boolean isAllowed(Collection<String> allowedNamespaces, String namespace) { if (allowedNamespaces == null) { return true; } for (String allowedNamespace : allowedNamespaces) { if (isAllowed(allowedNamespace, namespace)) { return true; } } return false; }  @Override boolean isAllowed(Collection<String> allowedNamespaces, String namespace); @Override void checkAllowed(Collection<String> allowedNamespaces, String namespace); }
DefaultNamespaceValidator implements NamespaceValidator { @Override public boolean isAllowed(Collection<String> allowedNamespaces, String namespace) { if (allowedNamespaces == null) { return true; } for (String allowedNamespace : allowedNamespaces) { if (isAllowed(allowedNamespace, namespace)) { return true; } } return false; }  @Override boolean isAllowed(Collection<String> allowedNamespaces, String namespace); @Override void checkAllowed(Collection<String> allowedNamespaces, String namespace);  }