Package com.collective2.signalEntry.implementation

Examples of com.collective2.signalEntry.implementation.ResponseManager


    }

    @Test
    public void  limitSShortTest() {

        RelativeNumber sellAbove = new RelativeNumber("4");//must sell above this price
        RelativeNumber buyBelow = new RelativeNumber("2");//must buy below this price

        BigDecimal expectedSell = new BigDecimal("4");
        BigDecimal expectedBuy = new BigDecimal("2");

        limitShortTest(SignalAction.SSHORT, sellAbove, buyBelow, expectedSell, expectedBuy);
View Full Code Here


        //starts out empty
        assertTrue(!journal.pending().hasNext());

        /////////////////////////
        //successful addition of one request
        Request request = new Request(Command.Signal);
        journal.append(request);

        //stop journal and force reload from disk
        journal.close();
        journal = new C2EntryServiceLogFileJournal(tempFile,4096);

        assertEquals(request, journal.pending().next());

        ///////////////////////////////
        //successful removal of one request
        journal.markSent(request);

        //stop journal and force reload from disk
        journal.close();
        journal = new C2EntryServiceLogFileJournal(tempFile,4096);

        assertTrue("check file:"+tempFile,!journal.pending().hasNext());

        //////////////////////////////////
        //successful addition of two requests in order
        Request request2 = new Request(Command.Cancel);
        assert(!request.equals(request2));
        journal.append(request);

        //stop journal and force reload from disk
        journal.close();
View Full Code Here

            e.printStackTrace();
            fail();
        }
        C2EntryServiceLogFileJournal journal = new C2EntryServiceLogFileJournal(tempFile,50);

        Request request = new Request(Command.Signal);
        Request request2 = new Request(Command.Cancel);

        journal.append(request);
        journal.markSent(request);

        assertFalse(journal.pending().hasNext());
View Full Code Here

    private void journalTest(C2EntryServiceJournal journal) {
        //starts out empty
        assertTrue(!journal.pending().hasNext());

        //successful addition of one request
        Request request = new Request(Command.Signal);
        journal.append(request);
        assertEquals(request,journal.pending().next());

        //successful removal of one request
        journal.markSent(request);
        assertTrue(!journal.pending().hasNext());

        //successful addition of two requests in order
        Request request2 = new Request(Command.Cancel);
        assert(!request.equals(request2));
        journal.append(request);
        journal.append(request2);
        Iterator<Request> iterator = journal.pending();
        assertTrue(iterator.hasNext());
View Full Code Here

    @Test
    public void timeoutTest() {

        Collective2Adapter adapter = new Collective2Adapter();
        //mock request that does not return actual URL to collective2
        Request mockRequest = new Request(Command.AllSignals) {
            @Override
            public URL buildURL() {
                try {
                    return new URL("file://nofile.nowhere");
View Full Code Here

    @Test
    public void transmitTest() {

        Collective2Adapter adapter = new Collective2Adapter();
        //mock request that does not return actual URL to collective2
        Request mockRequest = new Request(Command.Cancel) {
            @Override
            public URL buildURL() {
                return getClass().getClassLoader().getResource("staticResponse.xml");
            };
        };
View Full Code Here

    private final static long networkDownRetryDelay = 10000l;//try every 10 seconds
    protected final ResponseManager responseManager;

    public C2ServiceFactory() {
        this.responseManager = new ResponseManager(new Collective2Adapter(),
                new C2EntryServiceMemoryJournal(),
                C2EntryHumanApproval.ApproveAll,
                networkDownRetryDelay);
    }
View Full Code Here

                C2EntryHumanApproval.ApproveAll,
                networkDownRetryDelay);
    }

    public C2ServiceFactory(C2EntryServiceAdapter adapter) {
        this.responseManager = new ResponseManager(adapter,
                new C2EntryServiceMemoryJournal(),
                C2EntryHumanApproval.ApproveAll,
                networkDownRetryDelay);
    }
View Full Code Here

                networkDownRetryDelay);
    }

    public C2ServiceFactory(C2EntryServiceAdapter adapter,
                            C2EntryHumanApproval approval) {
        this.responseManager = new ResponseManager(adapter,
                new C2EntryServiceMemoryJournal(),
                approval,
                networkDownRetryDelay);
    }
View Full Code Here

                networkDownRetryDelay);
    }

    public C2ServiceFactory(C2EntryServiceAdapter adapter,
                            C2EntryServiceJournal journal) {
        this.responseManager = new ResponseManager(adapter,
                journal,
                C2EntryHumanApproval.ApproveAll,
                networkDownRetryDelay);
    }
View Full Code Here

TOP

Related Classes of com.collective2.signalEntry.implementation.ResponseManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.