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

Fix AuctionContext model to be suitable for JSON encoding #1385

Merged
merged 1 commit into from
Jul 21, 2021
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.prebid.server.auction.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.iab.openrtb.request.BidRequest;
import lombok.Builder;
import lombok.Value;
Expand All @@ -22,10 +23,12 @@ public class AuctionContext {

HttpRequestContext httpRequest;

@JsonIgnore
UidsCookie uidsCookie;

BidRequest bidRequest;

@JsonIgnore
Timeout timeout;

Account account;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
import org.prebid.server.VertxTest;
import org.prebid.server.analytics.model.AuctionEvent;
import org.prebid.server.analytics.model.SetuidEvent;
import org.prebid.server.analytics.pubstack.model.PubstackAnalyticsProperties;
import org.prebid.server.auction.model.AuctionContext;
import org.prebid.server.cookie.UidsCookie;
import org.prebid.server.execution.Timeout;
import org.prebid.server.vertx.http.HttpClient;
import org.prebid.server.vertx.http.model.HttpClientResponse;
import org.springframework.test.util.ReflectionTestUtils;
Expand All @@ -22,10 +26,12 @@
import java.util.concurrent.atomic.AtomicReference;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
Expand Down Expand Up @@ -145,6 +151,21 @@ public void handleShouldSendEventsWhenMaxCountEventsBufferExceeds() {
verify(httpClient).request(any(), anyString(), any(), (byte[]) any(), anyLong());
}

@Test
public void handleShouldBeAbleToEncodeAuctionEvent() {
// given
final AuctionEvent event = AuctionEvent.builder()
.auctionContext(AuctionContext.builder()
.uidsCookie(mock(UidsCookie.class))
.timeout(mock(Timeout.class))
.build())
.build();

// when and then
assertThatCode(() -> pubstackEventHandler.handle(event))
.doesNotThrowAnyException();
}

@Test
public void sendEventsShouldSendEventsAndResetSendConditionParameters() {
// given
Expand Down