/** * Uploads a new {@link FileServiceProperties} configuration to the given storage service. This encapsulates * the CORS configurations. * * @param properties * A {@link FileServiceProperties} object which specifies the service properties to upload. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public void uploadServiceProperties(final FileServiceProperties properties) throws StorageException { this.uploadServiceProperties(properties, null /* options */, null /* opContext */); }
/** * Uploads a new {@link FileServiceProperties} configuration to the given storage service. This encapsulates * the CORS configurations. * * @param properties * A {@link FileServiceProperties} object which specifies the service properties to upload. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public void uploadServiceProperties(final FileServiceProperties properties) throws StorageException { this.uploadServiceProperties(properties, null /* options */, null /* opContext */); }
private void callUploadServiceProps( ServiceClient client, ServiceProperties props, FileServiceProperties fileProps) throws StorageException, InterruptedException { if (client.getClass().equals(CloudBlobClient.class)) { ((CloudBlobClient) client).uploadServiceProperties(props); } else if (client.getClass().equals(CloudTableClient.class)) { ((CloudTableClient) client).uploadServiceProperties(props); } else if (client.getClass().equals(CloudQueueClient.class)) { ((CloudQueueClient) client).uploadServiceProperties(props); } else if (client.getClass().equals(CloudFileClient.class)) { ((CloudFileClient) client).uploadServiceProperties(fileProps); } else { fail(); } Thread.sleep(30000); }
/** * Takes a CorsRule and tries to upload it. Then tries to download it and compares it to the initial CorsRule. */ private void testCorsRules(CorsRule rule, ServiceClient client, ServiceProperties properties, FileServiceProperties fileServiceProperties) throws StorageException, InterruptedException { CorsProperties cors = (fileServiceProperties == null) ? properties.getCors() : fileServiceProperties.getCors(); cors.getCorsRules().clear(); cors.getCorsRules().add(rule); if (fileServiceProperties == null) { callUploadServiceProps(client, properties, null); assertServicePropertiesAreEqual(properties, callDownloadServiceProperties(client)); } else { CloudFileClient fileClient = ((CloudFileClient) client); fileClient.uploadServiceProperties(fileServiceProperties); Thread.sleep(30000); assertFileServicePropertiesAreEqual(fileServiceProperties, fileClient.downloadServiceProperties()); } }
/** * Takes a List of CorsRules and tries to upload them. Then tries to download them and compares the list to the * initial CorsRule List. */ private void testCorsRules(List<CorsRule> corsRules, ServiceClient client, ServiceProperties properties, FileServiceProperties fileServiceProperties) throws StorageException, InterruptedException { CorsProperties cors = (fileServiceProperties == null) ? properties.getCors() : fileServiceProperties.getCors(); cors.getCorsRules().clear(); for (CorsRule rule : corsRules) { cors.getCorsRules().add(rule); } if (fileServiceProperties == null) { callUploadServiceProps(client, properties, null); assertServicePropertiesAreEqual(properties, callDownloadServiceProperties(client)); } else { CloudFileClient fileClient = ((CloudFileClient) client); fileClient.uploadServiceProperties(fileServiceProperties); Thread.sleep(30000); assertFileServicePropertiesAreEqual(fileServiceProperties, fileClient.downloadServiceProperties()); } }