Search in sources :

Example 1 with PushInstallationLog

use of com.microsoft.azure.mobile.push.ingestion.models.PushInstallationLog in project mobile-center-sdk-android by Microsoft.

the class PushSerializerTest method serialize.

@Test
public void serialize() throws JSONException {
    LogContainer expectedContainer = new LogContainer();
    List<Log> logs = new ArrayList<>();
    {
        PushInstallationLog log = new PushInstallationLog();
        log.setPushToken("TEST");
        logs.add(log);
    }
    expectedContainer.setLogs(logs);
    UUID sid = UUIDUtils.randomUUID();
    for (Log log : logs) {
        log.setSid(sid);
    }
    LogSerializer serializer = new DefaultLogSerializer();
    serializer.addLogFactory(PushInstallationLog.TYPE, new PushInstallationLogFactory());
    String payload = serializer.serializeContainer(expectedContainer);
    LogContainer actualContainer = serializer.deserializeContainer(payload);
    Assert.assertEquals(expectedContainer, actualContainer);
}
Also used : PushInstallationLog(com.microsoft.azure.mobile.push.ingestion.models.PushInstallationLog) Log(com.microsoft.azure.mobile.ingestion.models.Log) PushInstallationLog(com.microsoft.azure.mobile.push.ingestion.models.PushInstallationLog) ArrayList(java.util.ArrayList) LogContainer(com.microsoft.azure.mobile.ingestion.models.LogContainer) DefaultLogSerializer(com.microsoft.azure.mobile.ingestion.models.json.DefaultLogSerializer) LogSerializer(com.microsoft.azure.mobile.ingestion.models.json.LogSerializer) UUID(java.util.UUID) PushInstallationLogFactory(com.microsoft.azure.mobile.push.ingestion.models.json.PushInstallationLogFactory) DefaultLogSerializer(com.microsoft.azure.mobile.ingestion.models.json.DefaultLogSerializer) Test(org.junit.Test)

Example 2 with PushInstallationLog

use of com.microsoft.azure.mobile.push.ingestion.models.PushInstallationLog in project mobile-center-sdk-android by Microsoft.

the class Push method enqueuePushInstallationLog.

/**
     * Enqueue a push installation log.
     *
     * @param pushToken the push token value
     */
private void enqueuePushInstallationLog(@NonNull String pushToken) {
    PushInstallationLog log = new PushInstallationLog();
    log.setPushToken(pushToken);
    mChannel.enqueue(log, PUSH_GROUP);
}
Also used : PushInstallationLog(com.microsoft.azure.mobile.push.ingestion.models.PushInstallationLog)

Aggregations

PushInstallationLog (com.microsoft.azure.mobile.push.ingestion.models.PushInstallationLog)2 Log (com.microsoft.azure.mobile.ingestion.models.Log)1 LogContainer (com.microsoft.azure.mobile.ingestion.models.LogContainer)1 DefaultLogSerializer (com.microsoft.azure.mobile.ingestion.models.json.DefaultLogSerializer)1 LogSerializer (com.microsoft.azure.mobile.ingestion.models.json.LogSerializer)1 PushInstallationLogFactory (com.microsoft.azure.mobile.push.ingestion.models.json.PushInstallationLogFactory)1 ArrayList (java.util.ArrayList)1 UUID (java.util.UUID)1 Test (org.junit.Test)1