@Test public void testParseRevokeSelect() { Set<Permission> operations = parser.parseTargetOperation("revoke_audit_whitelist_for_select", DataResource.fromName("data")); assertThat(operations).containsExactlyInAnyOrder(Permission.SELECT); }
Set<Permission> parseTargetOperation(String inputOption, IResource resource) { String operationString = stripOptionPrefix(inputOption).toUpperCase(); if (ALL_OPERATIONS.equals(operationString)) { return resource.applicablePermissions(); } try { return ImmutableSet.of(Permission.valueOf(operationString)); } catch (IllegalArgumentException e) { throw Exceptions.appendCause(new InvalidRequestException("Invalid whitelist option: " + e.getMessage()), e); } }
WhitelistOptionParser { Set<Permission> parseTargetOperation(String inputOption, IResource resource) { String operationString = stripOptionPrefix(inputOption).toUpperCase(); if (ALL_OPERATIONS.equals(operationString)) { return resource.applicablePermissions(); } try { return ImmutableSet.of(Permission.valueOf(operationString)); } catch (IllegalArgumentException e) { throw Exceptions.appendCause(new InvalidRequestException("Invalid whitelist option: " + e.getMessage()), e); } } }
WhitelistOptionParser { Set<Permission> parseTargetOperation(String inputOption, IResource resource) { String operationString = stripOptionPrefix(inputOption).toUpperCase(); if (ALL_OPERATIONS.equals(operationString)) { return resource.applicablePermissions(); } try { return ImmutableSet.of(Permission.valueOf(operationString)); } catch (IllegalArgumentException e) { throw Exceptions.appendCause(new InvalidRequestException("Invalid whitelist option: " + e.getMessage()), e); } }  }
WhitelistOptionParser { Set<Permission> parseTargetOperation(String inputOption, IResource resource) { String operationString = stripOptionPrefix(inputOption).toUpperCase(); if (ALL_OPERATIONS.equals(operationString)) { return resource.applicablePermissions(); } try { return ImmutableSet.of(Permission.valueOf(operationString)); } catch (IllegalArgumentException e) { throw Exceptions.appendCause(new InvalidRequestException("Invalid whitelist option: " + e.getMessage()), e); } }   }
WhitelistOptionParser { Set<Permission> parseTargetOperation(String inputOption, IResource resource) { String operationString = stripOptionPrefix(inputOption).toUpperCase(); if (ALL_OPERATIONS.equals(operationString)) { return resource.applicablePermissions(); } try { return ImmutableSet.of(Permission.valueOf(operationString)); } catch (IllegalArgumentException e) { throw Exceptions.appendCause(new InvalidRequestException("Invalid whitelist option: " + e.getMessage()), e); } }    }