use of com.adobe.target.edge.client.model.TargetDeliveryResponse in project target-java-sdk by adobe.
the class TargetDeliveryRequestLocalMboxTest method testTargetDeliveryLocalRequestWrongBrowserFirefox.
@Test
void testTargetDeliveryLocalRequestWrongBrowserFirefox() throws IOException, NoSuchFieldException {
fileRuleLoader("DECISIONING_PAYLOAD_BROWSER.json", localService);
TargetDeliveryRequest targetDeliveryRequest = localDeliveryRequest("38734fba-262c-4722-b4a3-ac0a93916873", DecisioningMethod.HYBRID, "browser-mbox");
targetDeliveryRequest.getDeliveryRequest().getContext().setUserAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:73.0) Gecko/20100101 Firefox/71.0");
TargetDeliveryResponse targetDeliveryResponse = targetJavaClient.getOffers(targetDeliveryRequest);
List<Option> prefetchOptions = extractOptions(targetDeliveryRequest, targetDeliveryResponse, "browser-mbox");
verifyHTMLContent(prefetchOptions, "<h1>it's firefox</h1>", "B8C2FP2IuBgmeJcDfXHjGpNWHtnQtQrJfmRrQugEa2qCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q==");
}
use of com.adobe.target.edge.client.model.TargetDeliveryResponse in project target-java-sdk by adobe.
the class TargetDeliveryRequestLocalMboxTest method testTargetDeliveryLocalRequestTimeRange2.
@Test
void testTargetDeliveryLocalRequestTimeRange2() throws IOException, NoSuchFieldException {
fileRuleLoader("DECISIONING_PAYLOAD_TIMEFRAME.json", localService);
TargetDeliveryRequest targetDeliveryRequest = localDeliveryRequest("38734fba-262c-4722-b4a3-ac0a93916873", DecisioningMethod.HYBRID, "daterange-mbox");
ParamsCollator specificTimeCollator = TargetTestDeliveryRequestUtils.getSpecificTimeCollator(1583348400000L);
FieldSetter.setField(localService, localService.getClass().getDeclaredField("timeParamsCollator"), specificTimeCollator);
TargetDeliveryResponse targetDeliveryResponse = targetJavaClient.getOffers(targetDeliveryRequest);
List<Option> prefetchOptions = extractOptions(targetDeliveryRequest, targetDeliveryResponse, "daterange-mbox");
verifyHTMLContent(prefetchOptions, "<strong>date range 2 (mar 2 - 6)</strong>", "wQY/V1IOYec8T4fAT5ww7pNWHtnQtQrJfmRrQugEa2qCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q==");
}
use of com.adobe.target.edge.client.model.TargetDeliveryResponse in project target-java-sdk by adobe.
the class TargetDeliveryRequestLocalMboxTest method testTargetDeliveryLocalRequestPriority.
@Test
void testTargetDeliveryLocalRequestPriority() throws IOException, NoSuchFieldException {
fileRuleLoader("DECISIONING_PAYLOAD_PRIORITIES.json", localService);
TargetDeliveryRequest targetDeliveryRequest = localDeliveryRequest("338e3c1e51f7416a8e1ccba4f81acea0.28_0", DecisioningMethod.HYBRID, "kitty");
targetDeliveryRequest.getDeliveryRequest().getContext().setUserAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:73.0) Gecko/20100101 Firefox/71.0");
TargetDeliveryResponse targetDeliveryResponse = targetJavaClient.getOffers(targetDeliveryRequest);
assertEquals(1, targetDeliveryResponse.getResponse().getPrefetch().getMboxes().size());
List<Option> prefetchOptions = extractOptions(targetDeliveryRequest, targetDeliveryResponse, "kitty");
verifyHTMLContent(prefetchOptions, "<div>kitty high with targeting: Firefox</div>", "/DhjxnVDh9heBZ0MrYFLF2qipfsIHvVzTQxHolz2IpSCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q==");
}
use of com.adobe.target.edge.client.model.TargetDeliveryResponse in project target-java-sdk by adobe.
the class TargetDeliveryRequestLocalViewTest method testTargetDeliveryLocalPageLoadViewABBoth.
@Test
void testTargetDeliveryLocalPageLoadViewABBoth() throws IOException, NoSuchFieldException {
fileRuleLoader("DECISIONING_PAYLOAD_PAGELOAD_VEC_AB.json", localService);
TargetDeliveryRequest targetDeliveryRequest = localDeliveryRequest("38734fba-262c-4722-b4a3-ac0a93916877", null, false);
Map<String, String> params = new HashMap<String, String>() {
{
put("jason", "correct");
put("greg", "correct");
}
};
targetDeliveryRequest.getDeliveryRequest().getPrefetch().getPageLoad().setParameters(params);
TargetDeliveryResponse targetDeliveryResponse = targetJavaClient.getOffers(targetDeliveryRequest);
List<Option> options = extractOptions(targetDeliveryRequest, targetDeliveryResponse, null, false);
List<SelectorContent> selectors = new ArrayList<SelectorContent>() {
{
add(new SelectorContent("setHtml", "HTML > BODY > UL:nth-of-type(1) > LI:nth-of-type(1)", "HTML > BODY > UL:nth-of-type(1) > LI:nth-of-type(1)", "greg is correct", "/SXLXTYTqMY5xlnwaQZrEWqipfsIHvVzTQxHolz2IpSCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q=="));
add(new SelectorContent("setStyle", "HTML > BODY > UL:nth-of-type(1) > LI:nth-of-type(1)", "HTML > BODY > UL:nth-of-type(1) > LI:nth-of-type(1)", new HashMap<String, String>() {
{
put("background-color", "rgba(127,255,0,1)");
put("priority", "important");
}
}, "/SXLXTYTqMY5xlnwaQZrEWqipfsIHvVzTQxHolz2IpSCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q=="));
add(new SelectorContent("setHtml", "HTML > BODY > UL:nth-of-type(1) > LI:nth-of-type(2)", "HTML > BODY > UL:nth-of-type(1) > LI:nth-of-type(2)", "jason is correct", "/SXLXTYTqMY5xlnwaQZrEWqipfsIHvVzTQxHolz2IpSCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q=="));
add(new SelectorContent("setStyle", "HTML > BODY > UL:nth-of-type(1) > LI:nth-of-type(2)", "HTML > BODY > UL:nth-of-type(1) > LI:nth-of-type(2)", new HashMap<String, String>() {
{
put("background-color", "rgba(170,255,255,1)");
put("priority", "important");
}
}, "/SXLXTYTqMY5xlnwaQZrEWqipfsIHvVzTQxHolz2IpSCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q=="));
add(new SelectorContent("insertBefore", "HTML > BODY > DIV.offer:eq(0) > IMG:nth-of-type(1)", "HTML > BODY > DIV:nth-of-type(2) > IMG:nth-of-type(1)", "<p id=\"action_insert_15887183492726231\">experience A</p>", "/SXLXTYTqMY5xlnwaQZrEWqipfsIHvVzTQxHolz2IpSCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q=="));
add(new SelectorContent("insertAfter", "HTML > BODY > DIV:nth-of-type(1) > H1:nth-of-type(1)", "HTML > BODY > DIV:nth-of-type(1) > H1:nth-of-type(1)", "<p id=\"action_insert_15882850825432970\">Better to remain silent and be thought a fool than to speak out and remove all doubt.</p>", "6Na6eWan1u0HrN32JDT54GqipfsIHvVzTQxHolz2IpSCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q=="));
add(new SelectorContent("setStyle", "#action_insert_15882850825432970", "#action_insert_15882850825432970", new HashMap<String, String>() {
{
put("background-color", "rgba(255,255,170,1)");
put("priority", "important");
}
}, "6Na6eWan1u0HrN32JDT54GqipfsIHvVzTQxHolz2IpSCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q=="));
}
};
verifyContent(options, selectors);
}
use of com.adobe.target.edge.client.model.TargetDeliveryResponse in project target-java-sdk by adobe.
the class TargetDeliveryRequestLocalViewTest method testTargetDeliveryLocalNamedViewsJason.
@Test
void testTargetDeliveryLocalNamedViewsJason() throws IOException, NoSuchFieldException {
fileRuleLoader("DECISIONING_PAYLOAD_VIEWS.json", localService);
TargetDeliveryRequest targetDeliveryRequest = localDeliveryRequest("38734fba-262c-4722-b4a3-ac0a93916874", Collections.emptyList(), false);
Map<String, String> params = new HashMap<String, String>() {
{
put("jason", "correct");
}
};
targetDeliveryRequest.getDeliveryRequest().getPrefetch().getViews().get(0).setParameters(params);
TargetDeliveryResponse targetDeliveryResponse = targetJavaClient.getOffers(targetDeliveryRequest);
List<Option> contactOptions = extractOptions(targetDeliveryRequest, targetDeliveryResponse, "contact", false);
List<SelectorContent> contactSelectors = new ArrayList<SelectorContent>() {
{
add(new SelectorContent("insertBefore", "#spa-content > P:nth-of-type(1)", "#spa-content > P:nth-of-type(1)", "<div id=\"action_insert_15889714592501888\">Please call Jason immediately</div>", "DKyEy8B6J+arIj6GhXNW/GqipfsIHvVzTQxHolz2IpSCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q=="));
add(new SelectorContent("setStyle", "#spa-content > P:nth-of-type(1)", "#spa-content > P:nth-of-type(1)", new HashMap<String, String>() {
{
put("background-color", "rgba(255,255,170,1)");
put("priority", "important");
}
}, "DKyEy8B6J+arIj6GhXNW/GqipfsIHvVzTQxHolz2IpSCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q=="));
}
};
verifyContent(contactOptions, contactSelectors);
List<Option> homeOptions = extractOptions(targetDeliveryRequest, targetDeliveryResponse, "home", false);
List<SelectorContent> homeSelectors = new ArrayList<SelectorContent>() {
{
add(new SelectorContent("insertAfter", "#spa-content > P:nth-of-type(1)", "#spa-content > P:nth-of-type(1)", "<p id=\"action_insert_15889690271122446\">jason = correct</p>", "ob3/yMzSVllQx2v2P7122GqipfsIHvVzTQxHolz2IpSCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q=="));
add(new SelectorContent("setHtml", "#spa-content > H3:nth-of-type(1)", "#spa-content > H3:nth-of-type(1)", "jason home - exp A", "ob3/yMzSVllQx2v2P7122GqipfsIHvVzTQxHolz2IpSCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q=="));
add(new SelectorContent("insertAfter", "#spa-content > P:nth-of-type(1)", "#spa-content > P:nth-of-type(1)", "<p id=\"action_insert_15889689998702412\">experience A</p>", "ob3/yMzSVllQx2v2P7122GqipfsIHvVzTQxHolz2IpSCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q=="));
add(new SelectorContent("setHtml", "#spa-content > H3:nth-of-type(1)", "#spa-content > H3:nth-of-type(1)", "nobody home - exp A", "ob3/yMzSVllQx2v2P7122GqipfsIHvVzTQxHolz2IpSCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q=="));
add(new SelectorContent("setHtml", "#spa-content > H3:nth-of-type(1)", "#spa-content > H3:nth-of-type(1)", "Home - Experience A", "XQ6HqnRfrxl3ausAjtQJj2qipfsIHvVzTQxHolz2IpSCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q=="));
add(new SelectorContent("setHtml", "#spa-content > P:nth-of-type(1)", "#spa-content > P:nth-of-type(1)", "experience A! Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut rhoncus, magna et dignissim ullamcorper, magna ipsum pharetra velit, vel egestas magna leo interdum urna. Etiam purus massa, accumsan in elit sit amet, posuere maximus augue. Donec non velit sit amet ipsum feugiat aliquet id in metus. Integer a auctor nisl. Donec ac lacinia eros. Proin nisl magna, bibendum ut tellus vitae, mattis laoreet lacus. Pellentesque mauris lorem, scelerisque quis nisi ac, vulputate tincidunt est. Maecenas ex justo, ultrices non neque sed, fermentum maximus diam. Vestibulum at facilisis magna. Ut eu tristique lectus. Proin gravida leo eu fermentum ullamcorper. Suspendisse gravida nibh vitae ultricies ultricies. Donec fermentum, metus id tincidunt dapibus, tellus lacus tristique felis, non posuere nibh ligula sed est.", "XQ6HqnRfrxl3ausAjtQJj2qipfsIHvVzTQxHolz2IpSCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q=="));
}
};
verifyContent(homeOptions, homeSelectors);
}
Aggregations