Java Code Examples for com.microsoft.azure.storage.file.CloudFileClient#uploadServiceProperties()

The following examples show how to use com.microsoft.azure.storage.file.CloudFileClient#uploadServiceProperties() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServicePropertiesTests.java    From azure-storage-android with Apache License 2.0 6 votes vote down vote up
/**
 * 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());
    }
}
 
Example 2
Source File: ServicePropertiesTests.java    From azure-storage-android with Apache License 2.0 6 votes vote down vote up
/**
 * 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());
    }
}