public MessageListViewModel(
            IEventAggregator eventAggregator,
            IWindowManagerEx windowManager,
            IServiceControl serviceControl,
            IQueueManagerAsync asyncQueueManager,
            ISearchBarViewModel searchBarViewModel,
            IErrorHeaderViewModel errorHeaderDisplay,
            IGeneralHeaderViewModel generalHeaderDisplay,
            IClipboard clipboard,
            IStatusBarManager statusBar)
        {
            _eventAggregator      = eventAggregator;
            _windowManager        = windowManager;
            _serviceControl       = serviceControl;
            _asyncQueueManager    = asyncQueueManager;
            _errorHeaderDisplay   = errorHeaderDisplay;
            _generalHeaderDisplay = generalHeaderDisplay;
            _clipboard            = clipboard;
            _statusBar            = statusBar;

            SearchBar = searchBarViewModel;

            Items.Add(SearchBar);
            Messages         = new BindableCollection <MessageInfo>();
            SelectedMessages = new BindableCollection <MessageInfo>();
            ContextMenuItems = new BindableCollection <ContextMenuModel>
            {
                new ContextMenuModel(this, "ReturnToSource", "Return To Source", Properties.Resources.MessageReturn),
                new ContextMenuModel(this, "RetryMessage", "Retry Message", Properties.Resources.MessageReturn),
                new ContextMenuModel(this, "CopyMessageId", "Copy Message Identifier"),
                new ContextMenuModel(this, "CopyHeaders", "Copy Headers")
            };
        }
Esempio n. 2
0
        public void TestInitialize()
        {
            queueManager      = Substitute.For <IQueueManagerAsync>();
            view              = Substitute.For <IExplorerView>();
            eventAggregator   = Substitute.For <IEventAggregator>();
            windowManagerEx   = Substitute.For <IWindowManagerEx>();
            networkOperations = Substitute.For <INetworkOperations>();
            explorer          = new QueueExplorerViewModel(queueManager, eventAggregator, windowManagerEx, networkOperations);

            queue    = new Queue("TestQueue");
            subQueue = new Queue("TestQueue.Subscriptions");

            IList <Queue> queues = new List <Queue> {
                queue, subQueue
            };

            queueManager.GetQueues(Arg.Any <string>()).Returns(Task.Run(() => queues));
            queueManager.GetQueues().Returns(Task.Run(() => queues));
            queueManager.GetMessageCount(Arg.Any <Queue>()).Returns(Task.Run(() => queues.Count));
            queueManager.IsMsmqInstalled(Arg.Any <string>()).Returns(Task.Run(() => true));

            AsyncHelper.Run(() => explorer.AttachView(view, null));
            AsyncHelper.Run(() => explorer.ConnectToQueue(Environment.MachineName));

            queueNode = explorer.MachineRoot.Children.OfType <QueueExplorerItem>().First();
        }
 public PerformanceHeaderViewModel(
     IEventAggregator eventAggregator,
     IContentDecoder <IList <HeaderInfo> > decoder,
     IQueueManagerAsync queueManager)
     : base(eventAggregator, decoder, queueManager)
 {
     DisplayName = "Performance";
 }
 public SagaHeaderViewModel(
     IEventAggregator eventAggregator,
     IContentDecoder<IList<HeaderInfo>> decoder,
     IQueueManagerAsync queueManager)
     : base(eventAggregator, decoder, queueManager)
 {
     DisplayName = "Saga";
 }
 public GatewayHeaderViewModel(
     IEventAggregator eventAggregator,
     IContentDecoder <IList <HeaderInfo> > decoder,
     IQueueManagerAsync queueManager)
     : base(eventAggregator, decoder, queueManager)
 {
     DisplayName = "Gateway";
 }
 public GeneralHeaderViewModel(
     IEventAggregator eventAggregator,
     IContentDecoder <IList <HeaderInfo> > decoder,
     IQueueManagerAsync queueManager)
     : base(eventAggregator, decoder, queueManager)
 {
     _decoder    = decoder;
     DisplayName = "General";
 }
Esempio n. 7
0
 public GeneralHeaderViewModel(
     IEventAggregator eventAggregator, 
     IContentDecoder<IList<HeaderInfo>> decoder, 
     IQueueManagerAsync queueManager, 
     IClipboard clipboard)
     : base(eventAggregator, decoder, queueManager, clipboard)
 {
     DisplayName = "General";
 }
 public void TestInitialize()
 {
     IList<string> machines = new List<string> { Environment.MachineName, "AnotherMachine" };
     QueueManager = Substitute.For<IQueueManagerAsync>();
     Explorer = Substitute.For<IQueueExplorerViewModel>();
     Network = Substitute.For<INetworkOperations>();
     Model = new Desktop.Shell.QueueCreationViewModel(QueueManager, Explorer, Network);
     Network.GetMachines().Returns(Task.FromResult(machines));
 }
Esempio n. 9
0
 public SagaHeaderViewModel(
     IEventAggregator eventAggregator,
     IContentDecoder <IList <HeaderInfo> > decoder,
     IQueueManagerAsync queueManager,
     IClipboard clipboard)
     : base(eventAggregator, decoder, queueManager, clipboard)
 {
     DisplayName = "Saga";
 }
Esempio n. 10
0
        public void should_not_throw_an_exception_when_system_queues_are_orphaned()
        {
            IList <Queue> unorderedQueueList = new List <Queue>(new[] { new Queue("myqueue.subscriptions") });

            queueManager = Substitute.For <IQueueManagerAsync>();
            queueManager.GetQueues().ReturnsForAnyArgs(Task.FromResult(unorderedQueueList));
            explorer = new QueueExplorerViewModel(queueManager, eventAggregator, windowManagerEx, networkOperations);

            Should.NotThrow(() => explorer.RefreshData());
        }
Esempio n. 11
0
 protected HeaderInfoViewModelBase(
     IEventAggregator eventAggregator,
     IContentDecoder <IList <HeaderInfo> > decoder,
     IQueueManagerAsync queueManager,
     IClipboard clipboard)
 {
     _decoder        = decoder;
     _clipboard      = clipboard;
     EventAggregator = eventAggregator;
     QueueManager    = queueManager;
     Items           = new BindableCollection <HeaderInfo>();
 }
Esempio n. 12
0
 protected HeaderInfoViewModelBase(
     IEventAggregator eventAggregator, 
     IContentDecoder<IList<HeaderInfo>> decoder, 
     IQueueManagerAsync queueManager,
     IClipboard clipboard)
 {
     _decoder = decoder;
     _clipboard = clipboard;
     EventAggregator = eventAggregator;
     QueueManager = queueManager;
     Items = new BindableCollection<HeaderInfo>();
 }
        public void TestInitialize()
        {
            IList <string> machines = new List <string> {
                Environment.MachineName, "AnotherMachine"
            };

            QueueManager = Substitute.For <IQueueManagerAsync>();
            Explorer     = Substitute.For <IQueueExplorerViewModel>();
            Network      = Substitute.For <INetworkOperations>();
            Model        = new Desktop.Shell.QueueCreationViewModel(QueueManager, Explorer, Network);
            Network.GetMachines().Returns(Task.FromResult(machines));
        }
 public QueueCreationViewModel(
     IQueueManagerAsync queueManager, 
     IQueueExplorerViewModel explorer,
     INetworkOperations networkOperations)
 {
     _queueManager = queueManager;
     _explorer = explorer;
     _networkOperations = networkOperations;
     Machines = new List<string>();
     DisplayName = "Queue";
     IsTransactional = true;
 }
        public void should_be_able_to_load_messages_from_the_queue()
        {
            manager = new AsyncQueueManager(new MSMQueueOperations(new DefaultMapper()));

            for (var i = 0; i < 500; i++)
            {
                manager.SendMessage(destinationQ, string.Format("Test message number {0}, this is a somewhat larger text message. this is a somewhat larger text message. this is a somewhat larger text message. this is a somewhat larger text message.", i));
            }

            var messages = AsyncHelper.Run(() => manager.GetMessages(destinationQ));
            messages.Count.ShouldBe(500);
        }
Esempio n. 16
0
 public QueueCreationViewModel(
     IQueueManagerAsync queueManager,
     IQueueExplorerViewModel explorer,
     INetworkOperations networkOperations)
 {
     _queueManager      = queueManager;
     _explorer          = explorer;
     _networkOperations = networkOperations;
     Machines           = new List <string>();
     DisplayName        = "Queue";
     IsTransactional    = true;
 }
 public QueueExplorerViewModel(
     IQueueManagerAsync queueManager,
     IEventAggregator eventAggregator,
     IWindowManagerEx windowManager,
     INetworkOperations networkOperations)
 {
     _queueManager = queueManager;
     _eventAggregator = eventAggregator;
     _windowManager = windowManager;
     _networkOperations = networkOperations;
     Items = new BindableCollection<ExplorerItem>();
     IsMSMQInstalled = true;
 }
Esempio n. 18
0
 public QueueExplorerViewModel(
     IQueueManagerAsync queueManager,
     IEventAggregator eventAggregator,
     IWindowManagerEx windowManager,
     INetworkOperations networkOperations)
 {
     _queueManager      = queueManager;
     _eventAggregator   = eventAggregator;
     _windowManager     = windowManager;
     _networkOperations = networkOperations;
     Items           = new BindableCollection <ExplorerItem>();
     IsMSMQInstalled = true;
 }
Esempio n. 19
0
 public MessageListViewModel(
     IEventAggregator eventAggregator,
     IWindowManagerEx windowManager,
     IManagementService managementService,
     IQueueManagerAsync asyncQueueManager)
 {
     _eventAggregator   = eventAggregator;
     _windowManager     = windowManager;
     _managementService = managementService;
     _asyncQueueManager = asyncQueueManager;
     Messages           = new BindableCollection <MessageInfo>();
     SelectedMessages   = new BindableCollection <MessageInfo>();
 }
Esempio n. 20
0
 public MessageListViewModel(
     IEventAggregator eventAggregator,
     IWindowManagerEx windowManager,
     IManagementService managementService,
     IQueueManagerAsync asyncQueueManager)
 {
     _eventAggregator = eventAggregator;
     _windowManager = windowManager;
     _managementService = managementService;
     _asyncQueueManager = asyncQueueManager;
     Messages = new BindableCollection<MessageInfo>();
     SelectedMessages = new BindableCollection<MessageInfo>();
 }
Esempio n. 21
0
        public void should_be_able_to_load_messages_from_the_queue()
        {
            manager = new AsyncQueueManager(new MSMQueueOperations(new DefaultMapper()));

            for (var i = 0; i < 500; i++)
            {
                manager.SendMessage(destinationQ, string.Format("Test message number {0}, this is a somewhat larger text message. this is a somewhat larger text message. this is a somewhat larger text message. this is a somewhat larger text message.", i));
            }

            var messages = AsyncHelper.Run(() => manager.GetMessages(destinationQ));

            messages.Count.ShouldBe(500);
        }
Esempio n. 22
0
 public void TestInitialize()
 {
     EventAggregator  = Substitute.For <IEventAggregator>();
     ServiceControl   = Substitute.For <IServiceControl>();
     MessageStore     = new Dictionary <Queue, List <MessageInfo> >();
     QueueManager     = new FakeQueueManager(MessageStore);
     WindowManager    = Substitute.For <IWindowManagerEx>();
     SearchBar        = Substitute.For <ISearchBarViewModel>();
     StatusBarManager = Substitute.For <IStatusBarManager>();
     View             = Substitute.For <IMessageListView>();
     MessageList      = new MessageListViewModel(EventAggregator, WindowManager, ServiceControl,
                                                 QueueManager, SearchBar,
                                                 Substitute.For <IErrorHeaderViewModel>(),
                                                 Substitute.For <IGeneralHeaderViewModel>(),
                                                 Substitute.For <IClipboard>(),
                                                 StatusBarManager);
     MessageList.AttachView(View, null);
 }
Esempio n. 23
0
        public ErrorHeaderViewModel(
            IEventAggregator eventAggregator,
            IContentDecoder <IList <HeaderInfo> > decoder,
            IQueueManagerAsync queueManager,
            IClipboard clipboard)
            : base(eventAggregator, decoder, queueManager, clipboard)
        {
            DisplayName = "Errors";

            //TODO:Add back the context menu
//            ContextMenuItems.AddRange(new[]
//            {
//                new PluginContextMenu("ReturnToSourceQueue", new RelayCommand(ReturnToSource, CanReturnToSource), 90)
//                {
//                    DisplayName = "Return To Source Queue",
//                    Image = Resources.MessageReturn
//                },
//                new PluginContextMenu("CopyHeaderInfo", new RelayCommand(CopyHeaderInfo, CanCopyHeaderInfo))
//                {
//                    DisplayName = "Copy Header Info",
//                }
//            });
        }
Esempio n. 24
0
        public ErrorHeaderViewModel(
            IEventAggregator eventAggregator, 
            IContentDecoder<IList<HeaderInfo>> decoder, 
            IQueueManagerAsync queueManager, 
            IClipboard clipboard)
            : base(eventAggregator, decoder, queueManager, clipboard)
        {
            DisplayName = "Errors";

            //TODO:Add back the context menu
            //            ContextMenuItems.AddRange(new[]
            //            {
            //                new PluginContextMenu("ReturnToSourceQueue", new RelayCommand(ReturnToSource, CanReturnToSource), 90)
            //                {
            //                    DisplayName = "Return To Source Queue",
            //                    Image = Resources.MessageReturn
            //                },
            //                new PluginContextMenu("CopyHeaderInfo", new RelayCommand(CopyHeaderInfo, CanCopyHeaderInfo))
            //                {
            //                    DisplayName = "Copy Header Info",
            //                }
            //            });
        }
Esempio n. 25
0
        public void should_not_throw_an_exception_when_system_queues_are_orphaned()
        {
            IList<Queue> unorderedQueueList = new List<Queue>(new[] { new Queue("myqueue.subscriptions") });
            queueManager = Substitute.For<IQueueManagerAsync>();
            queueManager.GetQueues().ReturnsForAnyArgs(Task.FromResult(unorderedQueueList));
            explorer = new QueueExplorerViewModel(queueManager, eventAggregator, windowManagerEx, networkOperations);

            Should.NotThrow(() => explorer.RefreshData());
        }
 public void TestInitialize()
 {
     manager = new AsyncQueueManager(new MSMQueueOperations(new DefaultMapper()));
     sourceQ = manager.CreatePrivateQueue(new Queue("TestSource"));
     destinationQ = manager.CreatePrivateQueue(new Queue("TestDest"));
 }
Esempio n. 27
0
        public void TestInitialize()
        {
            queueManager = Substitute.For<IQueueManagerAsync>();
            view = Substitute.For<IExplorerView>();
            eventAggregator = Substitute.For<IEventAggregator>();
            windowManagerEx = Substitute.For<IWindowManagerEx>();
            networkOperations = Substitute.For<INetworkOperations>();
            explorer = new QueueExplorerViewModel(queueManager, eventAggregator, windowManagerEx, networkOperations);

            queue = new Queue("TestQueue");
            subQueue = new Queue("TestQueue.Subscriptions");

            IList<Queue> queues = new List<Queue> { queue, subQueue };
            queueManager.GetQueues(Arg.Any<string>()).Returns(Task.Run(() => queues));
            queueManager.GetQueues().Returns(Task.Run(() => queues));
            queueManager.GetMessageCount(Arg.Any<Queue>()).Returns(Task.Run(() => queues.Count));
            queueManager.IsMsmqInstalled(Arg.Any<string>()).Returns(Task.Run(() => true));

            AsyncHelper.Run(() => explorer.AttachView(view, null));
            AsyncHelper.Run(() => explorer.ConnectToQueue(Environment.MachineName));

            queueNode = explorer.MachineRoot.Children.OfType<QueueExplorerItem>().First();
        }
Esempio n. 28
0
 public void TestInitialize()
 {
     manager      = new AsyncQueueManager(new MSMQueueOperations(new DefaultMapper()));
     sourceQ      = manager.CreatePrivateQueue(new Queue("TestSource"));
     destinationQ = manager.CreatePrivateQueue(new Queue("TestDest"));
 }
 public void TestInitialize()
 {
     EventAggregator = Substitute.For<IEventAggregator>();
     ServiceControl = Substitute.For<IServiceControl>();
     MessageStore = new Dictionary<Queue, List<MessageInfo>>();
     QueueManager = new FakeQueueManager(MessageStore);
     WindowManager = Substitute.For<IWindowManagerEx>();
     SearchBar = Substitute.For<ISearchBarViewModel>();
     StatusBarManager = Substitute.For<IStatusBarManager>();
     View = Substitute.For<IMessageListView>();
     MessageList = new MessageListViewModel(EventAggregator, WindowManager, ServiceControl,
                                            QueueManager, SearchBar,
                                            Substitute.For<IErrorHeaderViewModel>(),
                                            Substitute.For<IGeneralHeaderViewModel>(),
                                            Substitute.For<IClipboard>(),
                                            StatusBarManager);
     MessageList.AttachView(View, null);
 }