@Test public void testValidateSecurityZoneForUpdate() throws Exception{ SearchFilter filter = getSerachFilter(); List<RangerSecurityZone> rangerSecurityZoneList = new ArrayList<RangerSecurityZone>(); RangerService rangerSvc = getRangerService(); RangerServiceDef rangerSvcDef = rangerServiceDef(); RangerSecurityZone suppliedSecurityZone = getRangerSecurityZone(); rangerSecurityZoneList.add(suppliedSecurityZone); Mockito.when(_store.getSecurityZone(1L)).thenReturn(suppliedSecurityZone); Mockito.when(_store.getServiceByName("hdfsSvc")).thenReturn(rangerSvc); Mockito.when(_store.getServiceDefByName("1")).thenReturn(rangerSvcDef); Mockito.when(_securityZoneStore.getSecurityZones(filter)).thenReturn(rangerSecurityZoneList); rangerSecurityZoneValidator.validate(suppliedSecurityZone, RangerValidator.Action.UPDATE); Mockito.verify(_store, Mockito.atLeastOnce()).getSecurityZone(1L); }
public void validate(RangerSecurityZone securityZone, Action action) throws Exception { if (LOG.isDebugEnabled()) { LOG.debug(String.format("==> RangerPolicyValidator.validate(%s, %s)", securityZone, action)); } List<ValidationFailureDetails> failures = new ArrayList<>(); boolean valid = isValid(securityZone, action, failures); String message; try { if (!valid) { message = serializeFailures(failures); throw new Exception(message); } } finally { if (LOG.isDebugEnabled()) { LOG.debug(String.format("<== RangerPolicyValidator.validate(%s, %s)", securityZone, action)); } } }
RangerSecurityZoneValidator extends RangerValidator { public void validate(RangerSecurityZone securityZone, Action action) throws Exception { if (LOG.isDebugEnabled()) { LOG.debug(String.format("==> RangerPolicyValidator.validate(%s, %s)", securityZone, action)); } List<ValidationFailureDetails> failures = new ArrayList<>(); boolean valid = isValid(securityZone, action, failures); String message; try { if (!valid) { message = serializeFailures(failures); throw new Exception(message); } } finally { if (LOG.isDebugEnabled()) { LOG.debug(String.format("<== RangerPolicyValidator.validate(%s, %s)", securityZone, action)); } } } }
RangerSecurityZoneValidator extends RangerValidator { public void validate(RangerSecurityZone securityZone, Action action) throws Exception { if (LOG.isDebugEnabled()) { LOG.debug(String.format("==> RangerPolicyValidator.validate(%s, %s)", securityZone, action)); } List<ValidationFailureDetails> failures = new ArrayList<>(); boolean valid = isValid(securityZone, action, failures); String message; try { if (!valid) { message = serializeFailures(failures); throw new Exception(message); } } finally { if (LOG.isDebugEnabled()) { LOG.debug(String.format("<== RangerPolicyValidator.validate(%s, %s)", securityZone, action)); } } } RangerSecurityZoneValidator(ServiceStore store, SecurityZoneStore securityZoneStore); }
RangerSecurityZoneValidator extends RangerValidator { public void validate(RangerSecurityZone securityZone, Action action) throws Exception { if (LOG.isDebugEnabled()) { LOG.debug(String.format("==> RangerPolicyValidator.validate(%s, %s)", securityZone, action)); } List<ValidationFailureDetails> failures = new ArrayList<>(); boolean valid = isValid(securityZone, action, failures); String message; try { if (!valid) { message = serializeFailures(failures); throw new Exception(message); } } finally { if (LOG.isDebugEnabled()) { LOG.debug(String.format("<== RangerPolicyValidator.validate(%s, %s)", securityZone, action)); } } } RangerSecurityZoneValidator(ServiceStore store, SecurityZoneStore securityZoneStore); void validate(RangerSecurityZone securityZone, Action action); }
RangerSecurityZoneValidator extends RangerValidator { public void validate(RangerSecurityZone securityZone, Action action) throws Exception { if (LOG.isDebugEnabled()) { LOG.debug(String.format("==> RangerPolicyValidator.validate(%s, %s)", securityZone, action)); } List<ValidationFailureDetails> failures = new ArrayList<>(); boolean valid = isValid(securityZone, action, failures); String message; try { if (!valid) { message = serializeFailures(failures); throw new Exception(message); } } finally { if (LOG.isDebugEnabled()) { LOG.debug(String.format("<== RangerPolicyValidator.validate(%s, %s)", securityZone, action)); } } } RangerSecurityZoneValidator(ServiceStore store, SecurityZoneStore securityZoneStore); void validate(RangerSecurityZone securityZone, Action action);  }