Exemple #1
0
        public void SetUp()
        {
            // Need to do something about this.  Little ridiculous
            FubuTransport.SetupForInMemoryTesting();
            TestMessageRecorder.Clear();
            MessageHistory.ClearAll();
            InMemoryQueueManager.ClearAll();

            runtime = FubuTransport.For <DelayedRegistry>().StructureMap(new Container())
                      .Bootstrap();

            theServiceBus = runtime.Factory.Get <IServiceBus>();

            theClock = runtime.Factory.Get <ISystemTime>().As <SettableClock>();

            message1 = new OneMessage();
            message2 = new OneMessage();
            message3 = new OneMessage();
            message4 = new OneMessage();

            theServiceBus.DelaySend(message1, theClock.UtcNow().AddHours(1));
            theServiceBus.DelaySend(message2, theClock.UtcNow().AddHours(1));
            theServiceBus.DelaySend(message3, theClock.UtcNow().AddHours(2));
            theServiceBus.DelaySend(message4, theClock.UtcNow().AddHours(2));
        }
 public override void SetUp(ITestContext context)
 {
     RunningNode.Subscriptions.ClearAll();
     MessageHistory.ClearAll();
     InMemoryQueueManager.ClearAll();
     FubuTransport.ApplyMessageHistoryWatching = true;
 }
Exemple #3
0
        public void the_scheduled_job_visualization_can_be_shown()
        {
            using (var server = EmbeddedFubuMvcServer.For <DiagnosticApplication>(appPath))
            {
                server.Endpoints.Get <ScheduledJobsFubuDiagnostics>(x => x.get_scheduled_jobs())
                .StatusCode.ShouldEqual(HttpStatusCode.OK);
            }

            InMemoryQueueManager.ClearAll();
        }
Exemple #4
0
        public void the_subscriptions_visualization_can_be_shown()
        {
            using (var server = EmbeddedFubuMvcServer.For <DiagnosticApplication>(appPath))
            {
                var httpResponse = server.Endpoints.Get <SubscriptionsFubuDiagnostics>(x => x.get_subscriptions());
                if (httpResponse.StatusCode != HttpStatusCode.OK)
                {
                    Assert.Fail(httpResponse.ReadAsText());
                }
            }

            InMemoryQueueManager.ClearAll();
        }
Exemple #5
0
        public void moves_to_delayed_queue()
        {
            InMemoryQueueManager.ClearAll();

            var envelope = new EnvelopeToken();
            var callback = new InMemoryCallback(null, envelope);

            callback.MoveToDelayedUntil(DateTime.Now);

            var delayed = InMemoryQueueManager.DelayedEnvelopes().Single();

            delayed.CorrelationId.ShouldEqual(envelope.CorrelationId);
            delayed.ExecutionTime.ShouldNotBeNull();
        }
Exemple #6
0
        public void SetUp()
        {
            InMemoryQueueManager.ClearAll();
            FubuTransport.Reset();

            theSettings = new ConfiguredSettings
            {
                Upstream = "memory://foo".ToUri(),
                Outbound = "memory://bar".ToUri()
            };

            theContainer = new Container(x => {
                x.For <ConfiguredSettings>().Use(theSettings);
            });

            theRuntime = FubuTransport.For <ConfiguredFubuRegistry>().StructureMap(theContainer)
                         .Bootstrap();

            theGraph = theContainer.GetInstance <ChannelGraph>();
        }
 public override void SetUp()
 {
     RunningNode.Subscriptions.ClearAll();
     MessageHistory.ClearAll();
     InMemoryQueueManager.ClearAll();
 }
 public void Teardown()
 {
     InMemoryQueueManager.ClearAll();
 }
 public void SetUp()
 {
     InMemoryQueueManager.ClearAll();
 }
Exemple #10
0
        internal void Execute(IScenarioWriter writer)
        {
            TraceListener[] listeners = new TraceListener[Debug.Listeners.Count];

            Debug.Listeners.CopyTo(listeners, 0);
            Debug.Listeners.Clear();

            FubuTransport.SetupForInMemoryTesting();

            InMemoryQueueManager.ClearAll();
            TestMessageRecorder.Clear();
            MessageHistory.ClearAll();

            _configurations.Each(x => x.SpinUp());

            writer.WriteTitle(Title);

            using (writer.Indent())
            {
                writeArrangement(writer);

                writer.WriteLine("Actions");

                using (writer.Indent())
                {
                    _steps.Each(x => {
                        x.PreviewAct(writer);
                        try
                        {
                            x.Act(writer);
                        }
                        catch (Exception e)
                        {
                            writer.Exception(e);
                        }
                    });
                }

                var success = Wait.Until(() => {
                    return(!MessageHistory.Outstanding().Any());
                }, timeoutInMilliseconds: 60000);

                Debug.Listeners.AddRange(listeners);

                if (success)
                {
                    writer.WriteLine("Messages are all accounted for");
                }
                else
                {
                    writer.WriteLine("Messages are outstanding:");
                    MessageHistory.Outstanding().Each(x => Debug.WriteLine(x));
                }

                writer.BlankLine();

                _configurations.Each(x => x.SafeDispose());

                writer.WriteLine("Assertions");

                using (writer.Indent())
                {
                    _steps.Each(x => {
                        x.PreviewAssert(writer);
                        x.Assert(writer);
                    });
                }


                writer.BlankLine();


                if (TestMessageRecorder.AllProcessed.Any())
                {
                    writer.WriteLine("Messages Received");
                    TestMessageRecorder.AllProcessed.Each(x => {
                        writer.Bullet("{0} received by {1}", x.Message.GetType().Name, x.Message.Source);
                    });
                }
                else
                {
                    writer.WriteLine("No messages were received!");
                }

                var unexpectedMessages = TestMessageRecorder.AllProcessed.Where(x => !_steps.Any(step => step.MatchesSentMessage(x.Message)))
                                         .ToArray();

                if (unexpectedMessages.Any())
                {
                    writer.BlankLine();
                    writer.WriteLine("Found unexpected messages");
                    unexpectedMessages.Each(x => writer.Failure(x.ToString()));
                }
            }
        }
 public void TearDown()
 {
     InMemoryQueueManager.ClearAll();
     FubuTransport.Reset();
     theRuntime.Dispose();
 }