@Test public void testValidateValidBasePathUri() { LoggingRequest loggingRequest = new LoggingRequest(); loggingRequest.setS3(new S3CloudStorageV1Parameters()); loggingRequest.setStorageLocation("s3: boolean result = underTest.isValid(loggingRequest, context); assertTrue(result); }
@Override public boolean isValid(LoggingRequest value, ConstraintValidatorContext context) { if (value != null) { if (StringUtils.isEmpty(value.getStorageLocation())) { String msg = "Storage location parameter is empty in logging request"; context.buildConstraintViolationWithTemplate(msg).addConstraintViolation(); return false; } if (value.getS3() != null && !isValidPath(value.getStorageLocation())) { String msg = "Storage location parameter is invalid (s3) in logging request"; context.buildConstraintViolationWithTemplate(msg).addConstraintViolation(); return false; } if (value.getS3() == null && value.getAdlsGen2() == null && value.getGcs() == null) { String msg = "Provide at least 1 cloud storage detail in logging request"; context.buildConstraintViolationWithTemplate(msg).addConstraintViolation(); return false; } } return true; }
LoggingRequestValidator implements ConstraintValidator<ValidLoggingRequest, LoggingRequest> { @Override public boolean isValid(LoggingRequest value, ConstraintValidatorContext context) { if (value != null) { if (StringUtils.isEmpty(value.getStorageLocation())) { String msg = "Storage location parameter is empty in logging request"; context.buildConstraintViolationWithTemplate(msg).addConstraintViolation(); return false; } if (value.getS3() != null && !isValidPath(value.getStorageLocation())) { String msg = "Storage location parameter is invalid (s3) in logging request"; context.buildConstraintViolationWithTemplate(msg).addConstraintViolation(); return false; } if (value.getS3() == null && value.getAdlsGen2() == null && value.getGcs() == null) { String msg = "Provide at least 1 cloud storage detail in logging request"; context.buildConstraintViolationWithTemplate(msg).addConstraintViolation(); return false; } } return true; } }
LoggingRequestValidator implements ConstraintValidator<ValidLoggingRequest, LoggingRequest> { @Override public boolean isValid(LoggingRequest value, ConstraintValidatorContext context) { if (value != null) { if (StringUtils.isEmpty(value.getStorageLocation())) { String msg = "Storage location parameter is empty in logging request"; context.buildConstraintViolationWithTemplate(msg).addConstraintViolation(); return false; } if (value.getS3() != null && !isValidPath(value.getStorageLocation())) { String msg = "Storage location parameter is invalid (s3) in logging request"; context.buildConstraintViolationWithTemplate(msg).addConstraintViolation(); return false; } if (value.getS3() == null && value.getAdlsGen2() == null && value.getGcs() == null) { String msg = "Provide at least 1 cloud storage detail in logging request"; context.buildConstraintViolationWithTemplate(msg).addConstraintViolation(); return false; } } return true; }  }
LoggingRequestValidator implements ConstraintValidator<ValidLoggingRequest, LoggingRequest> { @Override public boolean isValid(LoggingRequest value, ConstraintValidatorContext context) { if (value != null) { if (StringUtils.isEmpty(value.getStorageLocation())) { String msg = "Storage location parameter is empty in logging request"; context.buildConstraintViolationWithTemplate(msg).addConstraintViolation(); return false; } if (value.getS3() != null && !isValidPath(value.getStorageLocation())) { String msg = "Storage location parameter is invalid (s3) in logging request"; context.buildConstraintViolationWithTemplate(msg).addConstraintViolation(); return false; } if (value.getS3() == null && value.getAdlsGen2() == null && value.getGcs() == null) { String msg = "Provide at least 1 cloud storage detail in logging request"; context.buildConstraintViolationWithTemplate(msg).addConstraintViolation(); return false; } } return true; }  @Override void initialize(ValidLoggingRequest constraintAnnotation); @Override boolean isValid(LoggingRequest value, ConstraintValidatorContext context); }
LoggingRequestValidator implements ConstraintValidator<ValidLoggingRequest, LoggingRequest> { @Override public boolean isValid(LoggingRequest value, ConstraintValidatorContext context) { if (value != null) { if (StringUtils.isEmpty(value.getStorageLocation())) { String msg = "Storage location parameter is empty in logging request"; context.buildConstraintViolationWithTemplate(msg).addConstraintViolation(); return false; } if (value.getS3() != null && !isValidPath(value.getStorageLocation())) { String msg = "Storage location parameter is invalid (s3) in logging request"; context.buildConstraintViolationWithTemplate(msg).addConstraintViolation(); return false; } if (value.getS3() == null && value.getAdlsGen2() == null && value.getGcs() == null) { String msg = "Provide at least 1 cloud storage detail in logging request"; context.buildConstraintViolationWithTemplate(msg).addConstraintViolation(); return false; } } return true; }  @Override void initialize(ValidLoggingRequest constraintAnnotation); @Override boolean isValid(LoggingRequest value, ConstraintValidatorContext context);  }