Skip to content

Commit

Permalink
Conversant: rebrand to Epsilon (#2654)
Browse files Browse the repository at this point in the history
  • Loading branch information
kim-ng93 authored Dec 6, 2023
1 parent f31ec91 commit eeac9c9
Show file tree
Hide file tree
Showing 16 changed files with 87 additions and 80 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.prebid.server.bidder.conversant;
package org.prebid.server.bidder.epsilon;

import com.fasterxml.jackson.core.type.TypeReference;
import com.iab.openrtb.request.App;
Expand All @@ -22,7 +22,7 @@
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.conversant.ExtImpConversant;
import org.prebid.server.proto.openrtb.ext.request.epsilon.ExtImpEpsilon;
import org.prebid.server.proto.openrtb.ext.response.BidType;
import org.prebid.server.util.BidderUtil;
import org.prebid.server.util.HttpUtil;
Expand All @@ -37,9 +37,9 @@
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class ConversantBidder implements Bidder<BidRequest> {
public class EpsilonBidder implements Bidder<BidRequest> {

private static final TypeReference<ExtPrebid<?, ExtImpConversant>> CONVERSANT_EXT_TYPE_REFERENCE =
private static final TypeReference<ExtPrebid<?, ExtImpEpsilon>> EPSILON_EXT_TYPE_REFERENCE =
new TypeReference<>() {
};

Expand All @@ -59,7 +59,7 @@ public class ConversantBidder implements Bidder<BidRequest> {
private final boolean generateBidId;
private final JacksonMapper mapper;

public ConversantBidder(String endpointUrl, boolean generateBidId, JacksonMapper mapper) {
public EpsilonBidder(String endpointUrl, boolean generateBidId, JacksonMapper mapper) {
this.endpointUrl = HttpUtil.validateUrl(Objects.requireNonNull(endpointUrl));
this.generateBidId = generateBidId;
this.mapper = Objects.requireNonNull(mapper);
Expand All @@ -83,12 +83,12 @@ private BidRequest createOutgoingRequest(BidRequest bidRequest) {
final List<Imp> requestImps = bidRequest.getImp();
for (int i = 0; i < requestImps.size(); i++) {
final Imp imp = requestImps.get(i);
final ExtImpConversant impExt = parseImpExt(imp, i);
final ExtImpEpsilon impExt = parseImpExt(imp, i);
modifiedImps.add(modifyImp(imp, impExt));
}

final Imp firstImp = requestImps.get(0);
final ExtImpConversant extImp = parseImpExt(firstImp, 0);
final ExtImpEpsilon extImp = parseImpExt(firstImp, 0);
final String siteId = extImp.getSiteId();
final Site requestSite = bidRequest.getSite();
final App requestApp = bidRequest.getApp();
Expand All @@ -100,10 +100,10 @@ private BidRequest createOutgoingRequest(BidRequest bidRequest) {
.build();
}

private ExtImpConversant parseImpExt(Imp imp, int impIndex) {
final ExtImpConversant extImp;
private ExtImpEpsilon parseImpExt(Imp imp, int impIndex) {
final ExtImpEpsilon extImp;
try {
extImp = mapper.mapper().convertValue(imp.getExt(), CONVERSANT_EXT_TYPE_REFERENCE).getBidder();
extImp = mapper.mapper().convertValue(imp.getExt(), EPSILON_EXT_TYPE_REFERENCE).getBidder();
} catch (IllegalArgumentException e) {
throw new PreBidException("Impression[%d] missing ext.bidder object".formatted(impIndex));
}
Expand All @@ -122,7 +122,7 @@ private static App updateApp(App app, String siteId) {
return app == null ? null : app.toBuilder().id(siteId).build();
}

private static Imp modifyImp(Imp imp, ExtImpConversant impExt) {
private static Imp modifyImp(Imp imp, ExtImpEpsilon impExt) {
final Banner banner = imp.getBanner();
final Video video = imp.getVideo();

Expand All @@ -148,7 +148,7 @@ private static BigDecimal getBidFloor(BigDecimal impBidFloor, BigDecimal impExtB
: impBidFloor;
}

private static Integer getSecure(Imp imp, ExtImpConversant impExt) {
private static Integer getSecure(Imp imp, ExtImpEpsilon impExt) {
final Integer extSecure = impExt.getSecure();
final Integer impSecure = imp.getSecure();

Expand All @@ -163,7 +163,7 @@ private static Banner modifyBanner(Banner impBanner, Integer extPosition) {
.build();
}

private static Video modifyVideo(Video video, ExtImpConversant impExt) {
private static Video modifyVideo(Video video, ExtImpEpsilon impExt) {
final List<String> extMimes = impExt.getMimes();
final Integer extMaxDuration = impExt.getMaxduration();
final Integer extPosition = impExt.getPosition();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.prebid.server.proto.openrtb.ext.request.conversant;
package org.prebid.server.proto.openrtb.ext.request.epsilon;

import lombok.Builder;
import lombok.Value;
Expand All @@ -8,7 +8,7 @@

@Builder
@Value
public class ExtImpConversant {
public class ExtImpEpsilon {

String siteId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.prebid.server.bidder.BidderDeps;
import org.prebid.server.bidder.conversant.ConversantBidder;
import org.prebid.server.bidder.epsilon.EpsilonBidder;
import org.prebid.server.json.JacksonMapper;
import org.prebid.server.spring.config.bidder.model.BidderConfigurationProperties;
import org.prebid.server.spring.config.bidder.util.BidderDepsAssembler;
Expand All @@ -21,29 +21,29 @@
import javax.validation.constraints.NotNull;

@Configuration
@PropertySource(value = "classpath:/bidder-config/conversant.yaml", factory = YamlPropertySourceFactory.class)
public class ConversantConfiguration {
@PropertySource(value = "classpath:/bidder-config/epsilon.yaml", factory = YamlPropertySourceFactory.class)
public class EpsilonConfiguration {

private static final String BIDDER_NAME = "conversant";
private static final String BIDDER_NAME = "epsilon";

@Bean("conversantConfigurationProperties")
@ConfigurationProperties("adapters.conversant")
ConversantConfigurationProperties configurationProperties() {
return new ConversantConfigurationProperties();
@Bean("epsilonConfigurationProperties")
@ConfigurationProperties("adapters.epsilon")
EpsilonConfigurationProperties configurationProperties() {
return new EpsilonConfigurationProperties();
}

@Bean
BidderDeps conversantBidderDeps(ConversantConfigurationProperties conversantConfigurationProperties,
BidderDeps epsilonBidderDeps(EpsilonConfigurationProperties epsilonConfigurationProperties,
@NotBlank @Value("${external-url}") String externalUrl,
JacksonMapper mapper) {

return BidderDepsAssembler.forBidder(BIDDER_NAME)
.withConfig(conversantConfigurationProperties)
.withConfig(epsilonConfigurationProperties)
.usersyncerCreator(UsersyncerCreator.create(externalUrl))
.bidderCreator(config ->
new ConversantBidder(
new EpsilonBidder(
config.getEndpoint(),
conversantConfigurationProperties.getGenerateBidId(),
epsilonConfigurationProperties.getGenerateBidId(),
mapper))
.assemble();
}
Expand All @@ -52,7 +52,7 @@ BidderDeps conversantBidderDeps(ConversantConfigurationProperties conversantConf
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
private static class ConversantConfigurationProperties extends BidderConfigurationProperties {
private static class EpsilonConfigurationProperties extends BidderConfigurationProperties {

@NotNull
private Boolean generateBidId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
adapters:
conversant:
epsilon:
endpoint: http://api.hb.ad.cpe.dotomi.com/s2s/header/24
aliases:
conversant:
usersync:
cookie-family-name: conversant
meta-info:
maintainer-email: CNVR_PublisherIntegration@conversantmedia.com
maintainer-email: PublisherIntegration@epsilon.com
app-media-types:
- banner
- video
Expand All @@ -12,7 +16,7 @@ adapters:
supported-vendors:
vendor-id: 24
usersync:
cookie-family-name: conversant
cookie-family-name: epsilon
redirect:
url: https://prebid-match.dotomi.com/match/bounce/current?version=1&networkId=72582&gdpr={{gdpr}}&gdpr_consent={{gdpr_consent}}&us_privacy={{us_privacy}}&gpp={{gpp}}&gpp_sid={{gpp_sid}}&rurl={{redirect_url}}
support-cors: false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Conversant Adapter Params",
"description": "A schema which validates params accepted by the Conversant adapter.",
"title": "Epsilon (formerly Conversant) Adapter Params",
"description": "A schema which validates params accepted by the Epsilon (Conversant) adapter.",
"type": "object",
"properties": {
"site_id": {
"type": "string",
"description": "A Conversant specific ID which identifies the site."
"description": "An Epsilon (Conversant) specific ID which identifies the site."
},
"secure": {
"type": "integer",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.prebid.server.bidder.conversant;
package org.prebid.server.bidder.epsilon;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.iab.openrtb.request.App;
Expand All @@ -19,7 +19,7 @@
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.conversant.ExtImpConversant;
import org.prebid.server.proto.openrtb.ext.request.epsilon.ExtImpEpsilon;

import java.math.BigDecimal;
import java.util.Collections;
Expand All @@ -35,18 +35,18 @@
import static org.prebid.server.proto.openrtb.ext.response.BidType.banner;
import static org.prebid.server.proto.openrtb.ext.response.BidType.video;

public class ConversantBidderTest extends VertxTest {
public class EpsilonBidderTest extends VertxTest {

private static final String ENDPOINT_URL = "https://test.endpoint.com";
private static final String UUID_REGEX = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}"
+ "-[0-9a-fA-F]{12}";

private ConversantBidder target = new ConversantBidder(ENDPOINT_URL, false, jacksonMapper);
private EpsilonBidder target = new EpsilonBidder(ENDPOINT_URL, false, jacksonMapper);

@Test
public void creationShouldFailOnInvalidEndpointUrl() {
assertThatIllegalArgumentException()
.isThrownBy(() -> new ConversantBidder("invalid_url", false, jacksonMapper));
.isThrownBy(() -> new EpsilonBidder("invalid_url", false, jacksonMapper));
}

@Test
Expand Down Expand Up @@ -146,7 +146,7 @@ public void makeHttpRequestsShouldSetSiteIdFromExtSiteIdIfSiteIdIsNullOrEmpty()
final BidRequest bidRequest = givenBidRequest(
requestBuilder -> requestBuilder.site(Site.builder().id(null).build()),
impBuilder -> impBuilder.ext(mapper.valueToTree(ExtPrebid.of(null,
ExtImpConversant.builder().mobile(123).siteId("site id").build()))),
ExtImpEpsilon.builder().mobile(123).siteId("site id").build()))),
identity());

// when
Expand Down Expand Up @@ -595,7 +595,7 @@ public void makeBidsShouldReturnVideoBidIfRequestImpHasVideo() throws JsonProces
@Test
public void makeBidsShouldUpdateBidWithUUIDIfGenerateBidIdIsTrue() throws JsonProcessingException {
// given
target = new ConversantBidder(ENDPOINT_URL, true, jacksonMapper);
target = new EpsilonBidder(ENDPOINT_URL, true, jacksonMapper);
final BidderCall<BidRequest> httpCall = givenHttpCall(
givenBidRequest(builder -> builder.id("123")
.banner(Banner.builder().build())),
Expand Down Expand Up @@ -655,8 +655,8 @@ public void makeHttpRequestsShouldNotSetImpBidFloorFromImpExt() {
private static BidRequest givenBidRequest(
Function<BidRequest.BidRequestBuilder, BidRequest.BidRequestBuilder> bidRequestCustomizer,
Function<Imp.ImpBuilder, Imp.ImpBuilder> impCustomizer,
Function<ExtImpConversant.ExtImpConversantBuilder,
ExtImpConversant.ExtImpConversantBuilder> extCustomizer) {
Function<ExtImpEpsilon.ExtImpEpsilonBuilder,
ExtImpEpsilon.ExtImpEpsilonBuilder> extCustomizer) {

return bidRequestCustomizer.apply(BidRequest.builder()
.imp(singletonList(givenImp(impCustomizer, extCustomizer))))
Expand All @@ -669,21 +669,21 @@ private static BidRequest givenBidRequest(Function<Imp.ImpBuilder, Imp.ImpBuilde

private static BidRequest givenBidRequest(
Function<Imp.ImpBuilder, Imp.ImpBuilder> impCustomizer,
Function<ExtImpConversant.ExtImpConversantBuilder,
ExtImpConversant.ExtImpConversantBuilder> extCustomizer) {
Function<ExtImpEpsilon.ExtImpEpsilonBuilder,
ExtImpEpsilon.ExtImpEpsilonBuilder> extCustomizer) {

return givenBidRequest(identity(), impCustomizer, extCustomizer);
}

private static Imp givenImp(
Function<Imp.ImpBuilder, Imp.ImpBuilder> impCustomizer,
Function<ExtImpConversant.ExtImpConversantBuilder,
ExtImpConversant.ExtImpConversantBuilder> extCustomizer) {
Function<ExtImpEpsilon.ExtImpEpsilonBuilder,
ExtImpEpsilon.ExtImpEpsilonBuilder> extCustomizer) {

return impCustomizer.apply(Imp.builder()
.id("123")
.ext(mapper.valueToTree(ExtPrebid.of(null,
extCustomizer.apply(ExtImpConversant.builder().siteId("site id")).build()))))
extCustomizer.apply(ExtImpEpsilon.builder().siteId("site id")).build()))))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,41 +17,41 @@
import static java.util.Collections.singletonList;

@RunWith(SpringRunner.class)
public class ConversantTest extends IntegrationTest {
public class EpsilonTest extends IntegrationTest {

private static final String CONVERSANT = "conversant";
private static final String CONVERSANT_ALIAS = "conversantAlias";
private static final String EPSILON = "epsilon";
private static final String EPSILON_ALIAS = "conversant";

@Test
public void openrtb2AuctionShouldRespondWithBidsFromConversant() throws IOException, JSONException {
public void openrtb2AuctionShouldRespondWithBidsFromEpsilon() throws IOException, JSONException {
// given
WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/conversant-exchange"))
.withRequestBody(equalToJson(jsonFrom("openrtb2/conversant/test-conversant-bid-request.json")))
.willReturn(aResponse().withBody(jsonFrom("openrtb2/conversant/test-conversant-bid-response.json"))));
WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/epsilon-exchange"))
.withRequestBody(equalToJson(jsonFrom("openrtb2/epsilon/test-epsilon-bid-request.json")))
.willReturn(aResponse().withBody(jsonFrom("openrtb2/epsilon/test-epsilon-bid-response.json"))));

// when
final Response response = responseFor("openrtb2/conversant/test-auction-conversant-request.json",
final Response response = responseFor("openrtb2/epsilon/test-auction-epsilon-request.json",
Endpoint.openrtb2_auction);

// then
assertJsonEquals("openrtb2/conversant/test-auction-conversant-response.json", response,
singletonList(CONVERSANT));
assertJsonEquals("openrtb2/epsilon/test-auction-epsilon-response.json", response,
singletonList(EPSILON));
}

@Test
public void openrtb2AuctionShouldRespondWithBidsFromConversantAlias() throws IOException, JSONException {
public void openrtb2AuctionShouldRespondWithBidsFromConversant() throws IOException, JSONException {
// given
WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/conversant-exchange"))
.withRequestBody(equalToJson(jsonFrom("openrtb2/conversant/alias/test-conversant-bid-request.json")))
WIRE_MOCK_RULE.stubFor(post(urlPathEqualTo("/epsilon-exchange"))
.withRequestBody(equalToJson(jsonFrom("openrtb2/epsilon/alias/test-epsilon-bid-request.json")))
.willReturn(aResponse().withBody(
jsonFrom("openrtb2/conversant/alias/test-conversant-bid-response.json"))));
jsonFrom("openrtb2/epsilon/alias/test-epsilon-bid-response.json"))));

// when
final Response response = responseFor("openrtb2/conversant/alias/test-auction-conversant-request.json",
final Response response = responseFor("openrtb2/epsilon/alias/test-auction-epsilon-request.json",
Endpoint.openrtb2_auction);

// then
assertJsonEquals("openrtb2/conversant/alias/test-auction-conversant-response.json", response,
asList(CONVERSANT, CONVERSANT_ALIAS));
assertJsonEquals("openrtb2/epsilon/alias/test-auction-epsilon-response.json", response,
asList(EPSILON, EPSILON_ALIAS));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"h": 600
},
"ext": {
"conversantAlias": {
"conversant": {
"site_id": "site_id"
}
}
Expand All @@ -17,15 +17,18 @@
"tmax": 5000,
"ext": {
"prebid": {
"aliases": {
"conversantAlias": "conversant"
"conversant": {
"site_id": "site_id"
},
"auctiontimestamp": 0
}
},
"aliases": {
"conversant": "epsilon"
},
"regs": {
"ext": {
"gdpr": 0
}
}
}
}
Loading

0 comments on commit eeac9c9

Please sign in to comment.