public FakeStorageBlobContainer(MemoryBlobStore store, string containerName, IStorageBlobClient parent)
 {
     _store = store;
     _containerName = containerName;
     _parent = parent;
     _uri = new Uri("http://localhost/" + containerName);
 }
Exemple #2
0
            public IEnumerable <IStorageBlob> ListBlobs(MemoryBlobStore store, IStorageBlobContainer parent,
                                                        BlobListingDetails blobListingDetails)
            {
                if (blobListingDetails != BlobListingDetails.None && blobListingDetails != BlobListingDetails.Metadata)
                {
                    throw new NotImplementedException();
                }
                List <IStorageBlob> results = new List <IStorageBlob>();

                foreach (KeyValuePair <string, Blob> item in _items)
                {
                    string       blobName = item.Key;
                    IStorageBlob blob     = new FakeStorageBlockBlob(store, blobName, parent);

                    if ((blobListingDetails | BlobListingDetails.Metadata) == BlobListingDetails.Metadata)
                    {
                        Blob storeBlob = item.Value;
                        IReadOnlyDictionary <string, string> storeMetadata = storeBlob.Metadata;

                        foreach (KeyValuePair <string, string> pair in storeMetadata)
                        {
                            blob.Metadata.Add(pair.Key, pair.Value);
                        }
                    }

                    results.Add(blob);
                }

                return(results);
            }
Exemple #3
0
 public FakeStorageBlobContainer(MemoryBlobStore store, string containerName, IStorageBlobClient parent)
 {
     _store         = store;
     _containerName = containerName;
     _parent        = parent;
     _uri           = new Uri("http://localhost/" + containerName);
 }
 public FakeStoragePageBlob(MemoryBlobStore store, string blobName, IStorageBlobContainer parent)
 {
     _store         = store;
     _blobName      = blobName;
     _parent        = parent;
     _containerName = parent.Name;
     _metadata      = new Dictionary <string, string>();
     _sdkObject     = new CloudPageBlob(new Uri("http://localhost/" + _containerName + "/" + blobName));
 }
 public FakeStoragePageBlob(MemoryBlobStore store, string blobName, IStorageBlobContainer parent)
 {
     _store = store;
     _blobName = blobName;
     _parent = parent;
     _containerName = parent.Name;
     _metadata = new Dictionary<string, string>();
     _sdkObject = new CloudPageBlob(new Uri("http://localhost/" + _containerName + "/" + blobName));
 }
 public FakeStorageBlockBlob(MemoryBlobStore store, string blobName, IStorageBlobContainer parent, FakeStorageBlobProperties properties = null)
 {
     _store         = store;
     _blobName      = blobName;
     _parent        = parent;
     _containerName = parent.Name;
     _metadata      = new Dictionary <string, string>();
     if (properties != null)
     {
         _properties = properties;
     }
     else
     {
         _properties = new FakeStorageBlobProperties();
     }
     _sdkObject = new CloudBlockBlob(new Uri("http://localhost/" + _containerName + "/" + blobName));
 }
 public FakeStorageBlockBlob(MemoryBlobStore store, string blobName, IStorageBlobContainer parent, FakeStorageBlobProperties properties = null)
 {
     _store = store;
     _blobName = blobName;
     _parent = parent;
     _containerName = parent.Name;
     _metadata = new Dictionary<string, string>();
     if (properties != null )
     {
         _properties = properties;
     }
     else
     {
         _properties = new FakeStorageBlobProperties();
     }
     _sdkObject = new CloudBlockBlob(new Uri("http://localhost/" + _containerName + "/" + blobName));
 }
Exemple #8
0
            public IStorageBlob GetBlobReferenceFromServer(MemoryBlobStore store, IStorageBlobContainer parent, string blobName)
            {
                if (!_items.ContainsKey(blobName))
                {
                    throw StorageExceptionFactory.Create(404);
                }

                Blob blob = _items[blobName];

                if (blob.BlobType == StorageBlobType.BlockBlob)
                {
                    return(new FakeStorageBlockBlob(store, blobName, parent));
                }
                else
                {
                    return(new FakeStoragePageBlob(store, blobName, parent));
                }
            }
Exemple #9
0
            public IEnumerable <IStorageBlob> ListBlobs(MemoryBlobStore store, IStorageBlobContainer parent,
                                                        BlobListingDetails blobListingDetails)
            {
                if (blobListingDetails != BlobListingDetails.None && blobListingDetails != BlobListingDetails.Metadata)
                {
                    throw new NotImplementedException();
                }
                List <IStorageBlob> results = new List <IStorageBlob>();

                foreach (KeyValuePair <string, Blob> item in _items)
                {
                    string blobName = item.Key;

                    // Etag  and LastModifiedTime is always passed in listBlobs
                    FakeStorageBlobProperties properties = new FakeStorageBlobProperties()
                    {
                        ETag         = item.Value.ETag,
                        LastModified = item.Value.LastModified,
                    };

                    IStorageBlob blob = new FakeStorageBlockBlob(store, blobName, parent, properties);
                    if ((blobListingDetails | BlobListingDetails.Metadata) == BlobListingDetails.Metadata)
                    {
                        Blob storeBlob = item.Value;
                        IReadOnlyDictionary <string, string> storeMetadata = storeBlob.Metadata;

                        foreach (KeyValuePair <string, string> pair in storeMetadata)
                        {
                            blob.Metadata.Add(pair.Key, pair.Value);
                        }
                    }

                    results.Add(blob);
                }

                return(results);
            }
Exemple #10
0
            public IStorageBlob GetBlobReferenceFromServer(MemoryBlobStore store, IStorageBlobContainer parent, string blobName)
            {
                if (!_items.ContainsKey(blobName))
                {
                    throw StorageExceptionFactory.Create(404);
                }

                Blob blob = _items[blobName];

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

                case StorageBlobType.PageBlob:
                    return(new FakeStoragePageBlob(store, blobName, parent));

                case StorageBlobType.AppendBlob:
                    return(new FakeStorageAppendBlob(store, blobName, parent));

                default:
                    throw new InvalidOperationException(string.Format("Type '{0}' is not supported.", blob.BlobType));
                }
            }
            public IEnumerable<IStorageBlob> ListBlobs(MemoryBlobStore store, IStorageBlobContainer parent,
                BlobListingDetails blobListingDetails)
            {
                if (blobListingDetails != BlobListingDetails.None && blobListingDetails != BlobListingDetails.Metadata)
                {
                    throw new NotImplementedException();
                }
                List<IStorageBlob> results = new List<IStorageBlob>();

                foreach (KeyValuePair<string, Blob> item in _items)
                {
                    string blobName = item.Key;

                    // Etag  and LastModifiedTime is always passed in listBlobs
                    FakeStorageBlobProperties properties = new FakeStorageBlobProperties()
                    {
                        ETag = item.Value.ETag,
                        LastModified = item.Value.LastModified,
                    };

                    IStorageBlob blob = new FakeStorageBlockBlob(store, blobName, parent, properties);
                    if ((blobListingDetails | BlobListingDetails.Metadata) == BlobListingDetails.Metadata)
                    {
                        Blob storeBlob = item.Value;
                        IReadOnlyDictionary<string, string> storeMetadata = storeBlob.Metadata;

                        foreach (KeyValuePair<string, string> pair in storeMetadata)
                        {
                            blob.Metadata.Add(pair.Key, pair.Value);
                        }
                    }

                    results.Add(blob);
                }

                return results;
            }
            public IStorageBlob GetBlobReferenceFromServer(MemoryBlobStore store, IStorageBlobContainer parent, string blobName)
            {
                if (!_items.ContainsKey(blobName))
                {
                    throw StorageExceptionFactory.Create(404);
                }

                Blob blob = _items[blobName];

                if (blob.BlobType == StorageBlobType.BlockBlob)
                {
                    return new FakeStorageBlockBlob(store, blobName, parent);
                }
                else
                {
                    return new FakeStoragePageBlob(store, blobName, parent);
                }
            }
            public IEnumerable<IStorageBlob> ListBlobs(MemoryBlobStore store, IStorageBlobContainer parent,
                BlobListingDetails blobListingDetails)
            {
                if (blobListingDetails != BlobListingDetails.None && blobListingDetails != BlobListingDetails.Metadata)
                {
                    throw new NotImplementedException();
                }
                List<IStorageBlob> results = new List<IStorageBlob>();

                foreach (KeyValuePair<string, Blob> item in _items)
                {
                    string blobName = item.Key;
                    IStorageBlob blob = new FakeStorageBlockBlob(store, blobName, parent);

                    if ((blobListingDetails | BlobListingDetails.Metadata) == BlobListingDetails.Metadata)
                    {
                        Blob storeBlob = item.Value;
                        IReadOnlyDictionary<string, string> storeMetadata = storeBlob.Metadata;

                        foreach (KeyValuePair<string, string> pair in storeMetadata)
                        {
                            blob.Metadata.Add(pair.Key, pair.Value);
                        }
                    }

                    results.Add(blob);
                }

                return results;
            }
 public FakeStorageBlobDirectory(MemoryBlobStore store, string relativeAddress, IStorageBlobContainer parent)
 {
     _store = store;
     _relativeAddress = relativeAddress;
     _parent = parent;
 }
 public FakeStorageBlobClient(MemoryBlobStore store, StorageCredentials credentials)
 {
     _store = store;
     _credentials = credentials;
 }
 public FakeStorageBlobClient(MemoryBlobStore store, StorageCredentials credentials)
 {
     _store       = store;
     _credentials = credentials;
 }
Exemple #17
0
 public FakeStorageBlobDirectory(MemoryBlobStore store, string relativeAddress, IStorageBlobContainer parent)
 {
     _store           = store;
     _relativeAddress = relativeAddress;
     _parent          = parent;
 }