Port Kueez: New Adapter#3930
Conversation
…kim-ng93/prebid-server-java into S2S-2404-pbs-port-kueez-adapter
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new bid adapter for Kueez by porting the existing Go implementation to Java. Key changes include:
- Implementation of the KueezBidder and its corresponding Spring configuration.
- Addition of unit and integration tests to cover the adapter’s functionality.
- Inclusion of a new YAML configuration file for Kueez adapter settings.
Reviewed Changes
Copilot reviewed 6 out of 12 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/org/prebid/server/it/KueezTest.java | Integration test for bidding auction flow using Kueez adapter |
| src/test/java/org/prebid/server/bidder/kueezrtb/KueezBidderTest.java | Unit tests verifying HTTP requests, header configuration, error handling, and bid type processing |
| src/main/resources/bidder-config/kueezrtb.yaml | Configuration file for the Kueez adapter endpoints and usersync settings |
| src/main/java/org/prebid/server/spring/config/bidder/KueezConfiguration.java | Spring configuration class binding YAML properties and creating bidder dependencies |
| src/main/java/org/prebid/server/proto/openrtb/ext/request/kueezrtb/KueezImpExt.java | POJO for mapping bidder-specific Imp extension with JSON property 'cId' |
| src/main/java/org/prebid/server/bidder/kueezrtb/KueezBidder.java | Implementation of the Kueez bid adapter handling HTTP requests and bid response processing |
Files not reviewed (6)
- src/main/resources/static/bidder-params/kueezrtb.json: Language not supported
- src/test/resources/org/prebid/server/it/openrtb2/kueezrtb/test-auction-kueezrtb-request.json: Language not supported
- src/test/resources/org/prebid/server/it/openrtb2/kueezrtb/test-auction-kueezrtb-response.json: Language not supported
- src/test/resources/org/prebid/server/it/openrtb2/kueezrtb/test-kueezrtb-bid-request.json: Language not supported
- src/test/resources/org/prebid/server/it/openrtb2/kueezrtb/test-kueezrtb-bid-response.json: Language not supported
- src/test/resources/org/prebid/server/it/test-application.properties: Language not supported
| throw new PreBidException(e.getMessage()); | ||
| } |
There was a problem hiding this comment.
Consider enhancing the error message by adding contextual information (e.g. indicating that the error occurred while parsing the Imp extension) to aid future debugging efforts.
| throw new PreBidException(e.getMessage()); | |
| } | |
| throw new PreBidException("Failed to parse Imp extension: " + e.getMessage()); |
| "required": [ | ||
| "cId" | ||
| ] | ||
| } |
There was a problem hiding this comment.
The Golang version of this schema https://github.com/prebid/prebid-server/blob/0b91679fe610a50f898daaf3feb2a33440a33b26/static/bidder-params/kueezrtb.json#L17 restricts additional properties, where is the actual version of the schema?
There was a problem hiding this comment.
@kim-ng93 can you please confirm this or create a PR updating the schema?
There was a problem hiding this comment.
This should match the golang version now
| private static BidType getMediaTypeForBid(Bid bid) { | ||
| final Integer mType = bid.getMtype(); | ||
| if (mType == null) { | ||
| throw new PreBidException("Missing MType for bid: " + bid.getId()); | ||
| } | ||
| return switch (mType) { | ||
| case 1 -> BidType.banner; | ||
| case 2 -> BidType.video; | ||
| default -> throw new PreBidException("Could not define bid type for imp: " + bid.getImpid()); | ||
| }; | ||
| } |
There was a problem hiding this comment.
private static BidType getBidType(Integer mType) {
return switch (mType) {
case 1 -> BidType.banner;
case 2 -> BidType.video;
case null, default -> throw new PreBidException("Could not define bid type for imp: " + bid.getImpid());
};
}| import java.util.List; | ||
| import java.util.Objects; | ||
|
|
||
| public class KueezBidder implements Bidder<BidRequest> { |
There was a problem hiding this comment.
it's better to make this file and any other related start with KuezzRtb
| @Test | ||
| public void makeBidsShouldReturnErrorWhenImpTypeIsNotSupported() throws JsonProcessingException { | ||
| // given | ||
| final Bid bannerBid = Bid.builder().id("bidId1").impid("id1").mtype(1).build(); | ||
| final Bid bidWithoutMtype = Bid.builder().id("bidId2").impid("id2").mtype(null).build(); | ||
| final Bid audioBid = Bid.builder().id("bidId3").impid("id3").mtype(3).build(); | ||
| final Bid nativeBid = Bid.builder().id("bidId4").impid("id4").mtype(4).build(); | ||
|
|
||
| final BidderCall<BidRequest> httpCall = givenHttpCall( | ||
| givenBidResponse(bannerBid, bidWithoutMtype, audioBid, nativeBid)); | ||
|
|
||
| // when | ||
| final Result<List<BidderBid>> result = target.makeBids(httpCall, null); | ||
| // then | ||
| assertThat(result.getErrors()).containsExactlyInAnyOrder( | ||
| badServerResponse("Missing MType for bid: bidId2"), | ||
| badServerResponse("Could not define bid type for imp: id3"), | ||
| badServerResponse("Could not define bid type for imp: id4")); | ||
| assertThat(result.getValue()).containsOnly(BidderBid.of(bannerBid, banner, "USD")); | ||
| } |
There was a problem hiding this comment.
Please split this test into separate ones based on mtype
| adapters.kueezrtb.enabled=true | ||
| adapters.kueezrtb.endpoint=http://localhost:8090/kueezrtb-exchange/ |
There was a problem hiding this comment.
please follow an alphabetical order here
| } | ||
|
|
||
| @Test | ||
| public void makeBidsShouldReturnBidsWithTypesSuccessfully() throws JsonProcessingException { |
There was a problem hiding this comment.
please split this one as well
|
@kim-ng93 Please, fix json test |
osulzhenko
left a comment
There was a problem hiding this comment.
@kim-ng93 could you please update your PR with current master? Also, please add additional def additionalProperties field to BidderParams.groovy, because without it, functional tests can’t properly parse result from GET bidders params endpoint.
🔧 Type of changes
✨ What's the context?
What's the context for the changes?
Port Kueez adapter from Go
🧠 Rationale behind the change
Why did you choose to make these changes? Were there any trade-offs you had to consider?
🔎 New Bid Adapter Checklist
🧪 Test plan
How do you know the changes are safe to ship to production?
🏎 Quality check