Search in sources :

Example 26 with Property

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

the class TelemetryServiceTest method testTelemetryForHybridServerSideCall.

/**
 * Test case with Hybrid decisioning that gets executed server-side. We are verifying telemetry
 * call for Hybrid decisioning -> server-side execution mode.
 *
 * @throws NoSuchFieldException
 */
@Test
void testTelemetryForHybridServerSideCall() throws NoSuchFieldException {
    setup(true, DecisioningMethod.HYBRID, "testTelemetryForHybridServerSideCall");
    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.HYBRID).build();
    targetJavaClient.getOffers(targetDeliveryRequest);
    verify(telemetryServiceSpy, atLeast(2)).getTelemetry();
    verify(telemetryServiceSpy, times(2)).addTelemetry(any(TargetDeliveryRequest.class), any(TimingTool.class), any(TargetDeliveryResponse.class), any(Double.class), any(Long.class));
    assertEquals(1, telemetryServiceSpy.getTelemetry().getEntries().size());
}
Also used : Context(com.adobe.target.delivery.v1.model.Context) TargetTestDeliveryRequestUtils.getContext(com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getContext) PrefetchRequest(com.adobe.target.delivery.v1.model.PrefetchRequest) TargetTestDeliveryRequestUtils.getMboxExecuteRequest(com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getMboxExecuteRequest) ExecuteRequest(com.adobe.target.delivery.v1.model.ExecuteRequest) TimingTool(com.adobe.target.edge.client.utils.TimingTool) TargetDeliveryResponse(com.adobe.target.edge.client.model.TargetDeliveryResponse) TargetDeliveryRequest(com.adobe.target.edge.client.model.TargetDeliveryRequest) Property(com.adobe.target.delivery.v1.model.Property) Test(org.junit.jupiter.api.Test)

Example 27 with Property

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

the class TelemetryServiceTest method testAddTelemetry.

/**
 * Verify if telemetry data is added correctly
 *
 * @throws NoSuchFieldException
 */
@Test
void testAddTelemetry() throws NoSuchFieldException {
    setup(true, DecisioningMethod.SERVER_SIDE, "testAddTelemetry");
    TimingTool timer = new TimingTool();
    timer.timeStart(TIMING_EXECUTE_REQUEST);
    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();
    DeliveryResponse deliveryResponse = new DeliveryResponse();
    deliveryResponse.setClient("SUMMIT_TEST2021");
    TargetDeliveryResponse targetDeliveryResponse = new TargetDeliveryResponse(targetDeliveryRequest, deliveryResponse, 200, "test call");
    targetDeliveryResponse.getResponse().setRequestId("testID");
    // empty the  in memory stored telemetry
    telemetryServiceSpy.getTelemetry();
    assertEquals(0, telemetryServiceSpy.getTelemetry().getEntries().size());
    telemetryServiceSpy.addTelemetry(targetDeliveryRequest, timer, targetDeliveryResponse);
    assertEquals(1, telemetryServiceSpy.getTelemetry().getEntries().size());
}
Also used : Context(com.adobe.target.delivery.v1.model.Context) TargetTestDeliveryRequestUtils.getContext(com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getContext) PrefetchRequest(com.adobe.target.delivery.v1.model.PrefetchRequest) TargetTestDeliveryRequestUtils.getMboxExecuteRequest(com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getMboxExecuteRequest) ExecuteRequest(com.adobe.target.delivery.v1.model.ExecuteRequest) TimingTool(com.adobe.target.edge.client.utils.TimingTool) TargetDeliveryResponse(com.adobe.target.edge.client.model.TargetDeliveryResponse) TargetDeliveryRequest(com.adobe.target.edge.client.model.TargetDeliveryRequest) TargetDeliveryResponse(com.adobe.target.edge.client.model.TargetDeliveryResponse) TargetTestDeliveryRequestUtils.getNoContentDeliveryResponse(com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getNoContentDeliveryResponse) DeliveryResponse(com.adobe.target.delivery.v1.model.DeliveryResponse) TargetTestDeliveryRequestUtils.getTestDeliveryResponse(com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getTestDeliveryResponse) Property(com.adobe.target.delivery.v1.model.Property) Test(org.junit.jupiter.api.Test)

Example 28 with Property

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

the class TelemetryServiceTest method testExecutionModeForOnDevice.

/**
 * Test to verify telemetryEntry has correct executionMode For ODD & status 200 it should be local
 *
 * @throws NoSuchFieldException
 */
@Test
void testExecutionModeForOnDevice() throws NoSuchFieldException {
    setup(true, DecisioningMethod.ON_DEVICE, "testExecutionModeOnDeviceWhenStatusOK");
    TimingTool timer = new TimingTool();
    timer.timeStart(TIMING_EXECUTE_REQUEST);
    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.ON_DEVICE).build();
    DeliveryResponse deliveryResponse = new DeliveryResponse();
    deliveryResponse.setClient("SUMMIT_TEST2021");
    TargetDeliveryResponse targetDeliveryResponse = new TargetDeliveryResponse(targetDeliveryRequest, deliveryResponse, 200, "test call");
    targetDeliveryResponse.getResponse().setRequestId("testID");
    telemetryServiceSpy.addTelemetry(targetDeliveryRequest, timer, targetDeliveryResponse);
    TelemetryEntry telemetryEntry = telemetryServiceSpy.getTelemetry().getEntries().get(1);
    assert telemetryEntry != null;
    assertEquals(ExecutionMode.LOCAL, telemetryEntry.getMode());
}
Also used : Context(com.adobe.target.delivery.v1.model.Context) TargetTestDeliveryRequestUtils.getContext(com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getContext) PrefetchRequest(com.adobe.target.delivery.v1.model.PrefetchRequest) TargetTestDeliveryRequestUtils.getMboxExecuteRequest(com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getMboxExecuteRequest) ExecuteRequest(com.adobe.target.delivery.v1.model.ExecuteRequest) TimingTool(com.adobe.target.edge.client.utils.TimingTool) TargetDeliveryResponse(com.adobe.target.edge.client.model.TargetDeliveryResponse) TargetDeliveryRequest(com.adobe.target.edge.client.model.TargetDeliveryRequest) TelemetryEntry(com.adobe.target.delivery.v1.model.TelemetryEntry) TargetDeliveryResponse(com.adobe.target.edge.client.model.TargetDeliveryResponse) TargetTestDeliveryRequestUtils.getNoContentDeliveryResponse(com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getNoContentDeliveryResponse) DeliveryResponse(com.adobe.target.delivery.v1.model.DeliveryResponse) TargetTestDeliveryRequestUtils.getTestDeliveryResponse(com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getTestDeliveryResponse) Property(com.adobe.target.delivery.v1.model.Property) Test(org.junit.jupiter.api.Test)

Example 29 with Property

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

the class NotificationService method buildNotifications.

public void buildNotifications(TargetDeliveryRequest targetDeliveryRequest, TargetDeliveryResponse targetDeliveryResponse, List<Notification> notifications) {
    boolean noNotifications = notifications == null || notifications.isEmpty();
    if (noNotifications) {
        return;
    }
    DeliveryRequest deliveryRequest = targetDeliveryRequest.getDeliveryRequest();
    setBeaconToFalse(deliveryRequest);
    String locationHint = targetDeliveryRequest.getLocationHint() != null ? targetDeliveryRequest.getLocationHint() : this.clusterLocator.getLocationHint();
    TargetDeliveryRequest notificationRequest = TargetDeliveryRequest.builder().locationHint(locationHint).sessionId(targetDeliveryRequest.getSessionId()).visitor(targetDeliveryRequest.getVisitor()).decisioningMethod(DecisioningMethod.SERVER_SIDE).requestId(UUID.randomUUID().toString()).impressionId(UUID.randomUUID().toString()).id(deliveryRequest.getId() != null ? deliveryRequest.getId() : targetDeliveryResponse.getResponse().getId()).experienceCloud(deliveryRequest.getExperienceCloud()).context(deliveryRequest.getContext()).environmentId(deliveryRequest.getEnvironmentId()).qaMode(deliveryRequest.getQaMode()).property(deliveryRequest.getProperty()).notifications(notifications).trace(deliveryRequest.getTrace()).build();
    this.sendNotification(notificationRequest);
}
Also used : DeliveryRequest(com.adobe.target.delivery.v1.model.DeliveryRequest) TargetDeliveryRequest(com.adobe.target.edge.client.model.TargetDeliveryRequest) TargetDeliveryRequest(com.adobe.target.edge.client.model.TargetDeliveryRequest)

Example 30 with Property

use of com.adobe.target.delivery.v1.model.Property in project himss_2021_sepsis_detection by redhat-na-ssa.

the class RiskAssessmentUtil method getCode.

public static String getCode(RiskAssessment rAssessment) {
    RiskAssessmentPredictionComponent raPredictionComponent = rAssessment.getPredictionFirstRep();
    Property cProp = raPredictionComponent.getOutcome().getChildByName("coding");
    Coding coding = (Coding) cProp.getValues().get(0);
    String code = coding.getCode();
    log.info("getCode() code = " + code);
    return code;
}
Also used : RiskAssessmentPredictionComponent(org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent) Coding(org.hl7.fhir.r4.model.Coding) Property(org.hl7.fhir.r4.model.Property)

Aggregations

TargetDeliveryRequest (com.adobe.target.edge.client.model.TargetDeliveryRequest)10 Property (com.adobe.target.delivery.v1.model.Property)9 Test (org.junit.jupiter.api.Test)9 Context (com.adobe.target.delivery.v1.model.Context)8 ExecuteRequest (com.adobe.target.delivery.v1.model.ExecuteRequest)8 TargetDeliveryResponse (com.adobe.target.edge.client.model.TargetDeliveryResponse)8 TargetTestDeliveryRequestUtils.getContext (com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getContext)8 TargetTestDeliveryRequestUtils.getMboxExecuteRequest (com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getMboxExecuteRequest)8 TimingTool (com.adobe.target.edge.client.utils.TimingTool)8 PrefetchRequest (com.adobe.target.delivery.v1.model.PrefetchRequest)7 Property (io.adminshell.aas.v3.model.Property)7 DeliveryResponse (com.adobe.target.delivery.v1.model.DeliveryResponse)5 TargetTestDeliveryRequestUtils.getNoContentDeliveryResponse (com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getNoContentDeliveryResponse)5 TargetTestDeliveryRequestUtils.getTestDeliveryResponse (com.adobe.target.edge.client.utils.TargetTestDeliveryRequestUtils.getTestDeliveryResponse)5 ArrayList (java.util.ArrayList)5 TelemetryEntry (com.adobe.target.delivery.v1.model.TelemetryEntry)4 SubmodelElement (io.adminshell.aas.v3.model.SubmodelElement)4 HashMap (java.util.HashMap)4 Property (model.Property)4 Type (model.Type)3