Esempio n. 1
0
        public void testReleaseToMarket()
        {
            Dates.freezeNow("2009/09/09 09:09:09");
            var gui = startGui();

            FerretControl.setStatus("Ticket");
            var id = insertSubmitted(39, SYMBOL, "test", "FERREL");

            publishAndWaitForCount(gui, id, 1);
            gui.wait(populateCompleted);
            AreEqual("Submitted", latestRow(gui)["status"]);
            gui.requireMenu(latestRow(gui));
            changeFerretStatus(gui, "FERREL", "New", "Stage");
            gui.requireMenu(latestRow(gui));
            changeFerretStatus(gui, "FERREL", "Accepted", "Ticket", "TICKET");
            gui.requireMenu(latestRow(gui));
            FerretControl.setStatus("Stage");
            gui.wait(populateCompleted);
            changeFerretStatus(gui, "FERREL", "New", "Stage");
            gui.noMenu(latestRow(gui));
            FerretControl.setStatus("Ticket");
            gui.wait(populateCompleted);
            changeFerretStatus(gui, "FERREL", "New", "Stage");
            gui.requireMenu(latestRow(gui));

            Fields fields = null;

            FerretControl.onOutgoing(f => fields = f);
            gui.tracker.release(latestRow(gui));
            O.wait(() => fields != null);
            AreEqual("ReleaseStagedOrder", fields.text("MESSAGETYPE"));
            AreEqual("FERREL", fields.text("USERORDERID"));
            AreEqual("2009-09-09", fields.text("ORDERDATE"));
        }
Esempio n. 2
0
        public void testReleaseSelected()
        {
            var gui = startGui();

            FerretControl.setStatus("Ticket");
            insertSubmitted(39, SYMBOL, "test", "REL1");
            insertSubmitted(39, SYMBOL, "test", "REL2");
            var id3 = insertSubmitted(39, SYMBOL, "test", "REL3");

            publishAndWaitForCount(gui, id3, 3);
            publishFerretResponse(Dates.now(), "REL1", "New", "UNUSED");
            gui.waitMatches("Stage", () => gui.ferretStatus("REL1"));
            publishFerretResponse(Dates.now(), "REL2", "New", "UNUSED");
            gui.waitMatches("Stage", () => gui.ferretStatus("REL2"));
            var messages = new List <Fields>();

            FerretControl.onOutgoing(messages.Add);
            gui.tracker.releaseMaybe(gui.rows());
            gui.waitMatches(2, () => messages.Count);
            gui.hasMessage("Skipped.*1");
            changeFerretStatus(gui, "REL1", "Filled", "Filled");
            changeFerretStatus(gui, "REL2", "Filled", "Filled");
            gui.tracker.releaseMaybe(gui.rows());
            gui.hasMessage("None of the selected orders can be released. Please select a staged Ferret Order to release.");
        }
Esempio n. 3
0
        public void testCancelSelected()   // any non-filled non-cancelled ferret order can be cancelled independent of ferret state
        {
            var gui = startGui();

            FerretControl.setStatus("DMA");
            insertSubmitted(39, SYMBOL, "test", "TCAN1");
            insertSubmitted(39, SYMBOL, "test", "TCAN2");
            var id3 = insertSubmitted(39, SYMBOL, "test", "TCAN3");

            insertSimFilled(39, SYMBOL, "test");
            publishAndWaitForCount(gui, id3, 4);
            changeFerretStatus(gui, "TCAN1", "New", "Stage");
            changeFerretStatus(gui, "TCAN2", "Filled", "Filled");
            var messages = new List <Fields>();

            FerretControl.onOutgoing(messages.Add);
            gui.tracker.cancelMaybe(gui.rows());
            gui.waitMatches(2, () => messages.Count);
            var cancel = Util.Objects.first(messages);

            AreEqual("CancelOrder", cancel.text("MESSAGETYPE"));
            AreEqual("CCAN3", cancel.text("USERORDERID"));
            gui.hasMessage("Skipped.*2");
            changeFerretStatus(gui, "TCAN1", "Cancelled", "Cancelled");
            changeFerretStatus(gui, "TCAN3", "Cancelled", "Cancelled");
            gui.tracker.cancelMaybe(gui.rows());
            gui.hasMessage("None of the selected orders can be cancelled. Please select an open Ferret Order to cancel.");
        }
Esempio n. 4
0
        public void testModeChangeChallenges()
        {
            var gui      = new FakeFerretControlGui();
            var control  = new FerretControl(gui, ferretStatus);
            var messages = new List <Fields>();

            FerretControl.onOutgoing(messages.Add);
            control.setRandomSeed(12345);
            control.changeStatus("Stage");
            AreEqual("Stage", gui.status());
            gui.stageAnswer(YesNoCancel.YES);
            control.onTicketPressed();
            gui.hasMessage("Are you not not sure?");
            gui.waitMatches(1, () => messages.Count);
            messages.Clear();
            control.setReadonly(true);
            gui.stageAnswer(YesNoCancel.NO);
            control.onTicketPressed();
            gui.hasMessage("Are you not not sure?", "incorrect");
            control.setReadonly(false);

            control.changeStatus("Ticket");
            AreEqual("Ticket", gui.status());
            gui.stageAnswer(YesNoCancel.YES);
            control.onDMAPressed();
            gui.hasMessage("Are you not not not not sure?");
            gui.waitMatches(1, () => messages.Count);
            messages.Clear();
            control.setReadonly(true);
            control.onDMAPressed();
            gui.hasMessage("Are you not not not sure?", "incorrect");
            control.setReadonly(false);
            control.onStagePressed();
            gui.noMessage();
            gui.waitMatches(1, () => messages.Count);
            messages.Clear();
            control.changeStatus("DMA");
            control.onStagePressed();
            gui.noMessage();
            gui.waitMatches(1, () => messages.Count);
            messages.Clear();
            control.onTicketPressed();
            gui.noMessage();
            gui.waitMatches(1, () => messages.Count);
        }
Esempio n. 5
0
        public void testCanPublishRestart()
        {
            LogC.useJavaLog = true;
            FerretControl.onOutgoing(fields => O.queueWorkItem(() => FerretControl.setStatus(fields.text("FERRETSTATE"))));
            system.populateDetailsIfNeeded(false);
            system.populateTagIfNeeded("QF.Example", false);
            FerretControl.setStatus("Ticket");
            var    tracker         = startGui();
            var    restartRequests = LiveLauncher.restartTopic();
            Fields received        = null;

            restartRequests.subscribe(fields => { received = fields; });
            tracker.restart(O.hostname(), system.id());
            O.wait(() => received != null);
            AreEqual(system.id(), (int)received.longg("SystemId"));
            AreEqual(O.hostname(), received.text("Hostname"));
            gui.noMessage();

            system.setAutoExecuteTrades(true);
            gui.stageAnswer(YesNoCancel.NO);
            restartRequests.setReadonly(true);
            tracker.restart(O.hostname(), system.id());
            gui.hasMessage("This will put Ferret into Stage mode.  Are you sure you want to do this?");

            gui.stageAnswer(YesNoCancel.YES);
            restartRequests.setReadonly(false);
            received = null;
            tracker.restart(O.hostname(), system.id());
            gui.hasMessage("This will put Ferret into Stage mode.  Are you sure you want to do this?");
            waitMatches("Stage", FerretControl.status);
            O.wait(() => received != null);

            received = null;
            tracker.restart(O.hostname(), system.id());
            gui.noMessage();
            O.wait(() => received != null);
        }