Skip to content
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

Remove FacebookNative #1691

Merged
merged 1 commit into from
Jan 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/main/java/com/iab/openrtb/request/Native.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.iab.openrtb.request;

import com.fasterxml.jackson.databind.node.ObjectNode;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.util.List;

Expand All @@ -27,8 +26,7 @@
* the offered types.
*/
@Data
@SuperBuilder(toBuilder = true)
@NoArgsConstructor
@Builder(toBuilder = true)
public class Native {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import org.prebid.server.bidder.Bidder;
import org.prebid.server.bidder.facebook.proto.FacebookAdMarkup;
import org.prebid.server.bidder.facebook.proto.FacebookExt;
import org.prebid.server.bidder.facebook.proto.FacebookNative;
import org.prebid.server.bidder.model.BidderBid;
import org.prebid.server.bidder.model.BidderError;
import org.prebid.server.bidder.model.HttpCall;
Expand Down Expand Up @@ -246,9 +245,7 @@ private static boolean isBannerHeightValid(Integer h) {
* Add Width and Height (not available in standard openRTB) and exclude native.request and native.ver fields
*/
private static Native modifyNative(Native xNative) {
return FacebookNative.builder()
.w(-1)
.h(-1)
return Native.builder()
.api(xNative.getApi())
.battr(xNative.getBattr())
.ext(xNative.getExt())
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void makeBidsShouldReturnNativeBid() throws JsonProcessingException {
// given
final HttpCall<BidRequest> httpCall = givenHttpCall(
BidRequest.builder().imp(singletonList(Imp.builder().id("123")
.xNative(new Native())
.xNative(Native.builder().build())
.build())).build(),
mapper.writeValueAsString(givenBidResponse(
bidBuilder -> bidBuilder.impid("123").ext(createBidExtPrebidWithType("native")))));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import org.junit.Test;
import org.prebid.server.VertxTest;
import org.prebid.server.bidder.facebook.proto.FacebookExt;
import org.prebid.server.bidder.facebook.proto.FacebookNative;
import org.prebid.server.bidder.model.BidderBid;
import org.prebid.server.bidder.model.BidderError;
import org.prebid.server.bidder.model.HttpCall;
Expand Down Expand Up @@ -423,18 +422,16 @@ public void makeHttpRequestsShouldModifyImpNativeByAddingWidthAndHeightAndRemovi
// then
assertThat(result.getErrors()).isEmpty();
assertThat(result.getValue()).hasSize(1)
// use payload as deserializing from body json string converts native to parent class, which
// is not aware of child's fields
.extracting(HttpRequest::getPayload)
.flatExtracting(BidRequest::getImp)
.extracting(Imp::getXNative)
.containsOnly(FacebookNative.builder().w(-1).h(-1).api(singletonList(1)).build());
.containsOnly(Native.builder().api(singletonList(1)).build());

// extra check to assure that data in body is displayed correctly
assertThat(result.getValue())
.extracting(value -> new String(value.getBody()))
.allSatisfy(s -> assertThat(s)
.contains("\"native\":{\"api\":[1],\"w\":-1,\"h\":-1},\"tagid\":\"pubId_placementId\"}"));
.contains("\"native\":{\"api\":[1]},\"tagid\":\"pubId_placementId\"}"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3084,7 +3084,7 @@ public void validateShouldReturnValidationMessageWhenRequestHaveDuplicatedImpIds
}

private static BidRequest givenBidRequest(
UnaryOperator<Native.NativeBuilder<?, ?>> nativeCustomizer) {
UnaryOperator<Native.NativeBuilder> nativeCustomizer) {
return validBidRequestBuilder()
.imp(singletonList(validImpBuilder()
.xNative(nativeCustomizer.apply(Native.builder()).build()).build())).build();
Expand Down