Search in sources :

Example 36 with TargetDeliveryRequest

use of com.adobe.target.edge.client.model.TargetDeliveryRequest in project target-java-sdk by adobe.

the class UserParamsCollatorTest method testSafariMac.

@Test
public void testSafariMac() {
    String userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Safari/605.1.15";
    TargetDeliveryRequest request = requestWithUserAgent(userAgent);
    Map<String, Object> result = collator.collateParams(request, pageLoad);
    assertEquals("safari", result.get(UserParamsCollator.USER_BROWSER_TYPE));
    assertEquals("13", result.get(UserParamsCollator.USER_BROWSER_VERSION));
    assertEquals("mac", result.get(UserParamsCollator.USER_PLATFORM));
}
Also used : TargetDeliveryRequest(com.adobe.target.edge.client.model.TargetDeliveryRequest) Test(org.junit.jupiter.api.Test)

Example 37 with TargetDeliveryRequest

use of com.adobe.target.edge.client.model.TargetDeliveryRequest in project target-java-sdk by adobe.

the class UserParamsCollatorTest method testFirefoxWindows.

@Test
public void testFirefoxWindows() {
    String userAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0";
    TargetDeliveryRequest request = requestWithUserAgent(userAgent);
    Map<String, Object> result = collator.collateParams(request, pageLoad);
    assertEquals("firefox", result.get(UserParamsCollator.USER_BROWSER_TYPE));
    assertEquals("54", result.get(UserParamsCollator.USER_BROWSER_VERSION));
    assertEquals("windows", result.get(UserParamsCollator.USER_PLATFORM));
}
Also used : TargetDeliveryRequest(com.adobe.target.edge.client.model.TargetDeliveryRequest) Test(org.junit.jupiter.api.Test)

Example 38 with TargetDeliveryRequest

use of com.adobe.target.edge.client.model.TargetDeliveryRequest in project target-java-sdk by adobe.

the class TargetDeliveryRequestTest method testTargetDeliveryRequestWithDefaultProperty.

@Test
void testTargetDeliveryRequestWithDefaultProperty() throws NoSuchFieldException {
    setup(true);
    Context context = getContext();
    PrefetchRequest prefetchRequest = getPrefetchViewsRequest();
    ExecuteRequest executeRequest = getMboxExecuteRequest();
    TargetDeliveryRequest targetDeliveryRequest = TargetDeliveryRequest.builder().context(context).prefetch(prefetchRequest).execute(executeRequest).build();
    TargetDeliveryResponse targetDeliveryResponse = targetJavaClient.getOffers(targetDeliveryRequest);
    DeliveryRequest finalRequest = targetDeliveryResponse.getRequest();
    assertEquals(TEST_PROPERTY_TOKEN, finalRequest.getProperty().getToken());
}
Also used : TargetDeliveryResponse(com.adobe.target.edge.client.model.TargetDeliveryResponse) TargetDeliveryRequest(com.adobe.target.edge.client.model.TargetDeliveryRequest) TargetDeliveryRequest(com.adobe.target.edge.client.model.TargetDeliveryRequest) Test(org.junit.jupiter.api.Test)

Example 39 with TargetDeliveryRequest

use of com.adobe.target.edge.client.model.TargetDeliveryRequest in project target-java-sdk by adobe.

the class TargetDeliveryRequestTest method testWhenNoTelemetryEnabledForServerSide.

@Test
void testWhenNoTelemetryEnabledForServerSide() throws NoSuchFieldException {
    setup(false);
    Context context = getContext();
    PrefetchRequest prefetchRequest = getPrefetchViewsRequest();
    ExecuteRequest executeRequest = getMboxExecuteRequest();
    String nonDefaultToken = "non-default-token";
    TargetDeliveryRequest targetDeliveryRequest = TargetDeliveryRequest.builder().context(context).prefetch(prefetchRequest).execute(executeRequest).property(new Property().token(nonDefaultToken)).decisioningMethod(DecisioningMethod.SERVER_SIDE).build();
    targetJavaClient.getOffers(targetDeliveryRequest);
    TargetDeliveryResponse targetDeliveryResponse = targetJavaClient.getOffers(targetDeliveryRequest);
    assertNotNull(targetDeliveryResponse);
    assertNotNull(targetDeliveryResponse.getRequest());
    assertNull(targetDeliveryResponse.getRequest().getTelemetry());
}
Also used : TargetDeliveryResponse(com.adobe.target.edge.client.model.TargetDeliveryResponse) TargetDeliveryRequest(com.adobe.target.edge.client.model.TargetDeliveryRequest) Test(org.junit.jupiter.api.Test)

Example 40 with TargetDeliveryRequest

use of com.adobe.target.edge.client.model.TargetDeliveryRequest in project target-java-sdk by adobe.

the class TargetDeliveryRequestTest method testTargetDeliveryRequestWithCookies.

@Test
void testTargetDeliveryRequestWithCookies() throws NoSuchFieldException {
    setup(true);
    Context context = getContext();
    PrefetchRequest prefetchRequest = getPrefetchViewsRequest();
    ExecuteRequest executeRequest = getMboxExecuteRequest();
    Map<String, CustomerState> customerIds = getCustomerIds();
    List<Notification> mboxNotifications = getMboxNotifications();
    List<TargetCookie> testCookies = getTestCookies();
    TargetDeliveryRequest targetDeliveryRequest = TargetDeliveryRequest.builder().context(context).prefetch(prefetchRequest).execute(executeRequest).customerIds(customerIds).notifications(mboxNotifications).trackingServer(TEST_TRACKING_SERVER).cookies(testCookies).thirdPartyId(TEST_THIRD_PARTY_ID).build();
    assertEquals(TEST_SESSION_ID, targetDeliveryRequest.getSessionId());
    assertEquals(prefetchRequest, targetDeliveryRequest.getDeliveryRequest().getPrefetch());
    assertEquals(executeRequest, targetDeliveryRequest.getDeliveryRequest().getExecute());
    assertEquals(context, targetDeliveryRequest.getDeliveryRequest().getContext());
    assertEquals(mboxNotifications, targetDeliveryRequest.getDeliveryRequest().getNotifications());
    verifyId(customerIds, targetDeliveryRequest);
    verifyVisitorValues(targetDeliveryRequest);
    verifyAnalyticsValues(targetDeliveryRequest);
    TargetDeliveryResponse targetDeliveryResponse = targetJavaClient.getOffers(targetDeliveryRequest);
    verifyServerStateAndNewCookie(targetDeliveryResponse, TEST_SESSION_ID);
    verifyVisitorState(targetDeliveryResponse, customerIds);
}
Also used : CustomerState(com.adobe.experiencecloud.ecid.visitor.CustomerState) TargetDeliveryResponse(com.adobe.target.edge.client.model.TargetDeliveryResponse) TargetCookie(com.adobe.target.edge.client.model.TargetCookie) TargetDeliveryRequest(com.adobe.target.edge.client.model.TargetDeliveryRequest) Test(org.junit.jupiter.api.Test)

Aggregations

TargetDeliveryRequest (com.adobe.target.edge.client.model.TargetDeliveryRequest)104 Test (org.junit.jupiter.api.Test)89 TargetDeliveryResponse (com.adobe.target.edge.client.model.TargetDeliveryResponse)62 ExecuteRequest (com.adobe.target.delivery.v1.model.ExecuteRequest)24 Context (com.adobe.target.delivery.v1.model.Context)21 PrefetchRequest (com.adobe.target.delivery.v1.model.PrefetchRequest)20 TargetTestDeliveryRequestUtils.getContext (com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getContext)17 TargetTestDeliveryRequestUtils.getMboxExecuteRequest (com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getMboxExecuteRequest)15 TargetTestDeliveryRequestUtils.getTestDeliveryResponse (com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getTestDeliveryResponse)13 TimingTool (com.adobe.target.edge.client.utils.TimingTool)13 DeliveryResponse (com.adobe.target.delivery.v1.model.DeliveryResponse)11 DeliveryRequest (com.adobe.target.delivery.v1.model.DeliveryRequest)10 MboxRequest (com.adobe.target.delivery.v1.model.MboxRequest)10 ArrayList (java.util.ArrayList)10 Map (java.util.Map)10 Property (com.adobe.target.delivery.v1.model.Property)9 OnDeviceDecisioningEvaluation (com.adobe.target.edge.client.model.ondevice.OnDeviceDecisioningEvaluation)9 OnDeviceDecisioningRuleSet (com.adobe.target.edge.client.model.ondevice.OnDeviceDecisioningRuleSet)9 TelemetryEntry (com.adobe.target.delivery.v1.model.TelemetryEntry)6 TargetTestDeliveryRequestUtils.getNoContentDeliveryResponse (com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getNoContentDeliveryResponse)6