Exemple #1
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",
                LastModofied = 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("NewIndexUpserted").Wait();



        }
 public void CanInsertAndExistsReturnsTrue()
 {
     var store = new AzureKeyValueStore(ConnectionString, ContainerName);
     var simpleBlob = new SimpleBlob()
     {
         Body = new MemoryStream(new byte[4096]),
         Id = Guid.NewGuid().ToString("N")
     };
     store.InsertAsync(simpleBlob).Wait();
     Assert.True(store.ExistsAsync(simpleBlob.Id).Result);
 }
        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"]);
        }
        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"},
                    {"Content-Type", "image/png"}
                }
            };
            store.InsertAsync(simpleBlob).Wait();
            var metadata = store.GetMetadataAsync(simpleBlob.Id).Result;
            var blob2 = store.GetAsync(simpleBlob.Id).Result;

            var blockBlob = (CloudBlockBlob) blob2.UnderlyingBlob;
            Assert.Equal("b", metadata["a"]);
            Assert.Equal("d", metadata["c"]);
            Assert.Equal("image/png", blockBlob.Properties.ContentType);
        }
Exemple #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);

        }