Search in sources :

Example 1 with PlannerAssignments

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

the class PlannerTests method testUpdateTask.

// https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/resources/plannerAssignments
@Test
public void testUpdateTask() throws InterruptedException {
    PlannerTask task = new PlannerTask();
    User me = testBase.graphClient.me().buildRequest().get();
    PlannerAssignment assignment = new PlannerAssignment();
    assignment.orderHint = " !";
    PlannerAssignments a2 = new PlannerAssignments();
    a2.put(me.id, assignment);
    task.assignments = a2;
    PlannerTaskRequest req = prb.tasks(planTask.id).buildRequest();
    req.addHeader("If-Match", planTask.additionalDataManager().get("@odata.etag").getAsString());
    req.patch(task);
    Thread.sleep(4000);
    PlannerTask updatedTask = prb.tasks(planTask.id).buildRequest().get();
    JsonElement createdAssignment = updatedTask.additionalDataManager().get("assignments").getAsJsonObject().get(me.id);
    assertNotNull(createdAssignment);
}
Also used : PlannerTask(com.microsoft.graph.models.PlannerTask) PlannerTaskRequest(com.microsoft.graph.requests.PlannerTaskRequest) PlannerAssignments(com.microsoft.graph.models.PlannerAssignments) User(com.microsoft.graph.models.User) JsonElement(com.google.gson.JsonElement) PlannerAssignment(com.microsoft.graph.models.PlannerAssignment) Test(org.junit.jupiter.api.Test)

Example 2 with PlannerAssignments

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

the class AdditionalDataTests method testHashMapChildAnnotationData.

@Test
public void testHashMapChildAnnotationData() {
    PlannerTask task = new PlannerTask();
    task.assignments = new PlannerAssignments();
    PlannerAssignment assignment = new PlannerAssignment();
    assignment.orderHint = "!";
    assignment.additionalDataManager().put("additionalData", new JsonPrimitive("additionalValue"));
    task.assignments.put("id", assignment);
    String serializedObject = serializer.serializeObject(task);
    assertEquals("{\"assignments\":{\"id\":{\"orderHint\":\"!\",\"additionalData\":\"additionalValue\"}}}", serializedObject);
}
Also used : PlannerTask(com.microsoft.graph.models.PlannerTask) PlannerAssignments(com.microsoft.graph.models.PlannerAssignments) JsonPrimitive(com.google.gson.JsonPrimitive) PlannerAssignment(com.microsoft.graph.models.PlannerAssignment) Test(org.junit.jupiter.api.Test)

Example 3 with PlannerAssignments

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

the class AdditionalDataTests method testHashMapChildAnnotationData.

@Test
public void testHashMapChildAnnotationData() {
    PlannerTask task = new PlannerTask();
    task.assignments = new PlannerAssignments();
    PlannerAssignment assignment = new PlannerAssignment();
    assignment.orderHint = "!";
    assignment.additionalDataManager().put("additionalData", new JsonPrimitive("additionalValue"));
    task.assignments.put("id", assignment);
    String serializedObject = serializer.serializeObject(task);
    assertEquals("{\"assignments\":{\"id\":{\"orderHint\":\"!\",\"additionalData\":\"additionalValue\"}}}", serializedObject);
}
Also used : PlannerTask(com.microsoft.graph.models.PlannerTask) PlannerAssignments(com.microsoft.graph.models.PlannerAssignments) JsonPrimitive(com.google.gson.JsonPrimitive) PlannerAssignment(com.microsoft.graph.models.PlannerAssignment) Test(org.junit.jupiter.api.Test)

Example 4 with PlannerAssignments

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

the class PlannerTests method testUpdateTask.

// https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/resources/plannerAssignments
@Test
public void testUpdateTask() throws InterruptedException {
    PlannerTask task = new PlannerTask();
    User me = testBase.graphClient.me().buildRequest().get();
    PlannerAssignment assignment = new PlannerAssignment();
    assignment.orderHint = " !";
    PlannerAssignments a2 = new PlannerAssignments();
    a2.put(me.id, assignment);
    task.assignments = a2;
    PlannerTaskRequest req = prb.tasks(planTask.id).buildRequest();
    req.addHeader("If-Match", planTask.additionalDataManager().get("@odata.etag").getAsString());
    req.patch(task);
    Thread.sleep(4000);
    PlannerTask updatedTask = prb.tasks(planTask.id).buildRequest().get();
    JsonElement createdAssignment = updatedTask.additionalDataManager().get("assignments").getAsJsonObject().get(me.id);
    assertNotNull(createdAssignment);
}
Also used : PlannerTask(com.microsoft.graph.models.PlannerTask) PlannerTaskRequest(com.microsoft.graph.requests.PlannerTaskRequest) PlannerAssignments(com.microsoft.graph.models.PlannerAssignments) User(com.microsoft.graph.models.User) JsonElement(com.google.gson.JsonElement) PlannerAssignment(com.microsoft.graph.models.PlannerAssignment) Test(org.junit.jupiter.api.Test)

Aggregations

PlannerAssignment (com.microsoft.graph.models.PlannerAssignment)4 PlannerAssignments (com.microsoft.graph.models.PlannerAssignments)4 PlannerTask (com.microsoft.graph.models.PlannerTask)4 Test (org.junit.jupiter.api.Test)4 JsonElement (com.google.gson.JsonElement)2 JsonPrimitive (com.google.gson.JsonPrimitive)2 User (com.microsoft.graph.models.User)2 PlannerTaskRequest (com.microsoft.graph.requests.PlannerTaskRequest)2