diff --git a/src/main/java/org/prebid/server/bidder/README.md b/src/main/java/org/prebid/server/bidder/README.md deleted file mode 100644 index cf64cb872d3..00000000000 --- a/src/main/java/org/prebid/server/bidder/README.md +++ /dev/null @@ -1,23 +0,0 @@ -Please note that some of the bidder adapters require separate authentication parameters -and contracts in order to integrate, as server-to-server integrations pose a greater risk of -accidentally or purposefully misrepresenting the inventory and audience being sold. Please consult the -bidders with whom you would like to integrate on this matter to ensure that the appropriate agreements -are in place to proceed forward. - -The following adapters are fully supported in the Java implementation by the owning exchange: - -- rubicon - -All other adapters have been ported from Go and basic testing has been done. The project team will reach out to the following entities -for review and approval of the ported adapter: - -- adform -- appnexus -- audienceNetwork -- conversant -- ix -- lifestreet -- openx -- pubmatic -- pulsepoint -- sovrn \ No newline at end of file diff --git a/src/main/java/org/prebid/server/bidder/lifestreet/LifestreetBidder.java b/src/main/java/org/prebid/server/bidder/lifestreet/LifestreetBidder.java deleted file mode 100644 index d0379215751..00000000000 --- a/src/main/java/org/prebid/server/bidder/lifestreet/LifestreetBidder.java +++ /dev/null @@ -1,161 +0,0 @@ -package org.prebid.server.bidder.lifestreet; - -import com.fasterxml.jackson.core.type.TypeReference; -import com.iab.openrtb.request.Banner; -import com.iab.openrtb.request.BidRequest; -import com.iab.openrtb.request.Format; -import com.iab.openrtb.request.Imp; -import com.iab.openrtb.response.BidResponse; -import com.iab.openrtb.response.SeatBid; -import io.vertx.core.http.HttpMethod; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.StringUtils; -import org.prebid.server.bidder.Bidder; -import org.prebid.server.bidder.model.BidderBid; -import org.prebid.server.bidder.model.BidderError; -import org.prebid.server.bidder.model.HttpCall; -import org.prebid.server.bidder.model.HttpRequest; -import org.prebid.server.bidder.model.Result; -import org.prebid.server.exception.PreBidException; -import org.prebid.server.json.DecodeException; -import org.prebid.server.json.JacksonMapper; -import org.prebid.server.proto.openrtb.ext.ExtPrebid; -import org.prebid.server.proto.openrtb.ext.request.lifestreet.ExtImpLifestreet; -import org.prebid.server.proto.openrtb.ext.response.BidType; -import org.prebid.server.util.HttpUtil; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * Lifestreet {@link Bidder} implementation. - */ -public class LifestreetBidder implements Bidder { - - private static final TypeReference> LIFESTREET_EXT_TYPE_REFERENCE = new - TypeReference>() { - }; - - private final String endpointUrl; - private final JacksonMapper mapper; - - public LifestreetBidder(String endpointUrl, JacksonMapper mapper) { - this.endpointUrl = HttpUtil.validateUrl(Objects.requireNonNull(endpointUrl)); - this.mapper = Objects.requireNonNull(mapper); - } - - @Override - public Result>> makeHttpRequests(BidRequest bidRequest) { - - final List errors = new ArrayList<>(); - final List> httpRequests = new ArrayList<>(); - for (Imp imp : bidRequest.getImp()) { - try { - validateImp(imp); - final BidRequest outgoingRequest = createRequest(imp, bidRequest); - final String body = mapper.encode(outgoingRequest); - httpRequests.add(HttpRequest.builder() - .method(HttpMethod.POST) - .uri(endpointUrl) - .body(body) - .headers(HttpUtil.headers()) - .payload(outgoingRequest) - .build()); - } catch (PreBidException e) { - errors.add(BidderError.badInput(e.getMessage())); - } - } - - return Result.of(httpRequests, errors); - } - - private static void validateImp(Imp imp) { - if (imp.getBanner() == null && imp.getVideo() == null) { - throw new PreBidException(String.format("Invalid MediaType. Lifestreet supports only Banner and Video. " - + "Ignoring ImpID=%s", imp.getId())); - } - } - - private BidRequest createRequest(Imp imp, BidRequest bidRequest) { - final ExtImpLifestreet extImpLifestreet = parseAndValidateImpExt(imp); - final Imp.ImpBuilder impBuilder = imp.toBuilder(); - impBuilder.tagid(extImpLifestreet.getSlotTag()); - - final Banner banner = imp.getBanner(); - if (banner != null) { - final Banner.BannerBuilder bannerBuilder = banner.toBuilder(); - bannerBuilder.format(null); - - final List formats = banner.getFormat(); - if (CollectionUtils.isNotEmpty(formats)) { - final Format firstFormat = formats.get(0); - bannerBuilder.w(firstFormat.getW()); - bannerBuilder.h(firstFormat.getH()); - } - impBuilder.banner(bannerBuilder.build()); - } - - return bidRequest.toBuilder() - .imp(Collections.singletonList(impBuilder.build())) - .build(); - } - - private ExtImpLifestreet parseAndValidateImpExt(Imp imp) { - ExtImpLifestreet extImpLifestreet; - try { - extImpLifestreet = mapper.mapper().convertValue(imp.getExt(), LIFESTREET_EXT_TYPE_REFERENCE).getBidder(); - } catch (IllegalArgumentException e) { - throw new PreBidException(e.getMessage(), e); - } - - final String slotTag = extImpLifestreet.getSlotTag(); - if (StringUtils.isEmpty(slotTag)) { - throw new PreBidException("Missing slot_tag param"); - } - if (slotTag.split("\\.").length != 2) { - throw new PreBidException(String.format("Invalid slot_tag param '%s'", slotTag)); - } - return extImpLifestreet; - } - - @Override - public Result> makeBids(HttpCall httpCall, BidRequest bidRequest) { - try { - final BidResponse bidResponse = mapper.decodeValue(httpCall.getResponse().getBody(), BidResponse.class); - return Result.withValues(extractBids(httpCall.getRequest().getPayload(), bidResponse)); - } catch (DecodeException | PreBidException e) { - return Result.withError(BidderError.badServerResponse(e.getMessage())); - } - } - - private static List extractBids(BidRequest bidRequest, BidResponse bidResponse) { - return bidResponse == null || CollectionUtils.isEmpty(bidResponse.getSeatbid()) - ? Collections.emptyList() - : bidsFromResponse(bidRequest, bidResponse); - } - - private static List bidsFromResponse(BidRequest bidRequest, BidResponse bidResponse) { - return bidResponse.getSeatbid().stream() - .filter(Objects::nonNull) - .map(SeatBid::getBid) - .filter(Objects::nonNull) - .flatMap(Collection::stream) - .map(bid -> BidderBid.of(bid, getBidType(bid.getImpid(), bidRequest.getImp()), bidResponse.getCur())) - // one bid per request/response - .limit(1) - .collect(Collectors.toList()); - } - - private static BidType getBidType(String impId, List imps) { - for (Imp imp : imps) { - if (imp.getId().equals(impId) && imp.getVideo() != null) { - return BidType.video; - } - } - return BidType.banner; - } -} diff --git a/src/main/java/org/prebid/server/bidder/lifestreet/proto/LifestreetParams.java b/src/main/java/org/prebid/server/bidder/lifestreet/proto/LifestreetParams.java deleted file mode 100644 index 5d1ca9b346b..00000000000 --- a/src/main/java/org/prebid/server/bidder/lifestreet/proto/LifestreetParams.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.prebid.server.bidder.lifestreet.proto; - -import lombok.AllArgsConstructor; -import lombok.Value; - -@AllArgsConstructor(staticName = "of") -@Value -public class LifestreetParams { - - String slotTag; -} diff --git a/src/main/java/org/prebid/server/proto/openrtb/ext/request/lifestreet/ExtImpLifestreet.java b/src/main/java/org/prebid/server/proto/openrtb/ext/request/lifestreet/ExtImpLifestreet.java deleted file mode 100644 index c9225295069..00000000000 --- a/src/main/java/org/prebid/server/proto/openrtb/ext/request/lifestreet/ExtImpLifestreet.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.prebid.server.proto.openrtb.ext.request.lifestreet; - -import lombok.AllArgsConstructor; -import lombok.Value; - -@AllArgsConstructor(staticName = "of") -@Value -public class ExtImpLifestreet { - - String slotTag; -} diff --git a/src/main/java/org/prebid/server/spring/config/bidder/LifestreetConfiguration.java b/src/main/java/org/prebid/server/spring/config/bidder/LifestreetConfiguration.java deleted file mode 100644 index 84fe157cc9a..00000000000 --- a/src/main/java/org/prebid/server/spring/config/bidder/LifestreetConfiguration.java +++ /dev/null @@ -1,51 +0,0 @@ -package org.prebid.server.spring.config.bidder; - -import org.prebid.server.bidder.BidderDeps; -import org.prebid.server.bidder.lifestreet.LifestreetBidder; -import org.prebid.server.json.JacksonMapper; -import org.prebid.server.spring.config.bidder.model.BidderConfigurationProperties; -import org.prebid.server.spring.config.bidder.util.BidderDepsAssembler; -import org.prebid.server.spring.config.bidder.util.UsersyncerCreator; -import org.prebid.server.spring.env.YamlPropertySourceFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; - -import javax.validation.constraints.NotBlank; - -@Configuration -@PropertySource(value = "classpath:/bidder-config/lifestreet.yaml", factory = YamlPropertySourceFactory.class) -public class LifestreetConfiguration { - - private static final String BIDDER_NAME = "lifestreet"; - - @Value("${external-url}") - @NotBlank - private String externalUrl; - - @Autowired - private JacksonMapper mapper; - - @Autowired - @Qualifier("lifestreetConfigurationProperties") - private BidderConfigurationProperties configProperties; - - @Bean("lifestreetConfigurationProperties") - @ConfigurationProperties("adapters.lifestreet") - BidderConfigurationProperties configurationProperties() { - return new BidderConfigurationProperties(); - } - - @Bean - BidderDeps lifestreetBidderDeps() { - return BidderDepsAssembler.forBidder(BIDDER_NAME) - .withConfig(configProperties) - .usersyncerCreator(UsersyncerCreator.create(externalUrl)) - .bidderCreator(config -> new LifestreetBidder(config.getEndpoint(), mapper)) - .assemble(); - } -} diff --git a/src/main/resources/bidder-config/lifestreet.yaml b/src/main/resources/bidder-config/lifestreet.yaml deleted file mode 100644 index 89ba60eccaa..00000000000 --- a/src/main/resources/bidder-config/lifestreet.yaml +++ /dev/null @@ -1,24 +0,0 @@ -adapters: - lifestreet: - enabled: false - endpoint: https://prebid.s2s.lfstmedia.com/adrequest - pbs-enforces-gdpr: true - pbs-enforces-ccpa: true - modifying-vast-xml-allowed: true - deprecated-names: - aliases: {} - meta-info: - maintainer-email: mobile.tech@lifestreet.com - app-media-types: - - banner - site-media-types: - - banner - - video - supported-vendors: - vendor-id: 67 - usersync: - url: https://ads.lfstmedia.com/idsync/137062?synced=1&ttl=1s&rurl= - redirect-url: /setuid?bidder=lifestreet&gdpr={{gdpr}}&gdpr_consent={{gdpr_consent}}&us_privacy={{us_privacy}}&uid=$$visitor_cookie$$ - cookie-family-name: lifestreet - type: redirect - support-cors: false diff --git a/src/main/resources/static/bidder-params/lifestreet.json b/src/main/resources/static/bidder-params/lifestreet.json deleted file mode 100644 index d8acdf7ac04..00000000000 --- a/src/main/resources/static/bidder-params/lifestreet.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema#", - "title": "Lifestreet Adapter Params", - "description": "A schema which validates params accepted by the Lifestreet adapter", - "type": "object", - "properties": { - "slot_tag": { - "type": "string", - "description": "A tag which identifies the ad slot" - } - }, - "required": [ - "slot_tag" - ] -} diff --git a/src/test/java/org/prebid/server/bidder/lifestreet/LifestreetBidderTest.java b/src/test/java/org/prebid/server/bidder/lifestreet/LifestreetBidderTest.java deleted file mode 100644 index 39ed8d69fba..00000000000 --- a/src/test/java/org/prebid/server/bidder/lifestreet/LifestreetBidderTest.java +++ /dev/null @@ -1,336 +0,0 @@ -package org.prebid.server.bidder.lifestreet; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.iab.openrtb.request.Audio; -import com.iab.openrtb.request.Banner; -import com.iab.openrtb.request.BidRequest; -import com.iab.openrtb.request.Format; -import com.iab.openrtb.request.Imp; -import com.iab.openrtb.request.Video; -import com.iab.openrtb.response.Bid; -import com.iab.openrtb.response.BidResponse; -import com.iab.openrtb.response.SeatBid; -import org.junit.Before; -import org.junit.Test; -import org.prebid.server.VertxTest; -import org.prebid.server.bidder.model.BidderBid; -import org.prebid.server.bidder.model.BidderError; -import org.prebid.server.bidder.model.HttpCall; -import org.prebid.server.bidder.model.HttpRequest; -import org.prebid.server.bidder.model.HttpResponse; -import org.prebid.server.bidder.model.Result; -import org.prebid.server.proto.openrtb.ext.ExtPrebid; -import org.prebid.server.proto.openrtb.ext.request.lifestreet.ExtImpLifestreet; - -import java.util.List; -import java.util.function.Function; - -import static java.util.Arrays.asList; -import static java.util.Collections.emptyList; -import static java.util.Collections.singletonList; -import static java.util.function.Function.identity; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; -import static org.prebid.server.proto.openrtb.ext.response.BidType.banner; -import static org.prebid.server.proto.openrtb.ext.response.BidType.video; - -public class LifestreetBidderTest extends VertxTest { - - private static final String ENDPOINT_URL = "https://test.endpoint.com/adrequest"; - - private LifestreetBidder lifestreetBidder; - - @Before - public void setUp() { - lifestreetBidder = new LifestreetBidder(ENDPOINT_URL, jacksonMapper); - } - - @Test - public void creationShouldFailOnInvalidEndpointUrl() { - assertThatIllegalArgumentException().isThrownBy(() -> new LifestreetBidder("invalid_url", jacksonMapper)); - } - - @Test - public void makeHttpRequestsShouldReturnErrorIfImpHasNoBannerOrVideo() { - // given - final BidRequest bidRequest = givenBidRequest( - impBuilder -> impBuilder.banner(null).audio(Audio.builder().build())); - - // when - final Result>> result = lifestreetBidder.makeHttpRequests(bidRequest); - - // then - assertThat(result.getErrors()).hasSize(1) - .containsOnly(BidderError.badInput( - "Invalid MediaType. Lifestreet supports only Banner and Video. Ignoring ImpID=123")); - assertThat(result.getValue()).isEmpty(); - } - - @Test - public void makeHttpRequestsShouldReturnErrorIfImpExtCouldNotBeParsed() { - // given - final BidRequest bidRequest = givenBidRequest( - impBuilder -> impBuilder - .ext(mapper.valueToTree(ExtPrebid.of(null, mapper.createArrayNode())))); - - // when - final Result>> result = lifestreetBidder.makeHttpRequests(bidRequest); - - // then - assertThat(result.getErrors()).hasSize(1); - assertThat(result.getErrors().get(0).getMessage()).startsWith("Cannot deserialize instance"); - assertThat(result.getValue()).isEmpty(); - } - - @Test - public void makeHttpRequestsShouldReturnErrorIfImpExtSlotTagIsNullOrBlank() { - // given - final BidRequest bidRequest = BidRequest.builder() - .imp(asList( - givenImp(impBuilder -> impBuilder - .ext(mapper.valueToTree(ExtPrebid.of(null, ExtImpLifestreet.of(null))))), - givenImp(impBuilder -> impBuilder - .ext(mapper.valueToTree(ExtPrebid.of(null, ExtImpLifestreet.of(""))))))) - .build(); - - // when - final Result>> result = lifestreetBidder.makeHttpRequests(bidRequest); - - // then - assertThat(result.getErrors()).hasSize(2) - .containsOnly(BidderError.badInput("Missing slot_tag param")); - assertThat(result.getValue()).isEmpty(); - } - - @Test - public void makeHttpRequestsShouldReturnErrorIfImpExtSlotTagIsInvalid() { - // given - final BidRequest bidRequest = givenBidRequest( - impBuilder -> impBuilder - .ext(mapper.valueToTree(ExtPrebid.of(null, ExtImpLifestreet.of("invalid.slot.tag"))))); - - // when - final Result>> result = lifestreetBidder.makeHttpRequests(bidRequest); - - // then - assertThat(result.getErrors()).hasSize(1) - .containsOnly(BidderError.badInput("Invalid slot_tag param 'invalid.slot.tag'")); - assertThat(result.getValue()).isEmpty(); - } - - @Test - public void makeHttpRequestsShouldSetImpExtSlotTagToImpTagId() { - // given - final BidRequest bidRequest = givenBidRequest(identity()); - - // when - final Result>> result = lifestreetBidder.makeHttpRequests(bidRequest); - - // then - assertThat(result.getErrors()).isEmpty(); - assertThat(result.getValue()).hasSize(1) - .extracting(httpRequest -> mapper.readValue(httpRequest.getBody(), BidRequest.class)) - .flatExtracting(BidRequest::getImp) - .extracting(Imp::getTagid) - .containsOnly("slot.tag"); - } - - @Test - public void makeHttpRequestsShouldCreateOneRequestPerImp() { - // given - final BidRequest bidRequest = BidRequest.builder() - .imp(asList( - givenImp(identity()), - givenImp(impBuilder -> impBuilder.id("321")))) - .build(); - - // when - final Result>> result = lifestreetBidder.makeHttpRequests(bidRequest); - - // then - assertThat(result.getErrors()).isEmpty(); - assertThat(result.getValue()).hasSize(2) - .extracting(httpRequest -> mapper.readValue(httpRequest.getBody(), BidRequest.class)) - .flatExtracting(BidRequest::getImp) - .extracting(Imp::getId) - .containsOnly("123", "321"); - } - - @Test - public void makeHttpRequestsShouldSetBannerFormatNullIfBannerIsPresent() { - // given - final BidRequest bidRequest = givenBidRequest(impBuilder -> impBuilder - .banner(Banner.builder() - .format(singletonList(Format.builder().w(300).h(250).build())) - .build())); - - // when - final Result>> result = lifestreetBidder.makeHttpRequests(bidRequest); - - // then - assertThat(result.getErrors()).isEmpty(); - assertThat(result.getValue()).hasSize(1) - .extracting(httpRequest -> mapper.readValue(httpRequest.getBody(), BidRequest.class)) - .flatExtracting(BidRequest::getImp) - .extracting(Imp::getBanner) - .extracting(Banner::getFormat) - .containsNull(); - } - - @Test - public void makeHttpRequestsShouldSetBannerWidthAndHeightFromFirstBannerFormatIfPresent() { - // given - final BidRequest bidRequest = givenBidRequest(impBuilder -> impBuilder - .banner(Banner.builder() - .format(singletonList(Format.builder().w(300).h(250).build())) - .build())); - - // when - final Result>> result = lifestreetBidder.makeHttpRequests(bidRequest); - - // then - assertThat(result.getErrors()).isEmpty(); - assertThat(result.getValue()).hasSize(1) - .extracting(httpRequest -> mapper.readValue(httpRequest.getBody(), BidRequest.class)) - .flatExtracting(BidRequest::getImp) - .extracting(Imp::getBanner) - .containsOnly(Banner.builder().w(300).h(250).build()); - } - - @Test - public void makeHttpRequestsShouldNotModifyBannerWidthAndHeightIfFormatIsEmpty() { - // given - final BidRequest bidRequest = givenBidRequest(impBuilder -> impBuilder - .banner(Banner.builder() - .format(emptyList()) - .w(300).h(250) - .build())); - - // when - final Result>> result = lifestreetBidder.makeHttpRequests(bidRequest); - - // then - assertThat(result.getErrors()).isEmpty(); - assertThat(result.getValue()).hasSize(1) - .extracting(httpRequest -> mapper.readValue(httpRequest.getBody(), BidRequest.class)) - .flatExtracting(BidRequest::getImp) - .extracting(Imp::getBanner) - .containsOnly(Banner.builder().w(300).h(250).build()); - } - - @Test - public void makeBidsShouldReturnErrorIfResponseBodyCouldNotBeParsed() { - // given - final HttpCall httpCall = givenHttpCall(null, "invalid"); - - // when - final Result> result = lifestreetBidder.makeBids(httpCall, null); - - // then - assertThat(result.getErrors()).hasSize(1); - assertThat(result.getErrors().get(0).getMessage()).startsWith("Failed to decode: Unrecognized token"); - assertThat(result.getErrors().get(0).getType()).isEqualTo(BidderError.Type.bad_server_response); - assertThat(result.getValue()).isEmpty(); - } - - @Test - public void makeBidsShouldReturnEmptyListIfBidResponseIsNull() throws JsonProcessingException { - // given - final HttpCall httpCall = givenHttpCall(null, - mapper.writeValueAsString(null)); - - // when - final Result> result = lifestreetBidder.makeBids(httpCall, null); - - // then - assertThat(result.getErrors()).isEmpty(); - assertThat(result.getValue()).isEmpty(); - } - - @Test - public void makeBidsShouldReturnEmptyListIfBidResponseSeatBidIsNull() throws JsonProcessingException { - // given - final HttpCall httpCall = givenHttpCall(null, - mapper.writeValueAsString(BidResponse.builder().build())); - - // when - final Result> result = lifestreetBidder.makeBids(httpCall, null); - - // then - assertThat(result.getErrors()).isEmpty(); - assertThat(result.getValue()).isEmpty(); - } - - @Test - public void makeBidsShouldReturnBannerBid() throws JsonProcessingException { - // given - final HttpCall httpCall = givenHttpCall( - givenBidRequest(impBuilder -> impBuilder.id("123") - .banner(Banner.builder().build())), - mapper.writeValueAsString( - givenBidResponse(bidBuilder -> bidBuilder.impid("123")))); - - // when - final Result> result = lifestreetBidder.makeBids(httpCall, null); - - // then - assertThat(result.getErrors()).isEmpty(); - assertThat(result.getValue()) - .containsOnly(BidderBid.of(Bid.builder().impid("123").build(), banner, "USD")); - } - - @Test - public void makeBidsShouldReturnVideoBidIfRequestImpHasVideo() throws JsonProcessingException { - // given - final HttpCall httpCall = givenHttpCall( - givenBidRequest(builder -> builder.id("123") - .video(Video.builder().build()) - .banner(Banner.builder().build())), - mapper.writeValueAsString( - givenBidResponse(bidBuilder -> bidBuilder.impid("123")))); - - // when - final Result> result = lifestreetBidder.makeBids(httpCall, null); - - // then - assertThat(result.getErrors()).isEmpty(); - assertThat(result.getValue()) - .containsOnly(BidderBid.of(Bid.builder().impid("123").build(), video, "USD")); - } - - private static BidRequest givenBidRequest( - Function bidRequestCustomizer, - Function impCustomizer) { - return bidRequestCustomizer.apply(BidRequest.builder() - .imp(singletonList(givenImp(impCustomizer)))) - .build(); - } - - private static BidRequest givenBidRequest(Function impCustomizer) { - return givenBidRequest(identity(), impCustomizer); - } - - private static Imp givenImp(Function impCustomizer) { - return impCustomizer.apply(Imp.builder() - .id("123") - .banner(Banner.builder().build()) - .ext(mapper.valueToTree(ExtPrebid.of(null, ExtImpLifestreet.of("slot.tag"))))) - .build(); - } - - private static BidResponse givenBidResponse(Function bidCustomizer) { - return BidResponse.builder() - .cur("USD") - .seatbid(singletonList(SeatBid.builder() - .bid(singletonList(bidCustomizer.apply(Bid.builder()).build())) - .build())) - .build(); - } - - private static HttpCall givenHttpCall(BidRequest bidRequest, String body) { - return HttpCall.success( - HttpRequest.builder().payload(bidRequest).build(), - HttpResponse.of(200, null, body), - null); - } -} diff --git a/src/test/java/org/prebid/server/it/LifestreetTest.java b/src/test/java/org/prebid/server/it/LifestreetTest.java deleted file mode 100644 index 3a934140b2e..00000000000 --- a/src/test/java/org/prebid/server/it/LifestreetTest.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.prebid.server.it; - -import io.restassured.response.Response; -import org.json.JSONException; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.skyscreamer.jsonassert.JSONAssert; -import org.skyscreamer.jsonassert.JSONCompareMode; -import org.springframework.test.context.junit4.SpringRunner; - -import java.io.IOException; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static io.restassured.RestAssured.given; -import static java.util.Collections.singletonList; - -@RunWith(SpringRunner.class) -public class LifestreetTest extends IntegrationTest { - - private static final String LIFESTREET = "lifestreet"; - - @Test - public void openrtb2AuctionShouldRespondWithBidsFromLifestreet() throws IOException, JSONException { - // given - WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/lifestreet-exchange")) - .withRequestBody(equalToJson(jsonFrom("openrtb2/lifestreet/test-lifestreet-bid-request-1.json"))) - .willReturn(aResponse().withBody(jsonFrom("openrtb2/lifestreet/test-lifestreet-bid-response-1.json")))); - - WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/lifestreet-exchange")) - .withRequestBody(equalToJson(jsonFrom("openrtb2/lifestreet/test-lifestreet-bid-request-2.json"))) - .willReturn(aResponse().withBody(jsonFrom("openrtb2/lifestreet/test-lifestreet-bid-response-2.json")))); - - // when - final Response response = given(SPEC) - .header("Referer", "http://www.example.com") - .header("X-Forwarded-For", "193.168.244.1") - .header("User-Agent", "userAgent") - .header("Origin", "http://www.example.com") - // this uids cookie value stands for {"uids":{"lifestreet":"LS-UID"}} - .cookie("uids", "eyJ1aWRzIjp7ImxpZmVzdHJlZXQiOiJMUy1VSUQifX0=") - .body(jsonFrom("openrtb2/lifestreet/test-auction-lifestreet-request.json")) - .post("/openrtb2/auction"); - - // then - final String expectedAuctionResponse = openrtbAuctionResponseFrom( - "openrtb2/lifestreet/test-auction-lifestreet-response.json", - response, singletonList(LIFESTREET)); - - JSONAssert.assertEquals(expectedAuctionResponse, response.asString(), JSONCompareMode.NON_EXTENSIBLE); - } -} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/lifestreet/test-auction-lifestreet-request.json b/src/test/resources/org/prebid/server/it/openrtb2/lifestreet/test-auction-lifestreet-request.json deleted file mode 100644 index cdbdcc41a8f..00000000000 --- a/src/test/resources/org/prebid/server/it/openrtb2/lifestreet/test-auction-lifestreet-request.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "id": "tid", - "imp": [ - { - "id": "impId7", - "banner": { - "format": [ - { - "w": 300, - "h": 600 - } - ], - "w": 300, - "h": 600 - }, - "ext": { - "lifestreet": { - "slot_tag": "slot.tag" - } - } - }, - { - "id": "impId71", - "video": { - "mimes": [ - "mimes" - ], - "w": 300, - "h": 600 - }, - "ext": { - "lifestreet": { - "slot_tag": "slot.tag" - } - } - } - ], - "device": { - "pxratio": 4.2, - "dnt": 2, - "language": "en", - "ifa": "ifaId" - }, - "site": { - "publisher": { - "id": "publisherId" - } - }, - "at": 1, - "tmax": 5000, - "cur": [ - "USD" - ], - "source": { - "fd": 1, - "tid": "tid" - }, - "ext": { - "prebid": { - "targeting": { - "pricegranularity": { - "precision": 2, - "ranges": [ - { - "max": 20, - "increment": 0.1 - } - ] - } - }, - "auctiontimestamp": 1000 - } - }, - "user": { - "ext": { - "consent": "consentValue" - } - }, - "regs": { - "ext": { - "gdpr": 0 - } - } -} \ No newline at end of file diff --git a/src/test/resources/org/prebid/server/it/openrtb2/lifestreet/test-auction-lifestreet-response.json b/src/test/resources/org/prebid/server/it/openrtb2/lifestreet/test-auction-lifestreet-response.json deleted file mode 100644 index 0ab80193b83..00000000000 --- a/src/test/resources/org/prebid/server/it/openrtb2/lifestreet/test-auction-lifestreet-response.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "id": "tid", - "seatbid": [ - { - "bid": [ - { - "id": "847761866", - "impid": "impId7", - "price": 4.75, - "adm": "adm7", - "crid": "crid7", - "w": 300, - "h": 600, - "ext": { - "prebid": { - "type": "banner", - "targeting": { - "hb_bidder_lifestreet": "lifestreet", - "hb_pb": "4.70", - "hb_size_lifestreet": "300x600", - "hb_size": "300x600", - "hb_pb_lifestreet": "4.70", - "hb_bidder": "lifestreet" - } - }, - "origbidcpm": 4.75 - } - }, - { - "id": "791858127", - "impid": "impId71", - "price": 3.75, - "adm": "adm71", - "crid": "crid71", - "w": 300, - "h": 600, - "ext": { - "prebid": { - "type": "video", - "targeting": { - "hb_bidder_lifestreet": "lifestreet", - "hb_pb": "3.70", - "hb_size_lifestreet": "300x600", - "hb_size": "300x600", - "hb_pb_lifestreet": "3.70", - "hb_bidder": "lifestreet" - } - }, - "origbidcpm": 3.75 - } - } - ], - "seat": "lifestreet", - "group": 0 - } - ], - "cur": "USD", - "ext": { - "responsetimemillis": { - "lifestreet": "{{ lifestreet.response_time_ms }}" - }, - "prebid": { - "auctiontimestamp": 1000 - }, - "tmaxrequest": 5000 - } -} diff --git a/src/test/resources/org/prebid/server/it/openrtb2/lifestreet/test-lifestreet-bid-request-1.json b/src/test/resources/org/prebid/server/it/openrtb2/lifestreet/test-lifestreet-bid-request-1.json deleted file mode 100644 index 54852e10129..00000000000 --- a/src/test/resources/org/prebid/server/it/openrtb2/lifestreet/test-lifestreet-bid-request-1.json +++ /dev/null @@ -1,78 +0,0 @@ -{ - "id": "tid", - "imp": [ - { - "id": "impId7", - "banner": { - "w": 300, - "h": 600 - }, - "tagid": "slot.tag", - "ext": { - "bidder": { - "slot_tag": "slot.tag" - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com", - "publisher": { - "id": "publisherId", - "domain": "example.com" - }, - "ext": { - "amp": 0 - } - }, - "device": { - "ua": "userAgent", - "dnt": 2, - "ip": "193.168.244.1", - "pxratio": 4.2, - "language": "en", - "ifa": "ifaId" - }, - "user": { - "buyeruid": "LS-UID", - "ext": { - "consent": "consentValue" - } - }, - "at": 1, - "tmax": 5000, - "cur": [ - "USD" - ], - "source": { - "fd": 1, - "tid": "tid" - }, - "regs": { - "ext": { - "gdpr": 0 - } - }, - "ext": { - "prebid": { - "targeting": { - "pricegranularity": { - "precision": 2, - "ranges": [ - { - "max": 20, - "increment": 0.1 - } - ] - }, - "includewinners": true, - "includebidderkeys": true - }, - "auctiontimestamp": 1000, - "channel": { - "name": "web" - } - } - } -} \ No newline at end of file diff --git a/src/test/resources/org/prebid/server/it/openrtb2/lifestreet/test-lifestreet-bid-request-2.json b/src/test/resources/org/prebid/server/it/openrtb2/lifestreet/test-lifestreet-bid-request-2.json deleted file mode 100644 index 4e3c40007a5..00000000000 --- a/src/test/resources/org/prebid/server/it/openrtb2/lifestreet/test-lifestreet-bid-request-2.json +++ /dev/null @@ -1,81 +0,0 @@ -{ - "id": "tid", - "imp": [ - { - "id": "impId71", - "video": { - "mimes": [ - "mimes" - ], - "w": 300, - "h": 600 - }, - "tagid": "slot.tag", - "ext": { - "bidder": { - "slot_tag": "slot.tag" - } - } - } - ], - "site": { - "domain": "www.example.com", - "page": "http://www.example.com", - "publisher": { - "id": "publisherId", - "domain": "example.com" - }, - "ext": { - "amp": 0 - } - }, - "device": { - "ua": "userAgent", - "dnt": 2, - "ip": "193.168.244.1", - "pxratio": 4.2, - "language": "en", - "ifa": "ifaId" - }, - "user": { - "buyeruid": "LS-UID", - "ext": { - "consent": "consentValue" - } - }, - "at": 1, - "tmax": 5000, - "cur": [ - "USD" - ], - "source": { - "fd": 1, - "tid": "tid" - }, - "regs": { - "ext": { - "gdpr": 0 - } - }, - "ext": { - "prebid": { - "targeting": { - "pricegranularity": { - "precision": 2, - "ranges": [ - { - "max": 20, - "increment": 0.1 - } - ] - }, - "includewinners": true, - "includebidderkeys": true - }, - "auctiontimestamp": 1000, - "channel": { - "name": "web" - } - } - } -} \ No newline at end of file diff --git a/src/test/resources/org/prebid/server/it/openrtb2/lifestreet/test-lifestreet-bid-response-1.json b/src/test/resources/org/prebid/server/it/openrtb2/lifestreet/test-lifestreet-bid-response-1.json deleted file mode 100644 index 99927d604ae..00000000000 --- a/src/test/resources/org/prebid/server/it/openrtb2/lifestreet/test-lifestreet-bid-response-1.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "id": "bidResponseId7", - "seatbid": [ - { - "bid": [ - { - "id": "847761866", - "impid": "impId7", - "price": 4.75, - "adm": "adm7", - "crid": "crid7", - "w": 300, - "h": 600 - } - ], - "seat": "seatId7", - "group": 0 - } - ] -} \ No newline at end of file diff --git a/src/test/resources/org/prebid/server/it/openrtb2/lifestreet/test-lifestreet-bid-response-2.json b/src/test/resources/org/prebid/server/it/openrtb2/lifestreet/test-lifestreet-bid-response-2.json deleted file mode 100644 index 19abd3f84e8..00000000000 --- a/src/test/resources/org/prebid/server/it/openrtb2/lifestreet/test-lifestreet-bid-response-2.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "id": "bidResponseId71", - "seatbid": [ - { - "bid": [ - { - "id": "791858127", - "impid": "impId71", - "price": 3.75, - "adm": "adm71", - "crid": "crid71", - "w": 300, - "h": 600 - } - ], - "seat": "seatId71", - "group": 0 - } - ] -} \ No newline at end of file diff --git a/src/test/resources/org/prebid/server/it/test-application.properties b/src/test/resources/org/prebid/server/it/test-application.properties index df46ef55c6f..ac374b3a23a 100644 --- a/src/test/resources/org/prebid/server/it/test-application.properties +++ b/src/test/resources/org/prebid/server/it/test-application.properties @@ -216,10 +216,6 @@ adapters.kubient.enabled=true adapters.kubient.endpoint=http://localhost:8090/kubient-exchange adapters.kubient.pbs-enforces-gdpr=true adapters.kubient.usersync.url=//kubient-usersync -adapters.lifestreet.enabled=true -adapters.lifestreet.endpoint=http://localhost:8090/lifestreet-exchange -adapters.lifestreet.pbs-enforces-gdpr=true -adapters.lifestreet.usersync.url=//lifestreet-usersync adapters.lockerdome.enabled=true adapters.lockerdome.endpoint=http://localhost:8090/lockerdome-exchange adapters.lockerdome.pbs-enforces-gdpr=true