use of com.microsoft.graph.models.Drive in project msgraph-sdk-java by microsoftgraph.
the class UserTests method meDrive.
@Test
public void meDrive() {
// GET me/drive
final Drive drive = graphServiceClient.me().drive().buildRequest().get();
assertNotNull(drive);
}
use of com.microsoft.graph.models.Drive in project msgraph-sdk-java by microsoftgraph.
the class AdditionalDataTests method testChildAdditionalDataDeserialization.
@Test
public void testChildAdditionalDataDeserialization() {
String source = "{\"@odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#drives/$entity\",\"id\":\"8bf6ae90006c4a4c\",\"driveType\":\"personal\",\"owner\":{\"user\":{\"displayName\":\"Peter\",\"id\":\"8bf6ae90006c4a4c\",\"email\":\"petertest@onmicrosoft.com\"}},\"quota\":{\"deleted\":1485718314,\"remaining\":983887466461,\"state\":\"normal\",\"total\":1142461300736,\"used\":158573834275}}";
Drive result = serializer.deserializeObject(source, Drive.class);
JsonElement email = result.owner.user.additionalDataManager().get("email");
assertEquals("\"petertest@onmicrosoft.com\"", email.toString());
}
use of com.microsoft.graph.models.Drive in project msgraph-beta-sdk-java by microsoftgraph.
the class AdditionalDataTests method testChildAdditionalDataDeserialization.
@Test
public void testChildAdditionalDataDeserialization() {
String source = "{\"@odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#drives/$entity\",\"id\":\"8bf6ae90006c4a4c\",\"driveType\":\"personal\",\"owner\":{\"user\":{\"displayName\":\"Peter\",\"id\":\"8bf6ae90006c4a4c\",\"email\":\"petertest@onmicrosoft.com\"}},\"quota\":{\"deleted\":1485718314,\"remaining\":983887466461,\"state\":\"normal\",\"total\":1142461300736,\"used\":158573834275}}";
Drive result = serializer.deserializeObject(source, Drive.class);
JsonElement email = result.owner.user.additionalDataManager().get("email");
assertEquals("\"petertest@onmicrosoft.com\"", email.toString());
}
use of com.microsoft.graph.models.Drive in project msgraph-sdk-java by microsoftgraph.
the class DefaultSerializerTests method testDriveDeserialization.
/**
* Make sure that deserializing a Drive also returns members from BaseDrive
*
* @throws Exception If there is an exception during the test
*/
@Test
public void testDriveDeserialization() throws Exception {
final DefaultSerializer serializer = new DefaultSerializer(new DefaultLogger());
String source = "{\"@odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#drives/$entity\",\"id\":\"8bf6ae90006c4a4c\",\"driveType\":\"personal\",\"owner\":{\"user\":{\"displayName\":\"Peter\",\"id\":\"8bf6ae90006c4a4c\"}},\"quota\":{\"deleted\":1485718314,\"remaining\":983887466461,\"state\":\"normal\",\"total\":1142461300736,\"used\":158573834275}}";
Drive result = serializer.deserializeObject(source, Drive.class);
assertNotNull(result);
assertEquals("personal", result.driveType);
assertEquals(Long.valueOf(983887466461L), result.quota.remaining);
assertEquals("8bf6ae90006c4a4c", result.id);
}
use of com.microsoft.graph.models.Drive in project msgraph-beta-sdk-java by microsoftgraph.
the class DefaultSerializerTests method testDriveDeserialization.
/**
* Make sure that deserializing a Drive also returns members from BaseDrive
*
* @throws Exception If there is an exception during the test
*/
@Test
public void testDriveDeserialization() throws Exception {
final DefaultSerializer serializer = new DefaultSerializer(new DefaultLogger());
String source = "{\"@odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#drives/$entity\",\"id\":\"8bf6ae90006c4a4c\",\"driveType\":\"personal\",\"owner\":{\"user\":{\"displayName\":\"Peter\",\"id\":\"8bf6ae90006c4a4c\"}},\"quota\":{\"deleted\":1485718314,\"remaining\":983887466461,\"state\":\"normal\",\"total\":1142461300736,\"used\":158573834275}}";
Drive result = serializer.deserializeObject(source, Drive.class);
assertNotNull(result);
assertEquals("personal", result.driveType);
assertEquals(Long.valueOf(983887466461L), result.quota.remaining);
assertEquals("8bf6ae90006c4a4c", result.id);
}
Aggregations