private void check(final StorageService storage) { assertNotNull(storage.id()); assertNotNull(storage.name()); assertNotNull(storage.storageServiceProperties()); assertNotNull(storage.storageServiceProperties().accountType()); assertFalse(storage.storageServiceProperties().primaryEndpoints().isEmpty()); assertNotNull(storage.storageServiceProperties().creationTime()); }
final StorageService.StorageServiceProperties props = StorageService.StorageServiceProperties.create( StorageService.AccountType.Standard_RAGRS, DATE_SERVICE.iso8601DateOrSecondsDateParse("2016-02-24T13:04:45.0890883Z"), StorageService.RegionStatus.Available, StorageService.RegionStatus.Available); final StorageService.StorageServiceProperties props2 = StorageService.StorageServiceProperties.create( StorageService.AccountType.Standard_RAGRS, DATE_SERVICE.iso8601DateOrSecondsDateParse("2016-02-24T13:11:43.8265672Z"), StorageService.RegionStatus.Available, StorageService.RegionStatus.Available); final StorageService.StorageServiceProperties props3 = StorageService.StorageServiceProperties.create( StorageService.AccountType.Standard_RAGRS, DATE_SERVICE.iso8601DateOrSecondsDateParse("2016-02-24T14:12:59.5223315Z"),
@Test(dependsOnMethods = "testCreate") public void testGet() { final StorageService service = api().get(NAME); assertNotNull(service); assertEquals(service.name(), NAME); assertEquals(service.storageServiceProperties().primaryLocation(), LOCATION); assertEquals(service.storageServiceProperties().accountType(), StorageService.AccountType.Standard_LRS); }
String blob = storageService.storageServiceProperties().primaryEndpoints().get("blob");
@SerializedNames({"accountType", "creationTime", "primaryEndpoints", "primaryLocation", "provisioningState", "secondaryEndpoints", "secondaryLocation", "statusOfPrimary", "statusOfSecondary"}) public static StorageServiceProperties create(final AccountType accountType, final Date creationTime, final Map<String, String> primaryEndpoints, final String primaryLocation, final Status provisioningState, final Map<String, String> secondaryEndpoints, final String secondaryLocation, final RegionStatus statusOfPrimary, final RegionStatus statusOfSecondary) { StorageServiceProperties.Builder builder = StorageServiceProperties.builder() .accountType(accountType) .creationTime(creationTime) .primaryLocation(primaryLocation) .provisioningState(provisioningState) .secondaryLocation(secondaryLocation) .statusOfPrimary(statusOfPrimary) .statusOfSecondary(statusOfSecondary); builder.primaryEndpoints(primaryEndpoints != null ? ImmutableMap.copyOf(primaryEndpoints) : null); builder.secondaryEndpoints(secondaryEndpoints != null ? ImmutableMap.copyOf(secondaryEndpoints) : null); return builder.build(); }
@Test(dependsOnMethods = "testIsAvailable") public void testCreate() { URI uri = api().create(NAME, LOCATION, ImmutableMap.of("property_name", "property_value"), ImmutableMap.of("accountType", StorageService.AccountType.Standard_LRS.toString())); if (uri != null){ assertTrue(uri.toString().contains("api-version")); boolean jobDone = Predicates2.retry(new Predicate<URI>() { @Override public boolean apply(URI uri) { return ParseJobStatus.JobStatus.DONE == api.getJobApi().jobStatus(uri); } }, 60 * 1 * 1000 /* 1 minute timeout */).apply(uri); assertTrue(jobDone, "create operation did not complete in the configured timeout"); } final StorageService service = api().get(NAME); assertNotNull(service); assertEquals(service.location(), LOCATION); assertNotNull(service.storageServiceProperties().creationTime()); }
@SerializedNames({"accountType", "creationTime", "primaryEndpoints", "primaryLocation", "provisioningState", "secondaryEndpoints", "secondaryLocation", "statusOfPrimary", "statusOfSecondary"}) public static StorageServiceProperties create(final AccountType accountType, final Date creationTime, final Map<String, String> primaryEndpoints, final String primaryLocation, final Status provisioningState, final Map<String, String> secondaryEndpoints, final String secondaryLocation, final RegionStatus statusOfPrimary, final RegionStatus statusOfSecondary) { StorageServiceProperties.Builder builder = StorageServiceProperties.builder() .accountType(accountType) .creationTime(creationTime) .primaryLocation(primaryLocation) .provisioningState(provisioningState) .secondaryLocation(secondaryLocation) .statusOfPrimary(statusOfPrimary) .statusOfSecondary(statusOfSecondary); builder.primaryEndpoints(primaryEndpoints != null ? ImmutableMap.copyOf(primaryEndpoints) : null); builder.secondaryEndpoints(secondaryEndpoints != null ? ImmutableMap.copyOf(secondaryEndpoints) : null); return builder.build(); }