Exemple #1
0
        public void Queue_survives_service_restart()
        {
            var queue = StringUtil.CreateAlphaNumericKey(4);
            var doc   = new XDoc("foo").Elem("bar", "baz");

            // queue item
            var response = _plug.At("queue", queue).Post(doc, new Result <DreamMessage>()).Wait();

            response.AssertSuccess();

            // destroy and recreate service
            _queueService.WithPrivateKey().AtLocalHost.Delete(new Result <DreamMessage>()).Wait().AssertSuccess();
            var q = DreamTestHelper.CreateService(_hostInfo, "sid://mindtouch.com/2009/12/dream/queue", "queue", new XDoc("config").Elem("folder", Path.GetTempPath()));
            var p = q.WithInternalKey().AtLocalHost;

            // check size
            response = p.At("queue", queue, "size").Get(new Result <DreamMessage>()).Wait();
            response.AssertSuccess();
            Assert.AreEqual("1", response.ToDocument()["size"].AsText);

            // get item
            response = p.At("queue", queue).Get(new Result <DreamMessage>()).Wait();
            response.AssertSuccess();
            Assert.AreEqual(doc, response.ToDocument());
        }
Exemple #2
0
 public void Teardown()
 {
     _storage.WithPrivateKey().AtLocalHost.Delete();
 }