public async Task CanInsertAndGetBackMetadat()
        {
            var store      = new AzureKeyValueStore(ConnectionString, ContainerName);
            var simpleBlob = new SimpleBlob()
            {
                Body     = new MemoryStream(new byte[4096]),
                Id       = Guid.NewGuid().ToString("N"),
                Metadata = new Dictionary <string, string>()
                {
                    { "a", "b" },
                    { "c", "d" },
                    { "Content-Type", "image/png" }
                }
            };
            await store.InsertAsync(simpleBlob);

            var metadata = await store.GetMetadataAsync(simpleBlob.Id);

            var blob2 = await store.GetAsync(simpleBlob.Id);

            var blockBlob = (CloudBlockBlob)blob2.UnderlyingBlob;

            Assert.Equal("b", metadata["a"]);
            Assert.Equal("d", metadata["c"]);
            Assert.Equal("image/png", blockBlob.Properties.ContentType);
        }
示例#2
0
        public WorkerRole()
        {
            _pulsers = Pulsers.FromAssembly(Assembly.GetAssembly(typeof(ImportFileProcessed)))
                       .ToList();


            var container = new WindsorContainer();

            _configurationValueProvider = new AzureConfigurationValueProvider();
            SetupDi(container, _configurationValueProvider, _pulsers.ToArray());
            _pulserPublisher = container.Resolve <PulserPublisher>();
            _orchestrator    = container.Resolve <Orchestrator>();

            // insert the list here
            var keyValueStore = container.Resolve <IDynamoStore>();
            var blob          = new SimpleBlob()
            {
                Body = Assembly.GetExecutingAssembly()
                       .GetManifestResourceStream("BeeHive.Sample.FileImport.Worker.Data.SampleData.txt"),
                Id           = "FileDrop/ImportFiles/SampleData.txt",
                LastModified = DateTimeOffset.Now
            };

            keyValueStore.UpsertAsync(blob);

            // add one topic that will not be created automagically by orchestrator
            // because no actor registered against it
            var q = container.Resolve <IEventQueueOperator>();

            q.CreateQueueAsync(QueueName.FromSimpleQueueName("NewIndexUpserted")).Wait();
        }
        public async Task CanInsertAndExistsReturnsTrue()
        {
            var store      = new AzureKeyValueStore(ConnectionString, ContainerName);
            var simpleBlob = new SimpleBlob()
            {
                Body = new MemoryStream(new byte[4096]),
                Id   = Guid.NewGuid().ToString("N")
            };
            await store.InsertAsync(simpleBlob);

            Assert.True(await store.ExistsAsync(simpleBlob.Id));
        }
示例#4
0
        public async Task <IBlob> GetAsync(string id)
        {
            var blobReference = _container.GetBlockBlobReference(id);
            await blobReference.FetchAttributesAsync();

            var blob = new SimpleBlob()
            {
                Body           = blobReference.ToStream(),
                Metadata       = new Dictionary <string, string>(blobReference.Metadata),
                ETag           = blobReference.Properties.ETag,
                LastModified   = blobReference.Properties.LastModified,
                Id             = id,
                UnderlyingBlob = blobReference
            };

            return(blob);
        }
        public void CanInsertAndGetBackMetadat()
        {
            var store      = new AzureKeyValueStore(ConnectionString, ContainerName);
            var simpleBlob = new SimpleBlob()
            {
                Body     = new MemoryStream(new byte[4096]),
                Id       = Guid.NewGuid().ToString("N"),
                Metadata = new Dictionary <string, string>()
                {
                    { "a", "b" },
                    { "c", "d" }
                }
            };

            store.InsertAsync(simpleBlob).Wait();
            var metadata = store.GetMetadataAsync(simpleBlob.Id).Result;

            Assert.Equal("b", metadata["a"]);
            Assert.Equal("d", metadata["c"]);
        }
示例#6
0
        public WorkerRole()
        {
            _pulsers = Pulsers.FromAssembly(Assembly.GetAssembly(typeof(NewsFeedPulsed)))
                       .ToList();


            var container = new WindsorContainer();

            _configurationValueProvider = new AzureConfigurationValueProvider();
            SetupDi(container, _configurationValueProvider, _pulsers.ToArray());
            _pulserPublisher = container.Resolve <PulserPublisher>();
            _orchestrator    = container.Resolve <Orchestrator>();

            // insert the list here
            var keyValueStore = container.Resolve <IKeyValueStore>();
            var blob          = new SimpleBlob()
            {
                Body         = new MemoryStream(Encoding.UTF8.GetBytes("http://feeds.bbci.co.uk/news/rss.xml")),
                Id           = "newsFeeds.txt",
                LastModofied = DateTimeOffset.Now
            };

            keyValueStore.UpsertAsync(blob);
        }