Package com.betfair.baseline.v2.to

Examples of com.betfair.baseline.v2.to.BodyParamI32Object


            listEvents.clear();
        }
        else if (event == GetReceivedEventsEventEnum.SetEvent) {
            Iterator<SetEvent> it = setEvents.iterator();
            while (it.hasNext()) {
                SetEvent next = it.next();
                ReceivedEvent re = new ReceivedEvent();
                re.setEventName(ReceivedEventEventNameEnum.valueOf(event.name()));
                re.setSetEvent(next.getMessageSet());
                ret.add(re);
                it.remove();
            }
            setEvents.clear();
        }
        else if (event == GetReceivedEventsEventEnum.MapEvent) {
            Iterator<MapEvent> it = mapEvents.iterator();
            while (it.hasNext()) {
                MapEvent next = it.next();
                ReceivedEvent re = new ReceivedEvent();
                re.setEventName(ReceivedEventEventNameEnum.valueOf(event.name()));
                re.setMapEvent(next.getMessageMap());
                ret.add(re);
                it.remove();
            }
            mapEvents.clear();
        }
View Full Code Here


                    switch (result.getResultType()) {
                        case Subscription:
                            timeTickSubscription = result.getSubscription();
                            break;
                        case Success:
                            TimeTick timeTick = (TimeTick)result.getResult();
                            System.out.println("Time service tick: " + timeTick.getTime());
                            break;
                        case Fault:
                            System.out.println(result.getFault());
                            break;
                    }
View Full Code Here

    @Override
    public Boolean simpleEventPublication(RequestContext ctx, TimeContainer time, TimeConstraints timeConstraints) throws SimpleException {
        ctx.setRequestLogExtension(new BaselineLogExtension(time, null, null));
       
        TimeTick tte = new TimeTick();
        tte.setTime(time);

        boolean success = false;
        try {
            //This causes the event to be published to the event transport
            timeTickPublishingObserver.onResult(new ExecutionResult(tte));
View Full Code Here

        ctx.setRequestLogExtension(new BaselineLogExtension(null, null, null));
        List<ReceivedEvent> ret = new ArrayList<ReceivedEvent>();
        if (event == GetReceivedEventsEventEnum.TimeTick) {
            Iterator<TimeTick> it = timeTicks.iterator();
            while (it.hasNext()) {
                TimeTick next = it.next();
                ReceivedEvent re = new ReceivedEvent();
                re.setEventName(ReceivedEventEventNameEnum.valueOf(event.name()));
                re.setTimeTick(next.getTime());
                ret.add(re);
                it.remove();
            }
            timeTicks.clear();
        }
        else if (event == GetReceivedEventsEventEnum.MatchedBet) {
            Iterator<MatchedBet> it = matchedBets.iterator();
            while (it.hasNext()) {
                MatchedBet next = it.next();
                ReceivedEvent re = new ReceivedEvent();
                re.setEventName(ReceivedEventEventNameEnum.valueOf(event.name()));
                re.setMatchedBet(next.getBody());
                ret.add(re);
                it.remove();
            }
            matchedBets.clear();
        }
        else if (event == GetReceivedEventsEventEnum.LogMessage) {
            Iterator<LogMessage> it = logMessages.iterator();
            while (it.hasNext()) {
                LogMessage next = it.next();
                ReceivedEvent re = new ReceivedEvent();
                re.setEventName(ReceivedEventEventNameEnum.valueOf(event.name()));
                re.setLogMessage(next.getBody());
                ret.add(re);
                it.remove();
            }
            logMessages.clear();
        }
        else if (event == GetReceivedEventsEventEnum.ListEvent) {
            Iterator<ListEvent> it = listEvents.iterator();
            while (it.hasNext()) {
                ListEvent next = it.next();
                ReceivedEvent re = new ReceivedEvent();
                re.setEventName(ReceivedEventEventNameEnum.valueOf(event.name()));
                re.setListEvent(next.getMessageList());
                ret.add(re);
                it.remove();
            }
            listEvents.clear();
        }
        else if (event == GetReceivedEventsEventEnum.SetEvent) {
            Iterator<SetEvent> it = setEvents.iterator();
            while (it.hasNext()) {
                SetEvent next = it.next();
                ReceivedEvent re = new ReceivedEvent();
                re.setEventName(ReceivedEventEventNameEnum.valueOf(event.name()));
                re.setSetEvent(next.getMessageSet());
                ret.add(re);
                it.remove();
            }
            setEvents.clear();
        }
        else if (event == GetReceivedEventsEventEnum.MapEvent) {
            Iterator<MapEvent> it = mapEvents.iterator();
            while (it.hasNext()) {
                MapEvent next = it.next();
                ReceivedEvent re = new ReceivedEvent();
                re.setEventName(ReceivedEventEventNameEnum.valueOf(event.name()));
                re.setMapEvent(next.getMessageMap());
                ret.add(re);
                it.remove();
            }
            mapEvents.clear();
        }
View Full Code Here

        if (message.equals("throwRuntime")) {
            throw new RuntimeException("Requested");
        } else {
            try {
                SimpleExceptionErrorCodeEnum errCode = SimpleExceptionErrorCodeEnum.valueOf(message.toUpperCase(Locale.ENGLISH));
                throw new SimpleException(response, errCode, message);
            }
            catch (IllegalArgumentException e) {
                try {
                    WotsitExceptionErrorCodeEnum errCode = WotsitExceptionErrorCodeEnum.valueOf(message.toUpperCase(Locale.ENGLISH));
                    throw new WotsitException(e,
                            response,
                            errCode, (message.hashCode() % 2) != 0 ? WotsitExceptionTypeEnum.CHEESY : WotsitExceptionTypeEnum.SPICY,
                            String.valueOf(responseCode));
                }
                catch (IllegalArgumentException ex) {
                }
                throw new SimpleException(e,response, SimpleExceptionErrorCodeEnum.NULL, message);
            }
        }
    }
View Full Code Here

    ctx.setRequestLogExtension(new BaselineLogExtension(null, null, null));
   
    try {
      SimpleExceptionErrorCodeEnum errCode = SimpleExceptionErrorCodeEnum
          .valueOf(message);
      throw new SimpleException(ResponseCode.Unauthorised, errCode,
          message);
    } catch (IllegalArgumentException e) {
      try {
        WotsitExceptionErrorCodeEnum errCode = WotsitExceptionErrorCodeEnum
            .valueOf(message);
        throw new WotsitException(e,
            ResponseCode.Forbidden,
            errCode,
            (message.hashCode() % 2 != 0) ? WotsitExceptionTypeEnum.CHEESY
                : WotsitExceptionTypeEnum.SPICY, message);
      } catch (IllegalArgumentException ex) {
      }
      throw new SimpleException(e,ResponseCode.Unauthorised,
          SimpleExceptionErrorCodeEnum.NULL, message);
    }

  }
View Full Code Here

    @Override
    public void testSleep(RequestContext ctx, Long sleep, TimeConstraints timeConstraints) throws SimpleException {
        ctx.setRequestLogExtension(new BaselineLogExtension(sleep, null, null));

        if (sleep <= 0) {
            throw new SimpleException(ResponseCode.BadRequest, SimpleExceptionErrorCodeEnum.GENERIC, "Sleep must be > 0");
        }

        CountDownLatch latch = new CountDownLatch(1);
        outstandingSleeps.add(latch);
View Full Code Here

            response.add(sr);
        }
        if (async == AsyncBehaviour.SYNC) {
            return response;
        } else {
      throw new SimpleException(ResponseCode.ServiceUnavailable,SimpleExceptionErrorCodeEnum.FORBIDDEN ,"Suspend, is no longer supported");
        }
    }
View Full Code Here

            response.put(String.valueOf(i), sr);
        }
        if (async == AsyncBehaviour.SYNC) {
            return response;
        } else {
          throw new SimpleException(ResponseCode.ServiceUnavailable,SimpleExceptionErrorCodeEnum.FORBIDDEN ,"Suspend, is no longer supported");
        }
    }
View Full Code Here

    try {
      long sec = Long.parseLong(seconds);
      Thread.currentThread().sleep(sec * 1000);

    } catch (NumberFormatException e) {
      throw new SimpleException(ResponseCode.InternalError,SimpleExceptionErrorCodeEnum.GENERIC, e.getMessage());
    } catch (InterruptedException e) {
      throw new SimpleException(ResponseCode.Timeout,SimpleExceptionErrorCodeEnum.TIMEOUT,e.getMessage());
    }
    SimpleResponse response = new SimpleResponse();
    response.setMessage("Waited for " + seconds + " seconds.");
    return response;   
 
View Full Code Here

TOP

Related Classes of com.betfair.baseline.v2.to.BodyParamI32Object

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.