Skip to content

Commit

Permalink
Confirmed support for static website properties (#13255)
Browse files Browse the repository at this point in the history
  • Loading branch information
gapra-msft authored Jul 17, 2020
1 parent b020bee commit 26f1b12
Show file tree
Hide file tree
Showing 2 changed files with 191 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

package com.azure.storage.blob

import com.azure.core.http.rest.Response
import com.azure.core.util.paging.ContinuablePage
import com.azure.core.util.Context
import com.azure.identity.DefaultAzureCredentialBuilder
Expand Down Expand Up @@ -500,6 +501,29 @@ class ServiceAPITest extends APISpec {
primaryBlobServiceClient.setPropertiesWithResponse(serviceProperties, null, null).getStatusCode() == 202
}

def "Set props static website"() {
setup:
def serviceProperties = primaryBlobServiceClient.getProperties()
def errorDocument404Path = "error/404.html"
def defaultIndexDocumentPath = "index.html"

serviceProperties.setStaticWebsite(new StaticWebsite()
.setEnabled(true)
.setErrorDocument404Path(errorDocument404Path)
.setDefaultIndexDocumentPath(defaultIndexDocumentPath)
)

when:
Response<Void> resp = primaryBlobServiceClient.setPropertiesWithResponse(serviceProperties, null, null)

then:
resp.getStatusCode() == 202
def staticWebsite = primaryBlobServiceClient.getProperties().getStaticWebsite()
staticWebsite.isEnabled()
staticWebsite.getErrorDocument404Path() == errorDocument404Path
staticWebsite.getDefaultIndexDocumentPath() == defaultIndexDocumentPath
}

def "Set props error"() {
when:
getServiceClient(primaryCredential, "https://error.blob.core.windows.net")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
{
"networkCallRecords" : [ {
"Method" : "PUT",
"Uri" : "https://REDACTED.blob.core.windows.net/jtcsetpropsstaticwebsite06467780c979b3ddde4c08?restype=container",
"Headers" : {
"x-ms-version" : "2019-12-12",
"User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.2 (11.0.7; Windows 10; 10.0)",
"x-ms-client-request-id" : "a0237929-2fc2-48d2-9d36-3198897ec00c"
},
"Response" : {
"x-ms-version" : "2019-12-12",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
"ETag" : "0x8D829CE333287C4",
"Last-Modified" : "Thu, 16 Jul 2020 21:21:27 GMT",
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "201",
"x-ms-request-id" : "cf0ec229-401e-00a9-6ab7-5b50f0000000",
"Date" : "Thu, 16 Jul 2020 21:21:26 GMT",
"x-ms-client-request-id" : "a0237929-2fc2-48d2-9d36-3198897ec00c"
},
"Exception" : null
}, {
"Method" : "PUT",
"Uri" : "https://REDACTED.blob.core.windows.net?restype=service&comp=properties",
"Headers" : {
"x-ms-version" : "2019-12-12",
"User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.2 (11.0.7; Windows 10; 10.0)",
"x-ms-client-request-id" : "e4c40973-f03d-4fbf-ac76-4297d9b09b8f",
"Content-Type" : "application/xml; charset=utf-8"
},
"Response" : {
"x-ms-version" : "2019-12-12",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "202",
"x-ms-request-id" : "3497f8a0-601e-0081-01b7-5b3158000000",
"Date" : "Thu, 16 Jul 2020 21:21:27 GMT",
"x-ms-client-request-id" : "e4c40973-f03d-4fbf-ac76-4297d9b09b8f"
},
"Exception" : null
}, {
"Method" : "GET",
"Uri" : "https://REDACTED.blob.core.windows.net?restype=service&comp=properties",
"Headers" : {
"x-ms-version" : "2019-12-12",
"User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.2 (11.0.7; Windows 10; 10.0)",
"x-ms-client-request-id" : "14d580fc-168a-4a74-bca7-67fe450e9893"
},
"Response" : {
"Transfer-Encoding" : "chunked",
"x-ms-version" : "2019-12-12",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
"retry-after" : "0",
"StatusCode" : "200",
"x-ms-request-id" : "e89856b4-001e-003e-58b7-5b06fd000000",
"Body" : "<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors /><DeleteRetentionPolicy><Enabled>false</Enabled></DeleteRetentionPolicy><StaticWebsite><Enabled>false</Enabled></StaticWebsite><DefaultServiceVersion>2018-03-28</DefaultServiceVersion></StorageServiceProperties>",
"Date" : "Thu, 16 Jul 2020 21:21:27 GMT",
"x-ms-client-request-id" : "14d580fc-168a-4a74-bca7-67fe450e9893",
"Content-Type" : "application/xml"
},
"Exception" : null
}, {
"Method" : "PUT",
"Uri" : "https://REDACTED.blob.core.windows.net?restype=service&comp=properties",
"Headers" : {
"x-ms-version" : "2019-12-12",
"User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.2 (11.0.7; Windows 10; 10.0)",
"x-ms-client-request-id" : "e292e018-e57e-4c22-96c5-02348cd8e47f",
"Content-Type" : "application/xml; charset=utf-8"
},
"Response" : {
"x-ms-version" : "2019-12-12",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "202",
"x-ms-request-id" : "26455ead-d01e-0084-5db7-5be383000000",
"Date" : "Thu, 16 Jul 2020 21:21:29 GMT",
"x-ms-client-request-id" : "e292e018-e57e-4c22-96c5-02348cd8e47f"
},
"Exception" : null
}, {
"Method" : "GET",
"Uri" : "https://REDACTED.blob.core.windows.net?restype=service&comp=properties",
"Headers" : {
"x-ms-version" : "2019-12-12",
"User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.2 (11.0.7; Windows 10; 10.0)",
"x-ms-client-request-id" : "2408daa9-7769-4e53-8d73-480700f09b0f"
},
"Response" : {
"Transfer-Encoding" : "chunked",
"x-ms-version" : "2019-12-12",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
"retry-after" : "0",
"StatusCode" : "200",
"x-ms-request-id" : "a6f24a4d-d01e-002d-16b7-5b22f1000000",
"Body" : "<?xml version=\"1.0\" encoding=\"utf-8\"?><StorageServiceProperties><Logging><Version>1.0</Version><Read>false</Read><Write>false</Write><Delete>false</Delete><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></Logging><HourMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></HourMetrics><MinuteMetrics><Version>1.0</Version><Enabled>false</Enabled><RetentionPolicy><Enabled>false</Enabled></RetentionPolicy></MinuteMetrics><Cors /><DeleteRetentionPolicy><Enabled>false</Enabled></DeleteRetentionPolicy><StaticWebsite><Enabled>true</Enabled><ErrorDocument404Path>error/404.html</ErrorDocument404Path><DefaultIndexDocumentPath>index.html</DefaultIndexDocumentPath></StaticWebsite><DefaultServiceVersion>2018-03-28</DefaultServiceVersion></StorageServiceProperties>",
"Date" : "Thu, 16 Jul 2020 21:21:29 GMT",
"x-ms-client-request-id" : "2408daa9-7769-4e53-8d73-480700f09b0f",
"Content-Type" : "application/xml"
},
"Exception" : null
}, {
"Method" : "PUT",
"Uri" : "https://REDACTED.blob.core.windows.net?restype=service&comp=properties",
"Headers" : {
"x-ms-version" : "2019-12-12",
"User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.2 (11.0.7; Windows 10; 10.0)",
"x-ms-client-request-id" : "13ed5fe5-53a8-4cff-8eaa-afac0bbaf0aa",
"Content-Type" : "application/xml; charset=utf-8"
},
"Response" : {
"x-ms-version" : "2019-12-12",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "202",
"x-ms-request-id" : "c6b6e441-e01e-0026-6bb7-5bd99a000000",
"Date" : "Thu, 16 Jul 2020 21:21:30 GMT",
"x-ms-client-request-id" : "13ed5fe5-53a8-4cff-8eaa-afac0bbaf0aa"
},
"Exception" : null
}, {
"Method" : "GET",
"Uri" : "https://REDACTED.blob.core.windows.net?prefix=jtcsetpropsstaticwebsite&comp=list",
"Headers" : {
"x-ms-version" : "2019-12-12",
"User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.2 (11.0.7; Windows 10; 10.0)",
"x-ms-client-request-id" : "0ac05704-d967-4655-b38a-e1a7afd8b863"
},
"Response" : {
"Transfer-Encoding" : "chunked",
"x-ms-version" : "2019-12-12",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
"retry-after" : "0",
"StatusCode" : "200",
"x-ms-request-id" : "df03d5c0-801e-0030-29b7-5b2f4d000000",
"Body" : "<?xml version=\"1.0\" encoding=\"utf-8\"?><EnumerationResults ServiceEndpoint=\"https://seanmccprodca.blob.core.windows.net/\"><Prefix>jtcsetpropsstaticwebsite</Prefix><Containers><Container><Name>jtcsetpropsstaticwebsite06467780c979b3ddde4c08</Name><Properties><Last-Modified>Thu, 16 Jul 2020 21:21:27 GMT</Last-Modified><Etag>\"0x8D829CE333287C4\"</Etag><LeaseStatus>unlocked</LeaseStatus><LeaseState>available</LeaseState><DefaultEncryptionScope>$account-encryption-key</DefaultEncryptionScope><DenyEncryptionScopeOverride>false</DenyEncryptionScopeOverride><HasImmutabilityPolicy>false</HasImmutabilityPolicy><HasLegalHold>false</HasLegalHold></Properties></Container></Containers><NextMarker /></EnumerationResults>",
"Date" : "Thu, 16 Jul 2020 21:21:30 GMT",
"x-ms-client-request-id" : "0ac05704-d967-4655-b38a-e1a7afd8b863",
"Content-Type" : "application/xml"
},
"Exception" : null
}, {
"Method" : "DELETE",
"Uri" : "https://REDACTED.blob.core.windows.net/jtcsetpropsstaticwebsite06467780c979b3ddde4c08?restype=container",
"Headers" : {
"x-ms-version" : "2019-12-12",
"User-Agent" : "azsdk-java-azure-storage-blob/12.8.0-beta.2 (11.0.7; Windows 10; 10.0)",
"x-ms-client-request-id" : "6adf86fc-027e-4ddb-95dc-80d2006a978f"
},
"Response" : {
"x-ms-version" : "2019-12-12",
"Server" : "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0",
"retry-after" : "0",
"Content-Length" : "0",
"StatusCode" : "202",
"x-ms-request-id" : "61ba550b-201e-0029-11b7-5baff6000000",
"Date" : "Thu, 16 Jul 2020 21:21:30 GMT",
"x-ms-client-request-id" : "6adf86fc-027e-4ddb-95dc-80d2006a978f"
},
"Exception" : null
} ],
"variables" : [ "jtcsetpropsstaticwebsite06467780c979b3ddde4c08" ]
}

0 comments on commit 26f1b12

Please sign in to comment.