1414import org .mockito .Mock ;
1515import org .mockito .junit .jupiter .MockitoExtension ;
1616import org .prebid .server .activity .Activity ;
17- import org .prebid .server .activity .infrastructure .ActivityController ;
1817import org .prebid .server .activity .infrastructure .ActivityInfrastructure ;
19- import org .prebid .server .activity .infrastructure .debug .ActivityInfrastructureDebug ;
2018import org .prebid .server .auction .model .AuctionContext ;
2119import org .prebid .server .auction .privacy .enforcement .mask .UserFpdActivityMask ;
2220import org .prebid .server .hooks .execution .v1 .auction .AuctionInvocationContextImpl ;
3533import org .prebid .server .vertx .httpclient .model .HttpClientResponse ;
3634
3735import java .util .List ;
38- import java .util .Map ;
3936import java .util .concurrent .TimeoutException ;
4037
4138import static java .util .Collections .singletonList ;
@@ -60,12 +57,18 @@ public class LiveIntentOmniChannelIdentityProcessedAuctionRequestHookTest {
6057 @ Mock
6158 private HttpClient httpClient ;
6259
63- @ Mock
64- private ActivityInfrastructureDebug activityInfrastructureDebug ;
65-
6660 @ Mock (strictness = LENIENT )
6761 private LiveIntentOmniChannelProperties properties ;
6862
63+ @ Mock
64+ private ActivityInfrastructure activityInfrastructure ;
65+
66+ @ Mock
67+ private AuctionInvocationContext auctionInvocationContext ;
68+
69+ @ Mock
70+ private AuctionContext auctionContext ;
71+
6972 private LiveIntentOmniChannelIdentityProcessedAuctionRequestHook target ;
7073
7174 @ BeforeEach
@@ -75,6 +78,10 @@ public void setUp() {
7578 given (properties .getAuthToken ()).willReturn ("auth_token" );
7679 given (properties .getTreatmentRate ()).willReturn (1.0f );
7780
81+ given (auctionInvocationContext .auctionContext ()).willReturn (auctionContext );
82+ given (auctionContext .getActivityInfrastructure ()).willReturn (activityInfrastructure );
83+ given (activityInfrastructure .isAllowed (any (), any ())).willReturn (true );
84+
7885 target = new LiveIntentOmniChannelIdentityProcessedAuctionRequestHook (
7986 properties , userFpdActivityMask , MAPPER , httpClient , 0.01d );
8087 }
@@ -134,20 +141,8 @@ public void geoPassingRestrictionShouldBeRespected() {
134141 given (httpClient .post (any (), any (), any (), anyLong ()))
135142 .willReturn (Future .succeededFuture (HttpClientResponse .of (200 , null , responseBody )));
136143
137- final ActivityController activityController = ActivityController .of (
138- false , List .of (), activityInfrastructureDebug );
139-
140- final ActivityInfrastructure givenActivityInfrastructure = new ActivityInfrastructure (
141- Map .of (Activity .TRANSMIT_TID , activityController ,
142- Activity .TRANSMIT_UFPD , activityController ),
143- activityInfrastructureDebug );
144-
145- final AuctionInvocationContext auctionInvocationContext = AuctionInvocationContextImpl .of (
146- null ,
147- AuctionContext .builder ().activityInfrastructure (givenActivityInfrastructure ).build (),
148- false ,
149- null ,
150- null );
144+ given (activityInfrastructure .isAllowed (eq (Activity .TRANSMIT_GEO ), any ())).willReturn (false );
145+ given (activityInfrastructure .isAllowed (eq (Activity .TRANSMIT_UFPD ), any ())).willReturn (false );
151146
152147 // when
153148 final InvocationResult <AuctionRequestPayload > result =
@@ -177,20 +172,8 @@ public void tidPassingRestrictionShouldBeRespected() {
177172 given (httpClient .post (any (), any (), any (), anyLong ()))
178173 .willReturn (Future .succeededFuture (HttpClientResponse .of (200 , null , responseBody )));
179174
180- final ActivityController activityController = ActivityController .of (
181- false , List .of (), activityInfrastructureDebug );
182-
183- final ActivityInfrastructure givenActivityInfrastructure = new ActivityInfrastructure (
184- Map .of (Activity .TRANSMIT_TID , activityController ,
185- Activity .TRANSMIT_UFPD , activityController ),
186- activityInfrastructureDebug );
187-
188- final AuctionInvocationContext auctionInvocationContext = AuctionInvocationContextImpl .of (
189- null ,
190- AuctionContext .builder ().activityInfrastructure (givenActivityInfrastructure ).build (),
191- false ,
192- null ,
193- null );
175+ given (activityInfrastructure .isAllowed (eq (Activity .TRANSMIT_TID ), any ())).willReturn (false );
176+ given (activityInfrastructure .isAllowed (eq (Activity .TRANSMIT_UFPD ), any ())).willReturn (false );
194177
195178 // when
196179 final InvocationResult <AuctionRequestPayload > result =
@@ -222,20 +205,8 @@ public void eidPassingRestrictionShouldBeRespected() {
222205 given (httpClient .post (any (), any (), any (), anyLong ()))
223206 .willReturn (Future .succeededFuture (HttpClientResponse .of (200 , null , responseBody )));
224207
225- final ActivityController activityController = ActivityController .of (
226- false , List .of (), activityInfrastructureDebug );
227-
228- final ActivityInfrastructure givenActivityInfrastructure = new ActivityInfrastructure (
229- Map .of (Activity .TRANSMIT_EIDS , activityController ,
230- Activity .TRANSMIT_UFPD , activityController ),
231- activityInfrastructureDebug );
232-
233- final AuctionInvocationContext auctionInvocationContext = AuctionInvocationContextImpl .of (
234- null ,
235- AuctionContext .builder ().activityInfrastructure (givenActivityInfrastructure ).build (),
236- false ,
237- null ,
238- null );
208+ given (activityInfrastructure .isAllowed (eq (Activity .TRANSMIT_EIDS ), any ())).willReturn (false );
209+ given (activityInfrastructure .isAllowed (eq (Activity .TRANSMIT_UFPD ), any ())).willReturn (false );
239210
240211 // when
241212 final InvocationResult <AuctionRequestPayload > result =
0 commit comments