Search in sources :

Example 11 with MboxRequest

use of com.adobe.target.delivery.v1.model.MboxRequest in project target-java-sdk by adobe.

the class OnDeviceDecisioningEvaluatorTest method testAllLocalNoRemoteMbox.

@Test
public void testAllLocalNoRemoteMbox() throws JsonProcessingException, NoSuchFieldException {
    OnDeviceDecisioningRuleSet ruleSet = new OnDeviceDecisioningRuleSet();
    List<String> localMboxes = new ArrayList<>();
    localMboxes.add("test");
    localMboxes.add("test2");
    FieldSetter.setField(ruleSet, ruleSet.getClass().getDeclaredField("localMboxes"), localMboxes);
    FieldSetter.setField(ruleSet, ruleSet.getClass().getDeclaredField("remoteMboxes"), new ArrayList<String>());
    String serializedRuleSet = objectMapper.writeValueAsString(ruleSet);
    RuleLoader testRuleLoader = TargetTestDeliveryRequestUtils.getTestRuleLoader(serializedRuleSet);
    evaluator = new OnDeviceDecisioningEvaluator(testRuleLoader);
    TargetDeliveryRequest request = TargetDeliveryRequest.builder().execute(new ExecuteRequest().addMboxesItem(new MboxRequest().name("test")).addMboxesItem(new MboxRequest().name("test2"))).build();
    OnDeviceDecisioningEvaluation evaluation = evaluator.evaluateLocalExecution(request);
    assertTrue(evaluation.isAllLocal());
    assertNull(evaluation.getRemoteMBoxes());
    assertNull(evaluation.getRemoteViews());
}
Also used : ExecuteRequest(com.adobe.target.delivery.v1.model.ExecuteRequest) MboxRequest(com.adobe.target.delivery.v1.model.MboxRequest) ArrayList(java.util.ArrayList) TargetDeliveryRequest(com.adobe.target.edge.client.model.TargetDeliveryRequest) OnDeviceDecisioningRuleSet(com.adobe.target.edge.client.model.ondevice.OnDeviceDecisioningRuleSet) OnDeviceDecisioningEvaluation(com.adobe.target.edge.client.model.ondevice.OnDeviceDecisioningEvaluation) Test(org.junit.jupiter.api.Test)

Aggregations

MboxRequest (com.adobe.target.delivery.v1.model.MboxRequest)11 ExecuteRequest (com.adobe.target.delivery.v1.model.ExecuteRequest)10 TargetDeliveryRequest (com.adobe.target.edge.client.model.TargetDeliveryRequest)10 Test (org.junit.jupiter.api.Test)9 Context (com.adobe.target.delivery.v1.model.Context)6 PrefetchRequest (com.adobe.target.delivery.v1.model.PrefetchRequest)6 TargetTestDeliveryRequestUtils.getContext (com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getContext)6 TargetTestDeliveryRequestUtils.getMboxExecuteRequest (com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getMboxExecuteRequest)5 ArrayList (java.util.ArrayList)4 Telemetry (com.adobe.target.delivery.v1.model.Telemetry)3 OnDeviceDecisioningEvaluation (com.adobe.target.edge.client.model.ondevice.OnDeviceDecisioningEvaluation)3 OnDeviceDecisioningRuleSet (com.adobe.target.edge.client.model.ondevice.OnDeviceDecisioningRuleSet)3 TelemetryEntry (com.adobe.target.delivery.v1.model.TelemetryEntry)2 TargetDeliveryResponse (com.adobe.target.edge.client.model.TargetDeliveryResponse)2 TimingTool (com.adobe.target.edge.client.utils.TimingTool)2 DeliveryRequest (com.adobe.target.delivery.v1.model.DeliveryRequest)1 Notification (com.adobe.target.delivery.v1.model.Notification)1 HashSet (java.util.HashSet)1