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));
}
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));
}
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());
}
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());
}
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);
}
Aggregations