@Test public void validateResponseTest() throws AvroRemoteException { RTBRequestWrapper wReq = new RTBRequestWrapper(request); RTBExchange exchange = new RTBExchange("BigAdExchange", "http: List<String> categories = new ArrayList<String>(); categories.add("cat1"); categories.add("cat2"); categories.add("cat3"); Map<String, String> seats = new HashMap<String, String>(); seats.put("BigAdExchange", "1001"); seats.put("SmallAdExchange", "1002"); RTBAdvertiser adv = new RTBAdvertiser("MyPage", "BigBrandIndia", "http: Map<String, RTBAdvertiser> advertisers = new HashMap<String, RTBAdvertiser>(); advertisers.put(adv.getLandingPage(), adv); long reqTimeout = 2000; long offerTimeout = 1000; wReq.setContext(exchange, advertisers, reqTimeout, offerTimeout); BidResponse response = bidder.process(wReq); assertNotNull("Response should not be empty ", response); assertTrue("Response should atleast one seat Bid object ", response.getSeatbid().size()>0); assertTrue("Response has 1 Bid object ", response.getSeatbid().size()==1); assertNotNull("Response should have valid Bid ID ", response.getBidid()); assertTrue("Response should have valid response ID ", response.getId()=="ad1d762d6d9719b6b3c9e09f6433a76d9b593738"); }
@Override public BidResponse process(BidRequest request) throws AvroRemoteException { RTBRequestWrapper transaction = (RTBRequestWrapper) request; TSMController controller = new TSMController(this, transaction); transactions.put(transaction.getSSPName(), controller); try { controller.exec(TSMStates.TXN_CLOSED); } catch (Exception e) { logger.error("StatefulBidder: Exception in process method : " + StringUtils.stackTraceToString(e)); throw new AvroRemoteException(e.getMessage()); } return controller.response; }
StatefulBidder implements OpenRTBAPI { @Override public BidResponse process(BidRequest request) throws AvroRemoteException { RTBRequestWrapper transaction = (RTBRequestWrapper) request; TSMController controller = new TSMController(this, transaction); transactions.put(transaction.getSSPName(), controller); try { controller.exec(TSMStates.TXN_CLOSED); } catch (Exception e) { logger.error("StatefulBidder: Exception in process method : " + StringUtils.stackTraceToString(e)); throw new AvroRemoteException(e.getMessage()); } return controller.response; } }
StatefulBidder implements OpenRTBAPI { @Override public BidResponse process(BidRequest request) throws AvroRemoteException { RTBRequestWrapper transaction = (RTBRequestWrapper) request; TSMController controller = new TSMController(this, transaction); transactions.put(transaction.getSSPName(), controller); try { controller.exec(TSMStates.TXN_CLOSED); } catch (Exception e) { logger.error("StatefulBidder: Exception in process method : " + StringUtils.stackTraceToString(e)); throw new AvroRemoteException(e.getMessage()); } return controller.response; } StatefulBidder(); }
StatefulBidder implements OpenRTBAPI { @Override public BidResponse process(BidRequest request) throws AvroRemoteException { RTBRequestWrapper transaction = (RTBRequestWrapper) request; TSMController controller = new TSMController(this, transaction); transactions.put(transaction.getSSPName(), controller); try { controller.exec(TSMStates.TXN_CLOSED); } catch (Exception e) { logger.error("StatefulBidder: Exception in process method : " + StringUtils.stackTraceToString(e)); throw new AvroRemoteException(e.getMessage()); } return controller.response; } StatefulBidder(); boolean validateRequest(BidRequest request); BidResponse selectBids(RTBRequestWrapper wReq, BidResponse response); @Override BidResponse process(BidRequest request); }
StatefulBidder implements OpenRTBAPI { @Override public BidResponse process(BidRequest request) throws AvroRemoteException { RTBRequestWrapper transaction = (RTBRequestWrapper) request; TSMController controller = new TSMController(this, transaction); transactions.put(transaction.getSSPName(), controller); try { controller.exec(TSMStates.TXN_CLOSED); } catch (Exception e) { logger.error("StatefulBidder: Exception in process method : " + StringUtils.stackTraceToString(e)); throw new AvroRemoteException(e.getMessage()); } return controller.response; } StatefulBidder(); boolean validateRequest(BidRequest request); BidResponse selectBids(RTBRequestWrapper wReq, BidResponse response); @Override BidResponse process(BidRequest request); static final FSMTransition<TSMStates, String> EV_NEWREQUEST; }