コード例 #1
0
 public static function getSetBlobPropertiesOptions()
 {
     $ret = array();
     $options = new SetBlobPropertiesOptions();
     array_push($ret, $options);
     $options = new SetBlobPropertiesOptions();
     $options->setTimeout(10);
     array_push($ret, $options);
     $options = new SetBlobPropertiesOptions();
     $options->setTimeout(-10);
     array_push($ret, $options);
     // Get Blob Properties only supports the temporal access conditions.
     foreach (self::getTemporalAccessConditions() as $ac) {
         $options = new SetBlobPropertiesOptions();
         $options->setAccessCondition($ac);
         array_push($ret, $options);
     }
     $options = new SetBlobPropertiesOptions();
     $options->setBlobCacheControl('setBlobCacheControl');
     array_push($ret, $options);
     $options = new SetBlobPropertiesOptions();
     $options->setBlobContentEncoding('setBlobContentEncoding');
     array_push($ret, $options);
     $options = new SetBlobPropertiesOptions();
     $options->setBlobContentLanguage('setBlobContentLanguage');
     array_push($ret, $options);
     // Note: This is not allowed on block blobs
     $options = new SetBlobPropertiesOptions();
     $options->setBlobContentLength(2048);
     array_push($ret, $options);
     $options = new SetBlobPropertiesOptions();
     $options->setBlobContentMD5('d41d8cd98f00b204e9800998ecf8427e');
     array_push($ret, $options);
     $options = new SetBlobPropertiesOptions();
     $options->setBlobContentType('setContentType');
     array_push($ret, $options);
     // TODO: Handle Lease ID
     //        $options = new SetBlobPropertiesOptions();
     //        $options->setLeaseId('setLeaseId');
     //        array_push($ret, $options);
     // Note: This is not allowed on block blobs
     $options = new SetBlobPropertiesOptions();
     $options->setSequenceNumber(0);
     $options->setSequenceNumberAction('update');
     array_push($ret, $options);
     return $ret;
 }
コード例 #2
0
 /**
  * @covers MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesOptions::setBlobContentMD5
  * @covers MicrosoftAzure\Storage\Blob\Models\SetBlobPropertiesOptions::getBlobContentMD5
  */
 public function testSetBlobContentMD5()
 {
     // Setup
     $expected = '0x8CAFB82EFF70C46';
     $options = new SetBlobPropertiesOptions();
     $options->setBlobContentMD5($expected);
     // Test
     $options->setBlobContentMD5($expected);
     // Assert
     $this->assertEquals($expected, $options->getBlobContentMD5());
 }
コード例 #3
0
 /**
  * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::createPageBlob
  * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::getBlobProperties
  * @covers MicrosoftAzure\Storage\Blob\BlobRestProxy::setBlobProperties
  */
 public function testSetBlobPropertiesWorks()
 {
     // Act
     $container = self::$_test_container_for_blobs;
     $blob = 'test10';
     $this->restProxy->createPageBlob($container, $blob, 4096);
     $opts = new SetBlobPropertiesOptions();
     $opts->setBlobCacheControl('test');
     $opts->setBlobContentEncoding('UTF-8');
     $opts->setBlobContentLanguage('en-us');
     $opts->setBlobContentLength(512);
     $opts->setBlobContentMD5(null);
     $opts->setBlobContentType('text/plain');
     $opts->setSequenceNumberAction('increment');
     $result = $this->restProxy->setBlobProperties($container, $blob, $opts);
     $getResult = $this->restProxy->getBlobProperties($container, $blob);
     // Assert
     $this->assertNotNull($result, '$result');
     $this->assertNotNull($result->getETag(), '$result->getETag()');
     $this->assertNotNull($result->getLastModified(), '$result->getLastModified()');
     $this->assertNotNull($result->getSequenceNumber(), '$result->getSequenceNumber()');
     $this->assertEquals(1, $result->getSequenceNumber(), '$result->getSequenceNumber()');
     $this->assertNotNull($getResult, '$getResult');
     $this->assertNotNull($getResult->getMetadata(), '$getResult->getMetadata()');
     $this->assertEquals(0, count($getResult->getMetadata()), 'count($getResult->getMetadata())');
     $props = $getResult->getProperties();
     $this->assertNotNull($props, '$props');
     $this->assertEquals('test', $props->getCacheControl(), '$props->getCacheControl()');
     $this->assertEquals('UTF-8', $props->getContentEncoding(), '$props->getContentEncoding()');
     $this->assertEquals('en-us', $props->getContentLanguage(), '$props->getContentLanguage()');
     $this->assertEquals('text/plain', $props->getContentType(), '$props->getContentType()');
     $this->assertEquals(512, $props->getContentLength(), '$props->getContentLength()');
     $this->assertNull($props->getContentMD5(), '$props->getContentMD5()');
     $this->assertNotNull($props->getLastModified(), '$props->getLastModified()');
     $this->assertEquals('PageBlob', $props->getBlobType(), '$props->getBlobType()');
     $this->assertEquals('unlocked', $props->getLeaseStatus(), '$props->getLeaseStatus()');
     $this->assertEquals(1, $props->getSequenceNumber(), '$props->getSequenceNumber()');
 }