Package whitewerx.com.trapos.disruptor

Examples of whitewerx.com.trapos.disruptor.MarketTradeEventHandler


     * @param ringBuffer
     * @param translationBarrier
     * @return
     */
    private EventProcessor createTradeProcessor(RingBuffer<MarketEvent> ringBuffer, SequenceBarrier translationBarrier) {
        MarketTradeEventHandler tradeHandler = new MarketTradeEventHandler();
        EventProcessor tradeProcessor = new BatchEventProcessor<MarketEvent>(ringBuffer, translationBarrier,
                tradeHandler);
        eventProcessors[0] = tradeProcessor;
        return tradeProcessor;
    }
View Full Code Here


        final String delimitedTrade = "T|S|2.3m|R|GBPUSD|1.6324";
        final TradeTranslator tradeTranslator = context.mock(TradeTranslator.class);
        final MarketEvent marketEvent = context.mock(MarketEvent.class);
        final Trade trade = context.mock(Trade.class);
       
        final MarketTradeEventHandler h = new MarketTradeEventHandler(tradeTranslator);
        context.checking(new Expectations(){{
            oneOf(marketEvent).getMessage();
            will(returnValue(delimitedTrade));
           
            oneOf(tradeTranslator).canHandle(delimitedTrade);
            will(returnValue(true));
            oneOf(tradeTranslator).translate(delimitedTrade);
            will(returnValue(trade));

            oneOf(marketEvent).accept(with(any(Trade.class)));
        }});
       
        h.onEvent(marketEvent, 1, true);
    }
View Full Code Here

        final String delimitedRate = "R|GBPUSD|1.6324";
       
        final TradeTranslator tradeTranslator = context.mock(TradeTranslator.class);
        final MarketEvent marketEvent = context.mock(MarketEvent.class);
       
        final MarketTradeEventHandler h = new MarketTradeEventHandler(tradeTranslator);
        context.checking(new Expectations(){{
            oneOf(marketEvent).getMessage();
            will(returnValue(delimitedRate));
           
            oneOf(tradeTranslator).canHandle(delimitedRate);
            will(returnValue(false));
        }});
       
        h.onEvent(marketEvent, 1, true);
    }
View Full Code Here

TOP

Related Classes of whitewerx.com.trapos.disruptor.MarketTradeEventHandler

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.