-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detailed prebid/prebid-server#1715 Refactor winningBid logic. Added IT test.
- Loading branch information
Showing
22 changed files
with
1,542 additions
and
397 deletions.
There are no files selected for viewing
243 changes: 158 additions & 85 deletions
243
src/main/java/org/prebid/server/auction/BidResponseCreator.java
Large diffs are not rendered by default.
Oops, something went wrong.
85 changes: 0 additions & 85 deletions
85
src/main/java/org/prebid/server/auction/BidResponseReducer.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/org/prebid/server/auction/WinningBidComparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.prebid.server.auction; | ||
|
||
import com.iab.openrtb.request.Imp; | ||
import org.prebid.server.auction.model.BidInfo; | ||
|
||
import java.util.Comparator; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Re | ||
*/ | ||
public class WinningBidComparator implements Comparator<BidInfo> { | ||
|
||
private final Comparator<BidInfo> priceComparator = Comparator.comparing(o -> o.getBid().getPrice()); | ||
|
||
@Override | ||
public int compare(BidInfo bidInfo1, BidInfo bidInfo2) { | ||
final Imp imp = bidInfo1.getCorrespondingImp(); | ||
// this should never happen | ||
if (!Objects.equals(imp, bidInfo2.getCorrespondingImp())) { | ||
throw new IllegalStateException( | ||
String.format("Error while determining winning bid: " | ||
+ "Multiple bids for was found for impId: %s", imp.getId())); | ||
} | ||
|
||
return priceComparator.compare(bidInfo1, bidInfo2); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/org/prebid/server/auction/model/TargetingBidInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.prebid.server.auction.model; | ||
|
||
import lombok.Builder; | ||
import lombok.Value; | ||
|
||
@Builder(toBuilder = true) | ||
@Value | ||
public class TargetingBidInfo { | ||
|
||
BidInfo bidInfo; | ||
|
||
String bidderCode; | ||
|
||
boolean isTargetingEnabled; | ||
|
||
boolean isWinningBid; | ||
|
||
boolean isBidderWinningBid; | ||
|
||
boolean isAddTargetBidderCode; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/java/org/prebid/server/proto/openrtb/ext/request/ExtRequestPrebidMultiBid.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.prebid.server.proto.openrtb.ext.request; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Value; | ||
|
||
/** | ||
* Defines the contract for bidrequest.ext.prebid.targeting | ||
*/ | ||
@Value(staticConstructor = "of") | ||
public class ExtRequestPrebidMultiBid { | ||
|
||
/** | ||
* Defines the contract for bidrequest.ext.prebid.multibid.bidder | ||
*/ | ||
String bidder; | ||
|
||
/** | ||
* Defines the contract for bidrequest.ext.prebid.multibid.maxbids | ||
*/ | ||
@JsonProperty("maxbids") | ||
Integer maxBids; | ||
|
||
/** | ||
* Defines the contract for bidrequest.ext.prebid.multibid.targetbiddercodeprefix | ||
*/ | ||
@JsonProperty("targetbiddercodeprefix") | ||
String targetBidderCodePrefix; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.