@Test public void testIsCloudStorageConfiguredWhenAdlsGen2NotNull() { CloudStorageRequest cloudStorageRequest = new CloudStorageRequest(); StorageIdentityBase storageIdentityBase = new StorageIdentityBase(); storageIdentityBase.setAdlsGen2(new AdlsGen2CloudStorageV1Parameters()); cloudStorageRequest.setIdentities(List.of(storageIdentityBase)); cloudStorageRequest.setLocations(List.of(new StorageLocationBase())); boolean actual = underTest.isCloudStorageConfigured(cloudStorageRequest); Assert.assertTrue(actual); }
public boolean isCloudStorageConfigured(CloudStorageBase cloudStorageRequest) { ValidationResultBuilder validationBuilder = new ValidationResultBuilder(); if (cloudStorageRequest != null) { if (CollectionUtils.isEmpty(cloudStorageRequest.getLocations()) && CollectionUtils.isEmpty(cloudStorageRequest.getIdentities())) { return false; } if (!containsOnlyLogIdentity(cloudStorageRequest.getIdentities())) { validationBuilder.ifError(() -> CollectionUtils.isEmpty(cloudStorageRequest.getLocations()) && CollectionUtils.isEmpty(cloudStorageRequest.getIdentities()), "Either 'locations' or 'identities' in 'cloudStorage' must not be empty!"); } ValidationResult validationResult = validationBuilder.build(); if (validationResult.hasError()) { throw new BadRequestException(validationResult.getFormattedErrors()); } return true; } else { return false; } }
CloudStorageValidationUtil { public boolean isCloudStorageConfigured(CloudStorageBase cloudStorageRequest) { ValidationResultBuilder validationBuilder = new ValidationResultBuilder(); if (cloudStorageRequest != null) { if (CollectionUtils.isEmpty(cloudStorageRequest.getLocations()) && CollectionUtils.isEmpty(cloudStorageRequest.getIdentities())) { return false; } if (!containsOnlyLogIdentity(cloudStorageRequest.getIdentities())) { validationBuilder.ifError(() -> CollectionUtils.isEmpty(cloudStorageRequest.getLocations()) && CollectionUtils.isEmpty(cloudStorageRequest.getIdentities()), "Either 'locations' or 'identities' in 'cloudStorage' must not be empty!"); } ValidationResult validationResult = validationBuilder.build(); if (validationResult.hasError()) { throw new BadRequestException(validationResult.getFormattedErrors()); } return true; } else { return false; } } }
CloudStorageValidationUtil { public boolean isCloudStorageConfigured(CloudStorageBase cloudStorageRequest) { ValidationResultBuilder validationBuilder = new ValidationResultBuilder(); if (cloudStorageRequest != null) { if (CollectionUtils.isEmpty(cloudStorageRequest.getLocations()) && CollectionUtils.isEmpty(cloudStorageRequest.getIdentities())) { return false; } if (!containsOnlyLogIdentity(cloudStorageRequest.getIdentities())) { validationBuilder.ifError(() -> CollectionUtils.isEmpty(cloudStorageRequest.getLocations()) && CollectionUtils.isEmpty(cloudStorageRequest.getIdentities()), "Either 'locations' or 'identities' in 'cloudStorage' must not be empty!"); } ValidationResult validationResult = validationBuilder.build(); if (validationResult.hasError()) { throw new BadRequestException(validationResult.getFormattedErrors()); } return true; } else { return false; } }  }
CloudStorageValidationUtil { public boolean isCloudStorageConfigured(CloudStorageBase cloudStorageRequest) { ValidationResultBuilder validationBuilder = new ValidationResultBuilder(); if (cloudStorageRequest != null) { if (CollectionUtils.isEmpty(cloudStorageRequest.getLocations()) && CollectionUtils.isEmpty(cloudStorageRequest.getIdentities())) { return false; } if (!containsOnlyLogIdentity(cloudStorageRequest.getIdentities())) { validationBuilder.ifError(() -> CollectionUtils.isEmpty(cloudStorageRequest.getLocations()) && CollectionUtils.isEmpty(cloudStorageRequest.getIdentities()), "Either 'locations' or 'identities' in 'cloudStorage' must not be empty!"); } ValidationResult validationResult = validationBuilder.build(); if (validationResult.hasError()) { throw new BadRequestException(validationResult.getFormattedErrors()); } return true; } else { return false; } }  boolean isCloudStorageConfigured(CloudStorageBase cloudStorageRequest); }
CloudStorageValidationUtil { public boolean isCloudStorageConfigured(CloudStorageBase cloudStorageRequest) { ValidationResultBuilder validationBuilder = new ValidationResultBuilder(); if (cloudStorageRequest != null) { if (CollectionUtils.isEmpty(cloudStorageRequest.getLocations()) && CollectionUtils.isEmpty(cloudStorageRequest.getIdentities())) { return false; } if (!containsOnlyLogIdentity(cloudStorageRequest.getIdentities())) { validationBuilder.ifError(() -> CollectionUtils.isEmpty(cloudStorageRequest.getLocations()) && CollectionUtils.isEmpty(cloudStorageRequest.getIdentities()), "Either 'locations' or 'identities' in 'cloudStorage' must not be empty!"); } ValidationResult validationResult = validationBuilder.build(); if (validationResult.hasError()) { throw new BadRequestException(validationResult.getFormattedErrors()); } return true; } else { return false; } }  boolean isCloudStorageConfigured(CloudStorageBase cloudStorageRequest);  }