-
Notifications
You must be signed in to change notification settings - Fork 224
Connatix: Port adapter from PBS-Go #3781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connatix: Port adapter from PBS-Go #3781
Conversation
src/main/java/org/prebid/server/bidder/connatix/ConnatixBidder.java
Outdated
Show resolved
Hide resolved
src/main/java/org/prebid/server/bidder/connatix/ConnatixBidder.java
Outdated
Show resolved
Hide resolved
| @Override | ||
| public Result<List<HttpRequest<BidRequest>>> makeHttpRequests(BidRequest request) { | ||
| // Device IP required - bounce if not available | ||
| if (request.getDevice() == null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd extract device into a separate variable since it's used later as well
src/main/java/org/prebid/server/bidder/connatix/ConnatixBidder.java
Outdated
Show resolved
Hide resolved
src/main/java/org/prebid/server/bidder/connatix/ConnatixBidder.java
Outdated
Show resolved
Hide resolved
src/main/java/org/prebid/server/bidder/connatix/ConnatixBidder.java
Outdated
Show resolved
Hide resolved
|
updates in response to comments are in progress |
src/main/java/org/prebid/server/bidder/connatix/ConnatixBidder.java
Outdated
Show resolved
Hide resolved
src/main/java/org/prebid/server/bidder/connatix/ConnatixBidder.java
Outdated
Show resolved
Hide resolved
| final BidRequest bidRequest = givenBidRequest( | ||
| request -> request.device(Device.builder().ip("deviceIp").build()), | ||
| impBuilder -> impBuilder.ext(mapper.valueToTree(ExtPrebid.of(null, mapper.createArrayNode()))) | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to the code style closing parenthesis should be on the previous line
please double-check everywhere in the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^^
src/main/java/org/prebid/server/bidder/connatix/ConnatixBidder.java
Outdated
Show resolved
Hide resolved
src/main/java/org/prebid/server/bidder/connatix/ConnatixBidder.java
Outdated
Show resolved
Hide resolved
src/main/java/org/prebid/server/bidder/connatix/ConnatixBidder.java
Outdated
Show resolved
Hide resolved
src/main/java/org/prebid/server/proto/openrtb/ext/request/connatix/ExtImpConnatix.java
Outdated
Show resolved
Hide resolved
src/test/java/org/prebid/server/bidder/connatix/ConnatixBidderTest.java
Outdated
Show resolved
Hide resolved
| final BidRequest bidRequest = givenBidRequest( | ||
| request -> request.device(Device.builder().ip("deviceIp").build()), | ||
| impBuilder -> impBuilder.ext(mapper.valueToTree(ExtPrebid.of(null, mapper.createArrayNode()))) | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^^
| @SafeVarargs | ||
| private static BidRequest givenBidRequest(UnaryOperator<BidRequest.BidRequestBuilder> bidRequestCustomizer, | ||
| UnaryOperator<Imp.ImpBuilder>... impCustomizers) { | ||
| return bidRequestCustomizer.apply(BidRequest.builder() | ||
| .imp(Stream.of(impCustomizers) | ||
| .map(ConnatixBidderTest::givenImp) | ||
| .toList())) | ||
| .build(); | ||
| } | ||
|
|
||
| private static Imp givenImp(UnaryOperator<Imp.ImpBuilder> impCustomizer) { | ||
| return impCustomizer.apply(Imp.builder()).build(); | ||
| } | ||
|
|
||
| private static Imp givenImp(ExtImpConnatix extImpConnatix) { | ||
| return givenImp(imp -> imp.ext(mapper.valueToTree(ExtPrebid.of(null, extImpConnatix)))); | ||
| } | ||
|
|
||
| private static ExtImpConnatix givenExt(UnaryOperator<ExtImpConnatix.ExtImpConnatixBuilder> extCustomizer) { | ||
| return extCustomizer.apply(ExtImpConnatix.builder().placementId("placementId")).build(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can simplify all makeHttpRequests* tests by adding default Device object to givenBidRequest method:
private static BidRequest givenBidRequest(UnaryOperator<BidRequest.BidRequestBuilder> bidRequestCustomizer,
Imp... imps) {
return bidRequestCustomizer.apply(BidRequest.builder()
.imp(List.of(imps))
.device(Device.builder().ip("deviceIp).build())
.build();
}
Also, use givenImp and givenBidRequest(UnaryOperator<BidRequest.BidRequestBuilder>, Imp...) combo, instead of current approach
| return bidRequestCustomizer.apply(BidRequest.builder().imp(asList(imps))).build(); | ||
| } | ||
|
|
||
| @SafeVarargs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove @SafeVarargs annotation
|
@katherynhrabik Please update to actual master |
🔧 Type of changes
✨ What's the context?
What's the context for the changes?
New Connatix Adapter (port from Go)
#3601
🧠 Rationale behind the change
Why did you choose to make these changes? Were there any trade-offs you had to consider?
N/A
🔎 New Bid Adapter Checklist
🧪 Test plan
How do you know the changes are safe to ship to production?
Unit tests with decent coverage
🏎 Quality check