Search in sources :

Example 6 with PlannerTaskDetails

use of com.microsoft.graph.models.PlannerTaskDetails in project msgraph-beta-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);
}
Also used : DefaultSerializer(com.microsoft.graph.serializer.DefaultSerializer) PlannerTaskDetails(com.microsoft.graph.models.PlannerTaskDetails) PlannerChecklistItem(com.microsoft.graph.models.PlannerChecklistItem) DefaultLogger(com.microsoft.graph.logger.DefaultLogger) Test(org.junit.jupiter.api.Test)

Example 7 with PlannerTaskDetails

use of com.microsoft.graph.models.PlannerTaskDetails in project msgraph-beta-sdk-java by microsoftgraph.

the class PlannerTests method testGetTaskDetails.

@Test
public void testGetTaskDetails() {
    PlannerTaskDetails details = prb.tasks(planTask.id).details().buildRequest().get();
    assertNotNull(details);
}
Also used : PlannerTaskDetails(com.microsoft.graph.models.PlannerTaskDetails) Test(org.junit.jupiter.api.Test)

Example 8 with PlannerTaskDetails

use of com.microsoft.graph.models.PlannerTaskDetails in project msgraph-beta-sdk-java by microsoftgraph.

the class PlannerTests method testPlannerChecklistItemDeserialization.

@Test
public void testPlannerChecklistItemDeserialization() throws Exception {
    String input = "{\"@odata.context\":\"https://graph.microsoft.com/v1.0/$metadata#planner/tasks('433tZlfn_USJwWRL9khDx8kALTM7')/details/$entity\",\"@odata.etag\":\"W/\\\"JzEtVGFza0RldGFpbHMgQEBAQEBAQEBAQEBAQEBAcCc=\\\"\",\"description\":\"This is a test description of test event two.\",\"previewType\":\"automatic\",\"id\":\"433tZlfn_USJwWRL9khDx8kALTM7\",\"references\":{},\"checklist\":{\"55554\":{\"@odata.type\":\"#microsoft.graph.plannerChecklistItem\",\"isChecked\":false,\"title\":\"Test Item 2\",\"orderHint\":\"8586580527[2\",\"lastModifiedDateTime\":\"2018-11-30T05:01:53.0387892Z\",\"lastModifiedBy\":{\"user\":{\"displayName\":null,\"id\":\"ec786dee-da15-4896-8e73-57141477bae7\"}}},\"91100\":{\"@odata.type\":\"#microsoft.graph.plannerChecklistItem\",\"isChecked\":true,\"title\":\"Test Item 1 \",\"orderHint\":\"8586580528393292964Pc\",\"lastModifiedDateTime\":\"2018-11-30T05:01:47.4138223Z\",\"lastModifiedBy\":{\"user\":{\"displayName\":null,\"id\":\"ec786dee-da15-4896-8e73-57141477bae7\"}}}}}";
    final DefaultSerializer serializer = new DefaultSerializer(new DefaultLogger());
    PlannerTaskDetails ptd = serializer.deserializeObject(input, PlannerTaskDetails.class);
    assertNotNull(ptd);
    PlannerChecklistItem item1 = ptd.checklist.get("91100");
    assertEquals(item1.title, "Test Item 1 ");
    PlannerChecklistItem item2 = ptd.checklist.get("55554");
    assertEquals(item2.title, "Test Item 2");
}
Also used : DefaultSerializer(com.microsoft.graph.serializer.DefaultSerializer) PlannerTaskDetails(com.microsoft.graph.models.PlannerTaskDetails) PlannerChecklistItem(com.microsoft.graph.models.PlannerChecklistItem) DefaultLogger(com.microsoft.graph.logger.DefaultLogger) Test(org.junit.jupiter.api.Test)

Example 9 with PlannerTaskDetails

use of com.microsoft.graph.models.PlannerTaskDetails in project msgraph-sdk-java by microsoftgraph.

the class PlannerTests method testUpdateTaskDetailsChecklist.

@Test
public void testUpdateTaskDetailsChecklist() throws InterruptedException {
    PlannerTaskDetails details = new PlannerTaskDetails();
    String uuid = UUID.randomUUID().toString();
    JsonObject data = new JsonObject();
    Gson gson = new Gson();
    Thread.sleep(2000);
    PlannerChecklistItem checklistItem1 = new PlannerChecklistItem();
    checklistItem1.orderHint = "  !!";
    checklistItem1.isChecked = true;
    checklistItem1.title = "C1";
    JsonElement checklist1Json = gson.toJsonTree(checklistItem1);
    data.add(uuid, checklist1Json);
    PlannerChecklistItem checklistItem2 = new PlannerChecklistItem();
    checklistItem2.orderHint = " !";
    checklistItem2.isChecked = false;
    checklistItem2.title = "C2";
    JsonElement checklist2Json = gson.toJsonTree(checklistItem2);
    data.add(UUID.randomUUID().toString(), checklist2Json);
    PlannerChecklistItem checklistItem3 = new PlannerChecklistItem();
    checklistItem3.orderHint = "   !!!";
    checklistItem3.isChecked = false;
    checklistItem3.title = "C3";
    JsonElement checklist3Json = gson.toJsonTree(checklistItem3);
    data.add(UUID.randomUUID().toString(), checklist3Json);
    AdditionalDataManager dataManager = details.additionalDataManager();
    dataManager.put("checklist", data);
    PlannerTaskDetails d = prb.tasks(planTask.id).details().buildRequest().get();
    PlannerTaskDetailsRequest req = prb.tasks(planTask.id).details().buildRequest();
    req.addHeader("If-Match", d.additionalDataManager().get("@odata.etag").getAsString());
    req.addHeader("If-None-Match", d.additionalDataManager().get("@odata.etag").getAsString());
    req.patch(details);
    Thread.sleep(2000);
    PlannerTask updatedTask = prb.tasks(planTask.id).buildRequest().get();
    int checklistItemCount = updatedTask.additionalDataManager().get("checklistItemCount").getAsInt();
    assertEquals(3, checklistItemCount);
}
Also used : PlannerTask(com.microsoft.graph.models.PlannerTask) AdditionalDataManager(com.microsoft.graph.serializer.AdditionalDataManager) JsonElement(com.google.gson.JsonElement) PlannerTaskDetails(com.microsoft.graph.models.PlannerTaskDetails) JsonObject(com.google.gson.JsonObject) Gson(com.google.gson.Gson) PlannerChecklistItem(com.microsoft.graph.models.PlannerChecklistItem) PlannerTaskDetailsRequest(com.microsoft.graph.requests.PlannerTaskDetailsRequest) Test(org.junit.jupiter.api.Test)

Example 10 with PlannerTaskDetails

use of com.microsoft.graph.models.PlannerTaskDetails in project msgraph-sdk-java by microsoftgraph.

the class PlannerTests method testGetTaskDetails.

@Test
public void testGetTaskDetails() {
    PlannerTaskDetails details = prb.tasks(planTask.id).details().buildRequest().get();
    assertNotNull(details);
}
Also used : PlannerTaskDetails(com.microsoft.graph.models.PlannerTaskDetails) Test(org.junit.jupiter.api.Test)

Aggregations

PlannerTaskDetails (com.microsoft.graph.models.PlannerTaskDetails)14 Test (org.junit.jupiter.api.Test)14 JsonObject (com.google.gson.JsonObject)6 PlannerChecklistItem (com.microsoft.graph.models.PlannerChecklistItem)6 Gson (com.google.gson.Gson)4 JsonElement (com.google.gson.JsonElement)4 DefaultLogger (com.microsoft.graph.logger.DefaultLogger)4 PlannerTaskDetailsRequest (com.microsoft.graph.requests.PlannerTaskDetailsRequest)4 AdditionalDataManager (com.microsoft.graph.serializer.AdditionalDataManager)4 DefaultSerializer (com.microsoft.graph.serializer.DefaultSerializer)4 JsonArray (com.google.gson.JsonArray)2 PlannerExternalReference (com.microsoft.graph.models.PlannerExternalReference)2 PlannerTask (com.microsoft.graph.models.PlannerTask)2