Example #1
0
        public StoreModule(IBrightstarService brightstarService, AbstractStorePermissionsProvider storePermissionsProvider)
        {
            this.RequiresBrightstarStorePermission(storePermissionsProvider, get:StorePermissions.Read, delete:StorePermissions.Admin);

            Get["/{storeName}"] = parameters =>
            {
                var storeName = parameters["storeName"];
                ViewBag.Title = storeName;

                if (!brightstarService.DoesStoreExist(storeName)) return HttpStatusCode.NotFound;
                if (Request.Method.ToUpperInvariant() == "HEAD")
                {
                    IEnumerable < ICommitPointInfo > commitPoints = brightstarService.GetCommitPoints(storeName, 0, 1);
                    var commit = commitPoints.First();
                    return
                        Negotiate.WithHeader("Last-Modified", commit.CommitTime.ToUniversalTime().ToString("r"))
                            .WithStatusCode(HttpStatusCode.OK)
                            .WithModel(new StoreResponseModel(parameters["storeName"]));
                }
                return new StoreResponseModel(parameters["storeName"]);
            };

            Delete["/{storeName}"] = parameters =>
                {
                    var storeName = parameters["storeName"];
                    ViewBag.Title = "Deleted - " + storeName;
                    if (brightstarService.DoesStoreExist(storeName))
                    {
                        brightstarService.DeleteStore(storeName);
                    }
                    return Negotiate.WithMediaRangeModel(new MediaRange("text/html"), 
                                                         new StoreDeletedModel {StoreName = storeName});
                };
        }
Example #2
0
        public void TestDeleteStore()
        {
            var storeName = Guid.NewGuid().ToString();

            _client.CreateStore(storeName);
            var stores = _client.ListStores();

            Assert.IsNotNull(stores);
            Assert.IsTrue(stores.Contains(storeName), "Did not find newly created store in call to ListStores");

            _client.DeleteStore(storeName);
            // Delete processes asynchronously, so there is a delay between
            stores = _client.ListStores();
            Assert.IsNotNull(stores);
            Assert.IsFalse(stores.Contains(storeName), "Expected to not find deleted store name in call to ListStores");
        }
Example #3
0
        public StoreModule(IBrightstarService brightstarService, AbstractStorePermissionsProvider storePermissionsProvider)
        {
            this.RequiresBrightstarStorePermission(storePermissionsProvider, get: StorePermissions.Read, delete: StorePermissions.Admin);

            Get["/{storeName}"] = parameters =>
            {
                var storeName = parameters["storeName"];
                ViewBag.Title = storeName;

                if (!brightstarService.DoesStoreExist(storeName))
                {
                    return(HttpStatusCode.NotFound);
                }
                if (Request.Method.ToUpperInvariant() == "HEAD")
                {
                    IEnumerable <ICommitPointInfo> commitPoints = brightstarService.GetCommitPoints(storeName, 0, 1);
                    var commit = commitPoints.First();
                    return
                        (Negotiate.WithHeader("Last-Modified", commit.CommitTime.ToUniversalTime().ToString("r"))
                         .WithStatusCode(HttpStatusCode.OK)
                         .WithModel(new StoreResponseModel(parameters["storeName"])));
                }
                return(new StoreResponseModel(parameters["storeName"]));
            };

            Delete["/{storeName}"] = parameters =>
            {
                var storeName = parameters["storeName"];
                ViewBag.Title = "Deleted - " + storeName;
                if (brightstarService.DoesStoreExist(storeName))
                {
                    brightstarService.DeleteStore(storeName);
                }
                return(Negotiate.WithMediaRangeModel(new MediaRange("text/html"),
                                                     new StoreDeletedModel {
                    StoreName = storeName
                }));
            };
        }
 public void DeleteStore()
 {
     _service.DeleteStore(_storeName);
     //_storeManager.DeleteStore(_storeLocation);
 }
Example #5
0
 /// <summary>
 /// Delete the named store
 /// </summary>
 /// <param name="storeName">The name of the store to be deleted</param>
 public void DeleteStore(string storeName)
 {
     _client.DeleteStore(storeName);
 }