@Test public void selectBidsTest() throws DSPException { RTBRequestWrapper wReq = new RTBRequestWrapper(request); RTBExchange exchange = new RTBExchange("BigAdExchange", "http: List<String> categories = new ArrayList<String>(); categories.add("cat1"); Map<String, String> seats = new HashMap<String, String>(); seats.put("BigAdExchange", "1001"); RTBAdvertiser adv = new RTBAdvertiser("MyPage", "BigBrandIndia", "http: Map<String, RTBAdvertiser> advertisersMap = new HashMap<String, RTBAdvertiser>(); advertisersMap.put(adv.getLandingPage(), adv); long reqTimeout = 2000; long offerTimeout = 1000; wReq.setContext(exchange, advertisersMap, reqTimeout, offerTimeout); BidResponse response = new BidResponse(); BidResponse res = bidder.selectBids(wReq, response); assertNotNull("Response should not be empty ", res); assertTrue("Response should atleast one seat Bid object ", res .getSeatbid().size() == 1); }
public BidResponse selectBids(RTBRequestWrapper wReq, BidResponse response) { if (wReq.getImp().size()<=0) response = null; else { response = new BidResponse(); response.id = wReq.getRequest().getId(); response.bidid = "simple-bid-tracker-" + nextResponseNum(); Map<String, String> seats = wReq.getUnblockedSeats(wReq .getSSPName()); for (Impression i : wReq.getRequest().getImp()) { for (Map.Entry<String, String> s : seats.entrySet()) { RTBAdvertiser a = wReq.getAdvertiser(s.getValue()); SeatBid seat_bid = new SeatBid(); seat_bid.seat = s.getKey(); seat_bid.bid = new ArrayList<Bid>(); Bid b = new Bid(); b.id = "StatefulBid #" + nextBidNum(); b.impid = i.getId(); b.price = i.getBidfloor() + (float) 0.10; b.nurl = a.getNurl(); b.adid = adId; seat_bid.bid.add(b); List<SeatBid> seatBidList = new ArrayList<SeatBid>(); seatBidList.add(seat_bid); response.setSeatbid(seatBidList); } } } return response; }
StatefulBidder implements OpenRTBAPI { public BidResponse selectBids(RTBRequestWrapper wReq, BidResponse response) { if (wReq.getImp().size()<=0) response = null; else { response = new BidResponse(); response.id = wReq.getRequest().getId(); response.bidid = "simple-bid-tracker-" + nextResponseNum(); Map<String, String> seats = wReq.getUnblockedSeats(wReq .getSSPName()); for (Impression i : wReq.getRequest().getImp()) { for (Map.Entry<String, String> s : seats.entrySet()) { RTBAdvertiser a = wReq.getAdvertiser(s.getValue()); SeatBid seat_bid = new SeatBid(); seat_bid.seat = s.getKey(); seat_bid.bid = new ArrayList<Bid>(); Bid b = new Bid(); b.id = "StatefulBid #" + nextBidNum(); b.impid = i.getId(); b.price = i.getBidfloor() + (float) 0.10; b.nurl = a.getNurl(); b.adid = adId; seat_bid.bid.add(b); List<SeatBid> seatBidList = new ArrayList<SeatBid>(); seatBidList.add(seat_bid); response.setSeatbid(seatBidList); } } } return response; } }
StatefulBidder implements OpenRTBAPI { public BidResponse selectBids(RTBRequestWrapper wReq, BidResponse response) { if (wReq.getImp().size()<=0) response = null; else { response = new BidResponse(); response.id = wReq.getRequest().getId(); response.bidid = "simple-bid-tracker-" + nextResponseNum(); Map<String, String> seats = wReq.getUnblockedSeats(wReq .getSSPName()); for (Impression i : wReq.getRequest().getImp()) { for (Map.Entry<String, String> s : seats.entrySet()) { RTBAdvertiser a = wReq.getAdvertiser(s.getValue()); SeatBid seat_bid = new SeatBid(); seat_bid.seat = s.getKey(); seat_bid.bid = new ArrayList<Bid>(); Bid b = new Bid(); b.id = "StatefulBid #" + nextBidNum(); b.impid = i.getId(); b.price = i.getBidfloor() + (float) 0.10; b.nurl = a.getNurl(); b.adid = adId; seat_bid.bid.add(b); List<SeatBid> seatBidList = new ArrayList<SeatBid>(); seatBidList.add(seat_bid); response.setSeatbid(seatBidList); } } } return response; } StatefulBidder(); }
StatefulBidder implements OpenRTBAPI { public BidResponse selectBids(RTBRequestWrapper wReq, BidResponse response) { if (wReq.getImp().size()<=0) response = null; else { response = new BidResponse(); response.id = wReq.getRequest().getId(); response.bidid = "simple-bid-tracker-" + nextResponseNum(); Map<String, String> seats = wReq.getUnblockedSeats(wReq .getSSPName()); for (Impression i : wReq.getRequest().getImp()) { for (Map.Entry<String, String> s : seats.entrySet()) { RTBAdvertiser a = wReq.getAdvertiser(s.getValue()); SeatBid seat_bid = new SeatBid(); seat_bid.seat = s.getKey(); seat_bid.bid = new ArrayList<Bid>(); Bid b = new Bid(); b.id = "StatefulBid #" + nextBidNum(); b.impid = i.getId(); b.price = i.getBidfloor() + (float) 0.10; b.nurl = a.getNurl(); b.adid = adId; seat_bid.bid.add(b); List<SeatBid> seatBidList = new ArrayList<SeatBid>(); seatBidList.add(seat_bid); response.setSeatbid(seatBidList); } } } return response; } StatefulBidder(); boolean validateRequest(BidRequest request); BidResponse selectBids(RTBRequestWrapper wReq, BidResponse response); @Override BidResponse process(BidRequest request); }
StatefulBidder implements OpenRTBAPI { public BidResponse selectBids(RTBRequestWrapper wReq, BidResponse response) { if (wReq.getImp().size()<=0) response = null; else { response = new BidResponse(); response.id = wReq.getRequest().getId(); response.bidid = "simple-bid-tracker-" + nextResponseNum(); Map<String, String> seats = wReq.getUnblockedSeats(wReq .getSSPName()); for (Impression i : wReq.getRequest().getImp()) { for (Map.Entry<String, String> s : seats.entrySet()) { RTBAdvertiser a = wReq.getAdvertiser(s.getValue()); SeatBid seat_bid = new SeatBid(); seat_bid.seat = s.getKey(); seat_bid.bid = new ArrayList<Bid>(); Bid b = new Bid(); b.id = "StatefulBid #" + nextBidNum(); b.impid = i.getId(); b.price = i.getBidfloor() + (float) 0.10; b.nurl = a.getNurl(); b.adid = adId; seat_bid.bid.add(b); List<SeatBid> seatBidList = new ArrayList<SeatBid>(); seatBidList.add(seat_bid); response.setSeatbid(seatBidList); } } } return response; } StatefulBidder(); boolean validateRequest(BidRequest request); BidResponse selectBids(RTBRequestWrapper wReq, BidResponse response); @Override BidResponse process(BidRequest request); static final FSMTransition<TSMStates, String> EV_NEWREQUEST; }