use of com.microsoft.graph.serializer.DefaultSerializer in project msgraph-beta-sdk-java by microsoftgraph.
the class DefaultSerializerTests method testEnumActionParameterDeserialization.
@Test
public void testEnumActionParameterDeserialization() throws IOException {
final ArrayList<String> users = new ArrayList<String>();
users.add("michael@chambele.onmicrosoft.com");
final EnumSet<MailTipsType> mailtips = EnumSet.of(MailTipsType.MAILBOX_FULL_STATUS, MailTipsType.MAX_MESSAGE_SIZE);
final UserGetMailTipsParameterSet body = UserGetMailTipsParameterSet.newBuilder().withEmailAddresses(users).withMailTipsOptions(mailtips).build();
final DefaultSerializer serializer = new DefaultSerializer(new DefaultLogger());
final String serialized = serializer.serializeObject(body);
assertTrue(serialized.contains("mailboxFullStatus"), "result contains camelCasedValues");
final UserGetMailTipsParameterSet deserialized = serializer.deserializeObject(serialized, UserGetMailTipsParameterSet.class);
assertEquals(2, deserialized.mailTipsOptions.size());
}
use of com.microsoft.graph.serializer.DefaultSerializer in project msgraph-beta-sdk-java by microsoftgraph.
the class DefaultSerializerTests method testDeserializerWhenCasingRespondedByServiceIsWrong.
@Test
public void testDeserializerWhenCasingRespondedByServiceIsWrong() {
final DefaultSerializer serializer = new DefaultSerializer(new DefaultLogger());
final String source = "{\"@odata.context\": \"https://outlook.office.com/api/v2.0/$metadata#Users('e45f52f5-f2dd-4359-abc5-e74f2960b831')/Messages/AAMkAGQ0MjBmNWVkLTYxZjUtNDRmYi05Y2NiLTBlYjIwNzJjNmM1NgBGAAAAAAC6ff7latYeQqu_gLrhSAIhBwCF7iGjpaOmRqVwbZc-xXzwAAAAAAEMAACF7iGjpaOmRqVwbZc-xXzwAABQStA0AAABEgAQAFbGmeisbjtLnQdp7kC_9Fk=/AttachmentSessions/$entity\",\"ExpirationDateTime\": \"2020-10-06T14:23:42.1027521Z\",\"NextExpectedRanges\": [\"5242880\"]}";
final UploadSession result = serializer.deserializeObject(source, UploadSession.class);
assertNotNull(result);
assertNotNull(result.nextExpectedRanges);
assertTrue(result.nextExpectedRanges.size() > 0);
}
use of com.microsoft.graph.serializer.DefaultSerializer in project msgraph-beta-sdk-java by microsoftgraph.
the class DefaultSerializerTests method testDurationDeserialization.
@Test
public void testDurationDeserialization() {
final DefaultSerializer serializer = new DefaultSerializer(new DefaultLogger());
final String source = "{\"streamId\": \"2101\",\"startDateTime\": null,\"endDateTime\": null,\"streamDirection\": \"calleeToCaller\",\"averageAudioDegradation\": null,\"averageJitter\": \"PT0.004S\",\"maxJitter\": \"PT0.007S\",\"averagePacketLossRate\": 0,\"maxPacketLossRate\": 0,\"averageRatioOfConcealedSamples\": 0,\"maxRatioOfConcealedSamples\": null,\"averageRoundTripTime\": \"PT0.024S\",\"maxRoundTripTime\": \"PT0.05S\",\"packetUtilization\": 471,\"averageBandwidthEstimate\": 1174971,\"wasMediaBypassed\": null,\"postForwardErrorCorrectionPacketLossRate\": null,\"averageVideoFrameLossPercentage\": null,\"averageReceivedFrameRate\": null,\"lowFrameRateRatio\": null,\"averageVideoPacketLossRate\": null,\"averageVideoFrameRate\": null,\"lowVideoProcessingCapabilityRatio\": null,\"averageAudioNetworkJitter\": \"PT0.014S\",\"maxAudioNetworkJitter\": \"PT0.022S\"}";
final MediaStream result = serializer.deserializeObject(source, MediaStream.class);
assertNotNull(result);
assertNotNull(result.maxRoundTripTime);
}
use of com.microsoft.graph.serializer.DefaultSerializer in project msgraph-sdk-java by microsoftgraph.
the class PlannerTests method testPlannerTaskDetailsDeserialization.
@Test
public void testPlannerTaskDetailsDeserialization() {
String input = "{\r\n" + " \"references\": {},\r\n" + " \"@odata.etag\": \"W/\\\"JzEtVGFza0RldGFpbHMgQEBAQEBAQEBAQEBAQEBAUCc=\\\"\",\r\n" + " \"description\": null,\r\n" + " \"checklist\": {\r\n" + " \"42660\": {\r\n" + " \"lastModifiedDateTime\": \"2018-10-28T14:29:37.7423391Z\",\r\n" + " \"@odata.type\": \"#microsoft.graph.plannerChecklistItem\",\r\n" + " \"orderHint\": \"8586608699726429822PK\",\r\n" + " \"lastModifiedBy\": {\r\n" + " \"user\": {\r\n" + " \"displayName\": null,\r\n" + " \"id\": \"f3a1dfe8-f2ef-4870-9642-413d468c571c\"\r\n" + " }\r\n" + " },\r\n" + " \"title\": \"Ein Checklisteneintrag\",\r\n" + " \"isChecked\": false\r\n" + " }\r\n" + " },\r\n" + " \"@odata.context\": \"https://graph.microsoft.com/v1.0/$metadata#planner/tasks('C6iIn6oJcEGcLX5XAiKeCZcAOv30')/details/$entity\",\r\n" + " \"previewType\": \"automatic\",\r\n" + " \"id\": \"C6iIn6oJcEGcLX5XAiKeCZcAOv30\"\r\n" + "}";
final DefaultSerializer serializer = new DefaultSerializer(new DefaultLogger());
PlannerTaskDetails ptd = serializer.deserializeObject(input, PlannerTaskDetails.class);
assertNotNull(ptd);
PlannerChecklistItem item = ptd.checklist.get("42660");
assertEquals(item.title, "Ein Checklisteneintrag");
assertEquals(item.isChecked, false);
}
use of com.microsoft.graph.serializer.DefaultSerializer in project msgraph-sdk-java by microsoftgraph.
the class CollectionPageSerializerTests method testEntityCollectionWithSingleValueExtendedProperties.
@Test
public void testEntityCollectionWithSingleValueExtendedProperties() throws Exception {
final String jsonString = "{\"@odata.context\": \"https://graph.microsoft.com/v1.0/$metadata#users('c2e8df37-c6a7-4d88-89b1-feb4f1fda7c5')/events\",\"@odata.nextLink\": \"https://graph.microsoft.com/v1.0/me/events?$skip=10\",\"value\": [{\"@odata.context\": \"https://graph.microsoft.com/v1.0/$metadata#Me/messages/$entity\",\"@odata.id\": \"https://graph.microsoft.com/v1.0/users('ddfcd489-628b-40d7-b48b-57002df800e5@1717622f-1d94-4d0c-9d74-709fad664b77')/messages('AAMkAGE1M2_bs88AACHsLqWAAA=')\",\"@odata.etag\": \"W/\\\"CQAAABYAAACY4MQpaFz9SbqUDe4+bs88AACbyS4H\\\"\",\"id\": \"AAMkAGE1M2_bs88AACHsLqWAAA=\",\"subject\": \"RE: Talk about emergency prep\",\"sender\": {\"emailAddress\": {\"name\": \"Christine Irwin\",\"address\": \"christine@contoso.com\"}},\"from\": null,\"toRecipients\": [{\"emailAddress\": {\"name\": \"Christine Irwin\",\"address\": \"christine@contoso.com\"}}],\"singleValueExtendedProperties@odata.context\": \"https://graph.microsoft.com/v1.0/$metadata#Me/messages('AAMkAGE1M2_bs88AACHsLqWAAA%3D')/singleValueExtendedProperties\",\"singleValueExtendedProperties\": [{\"id\": \"String {66f5a359-4659-4830-9070-00047ec6ac6e} Name Color\",\"value\": \"Green\"}]}]}";
final DefaultSerializer defaultSerializer = new DefaultSerializer(logger);
final EventCollectionResponse events = defaultSerializer.deserializeObject(jsonString, EventCollectionResponse.class);
assertNotNull(events);
assertTrue(events.value.get(0).singleValueExtendedProperties.getCurrentPage().size() > 0);
}
Aggregations