Beispiel #1
0
            public ICloudBlob GetBlobReferenceFromServer(MemoryBlobStore store, FakeStorageBlobContainer parent, string blobName)
            {
                if (!_items.ContainsKey(blobName))
                {
                    throw StorageExceptionFactory.Create(404);
                }

                Blob blob = _items[blobName];

                if (blob._hook != null)
                {
                    return(blob._hook);
                }

                FakeStorageBlobProperties properties = new FakeStorageBlobProperties()
                {
                    ETag         = blob.ETag,
                    LastModified = blob.LastModified,
                };

                switch (blob.BlobType)
                {
                case BlobType.BlockBlob:
                    return(new FakeStorageBlockBlob(blobName, parent, properties));

                case BlobType.PageBlob:
                    return(new FakeStoragePageBlob(blobName, parent, properties));

                case BlobType.AppendBlob:
                    return(new FakeStorageAppendBlob(blobName, parent, properties));

                default:
                    throw new InvalidOperationException(string.Format("Type '{0}' is not supported.", blob.BlobType));
                }
            }
Beispiel #2
0
        public ICloudBlob GetBlobReferenceFromServer(FakeStorageBlobContainer parent, string containerName, string blobName)
        {
            if (!_items.ContainsKey(containerName))
            {
                throw StorageExceptionFactory.Create(404);
            }

            return(_items[containerName].GetBlobReferenceFromServer(this, parent, blobName));
        }
Beispiel #3
0
        public BlobAttributes FetchAttributes(string containerName, string blobName)
        {
            if (!_items.ContainsKey(containerName))
            {
                throw StorageExceptionFactory.Create(404);
            }

            return(_items[containerName].FetchAttributes(blobName));
        }
Beispiel #4
0
            public void ReleaseLease(string blobName, string leaseId)
            {
                if (!_items.ContainsKey(blobName))
                {
                    throw StorageExceptionFactory.Create(404, "BlobNotFound");
                }

                _items[blobName].ReleaseLease(leaseId);
            }
Beispiel #5
0
            public Stream OpenRead(string blobName)
            {
                if (!_items.ContainsKey(blobName))
                {
                    throw StorageExceptionFactory.Create(404, "BlobNotFound");
                }

                return(new MemoryStream(_items[blobName].Contents, writable: false));
            }
Beispiel #6
0
        public Stream OpenRead(string containerName, string blobName)
        {
            if (!_items.ContainsKey(containerName))
            {
                throw StorageExceptionFactory.Create(404);
            }

            return(_items[containerName].OpenRead(blobName));
        }
        public void AddMessage(string queueName, CloudQueueMessage message)
        {
            if (!_items.ContainsKey(queueName))
            {
                throw StorageExceptionFactory.Create(404, "QueueNotFound");
            }

            _items[queueName].AddMessage(message);
        }
        public IList <TableResult> ExecuteBatch(string tableName, TableBatchOperation batch)
        {
            if (!_items.ContainsKey(tableName))
            {
                throw StorageExceptionFactory.Create(404, "TableNotFound");
            }

            return(_items[tableName].ExecuteBatch(batch));
        }
Beispiel #9
0
        public CloudBlobStream OpenWriteBlock(string containerName, string blobName,
                                              IDictionary <string, string> metadata)
        {
            if (!_items.ContainsKey(containerName))
            {
                throw StorageExceptionFactory.Create(404, "ContainerNotFound");
            }

            return(_items[containerName].OpenWriteBlock(blobName, metadata));
        }