use of com.microsoft.graph.models.extensions.PlannerTask in project msgraph-sdk-java by microsoftgraph.
the class PlannerTests method testUpdateTaskDueDate.
// Failing due to millisecond precision off by 1
@Test
public void testUpdateTaskDueDate() throws InterruptedException {
PlannerTask task = new PlannerTask();
task.dueDateTime = Calendar.getInstance();
IPlannerTaskRequest req = prb.tasks(planTask.id).buildRequest();
planTask = prb.tasks(planTask.id).buildRequest().get();
req.addHeader("If-Match", planTask.etag);
req.patch(task);
Thread.sleep(6000);
PlannerTask updatedTask = prb.tasks(planTask.id).buildRequest().get();
updatedTask = prb.tasks(planTask.id).buildRequest().get();
assertEquals(task.dueDateTime, updatedTask.dueDateTime);
}
use of com.microsoft.graph.models.extensions.PlannerTask in project msgraph-sdk-java by microsoftgraph.
the class PlannerTests method testUpdateTaskCategories.
@Test
public void testUpdateTaskCategories() {
PlannerTask task = new PlannerTask();
JsonObject data = new JsonObject();
data.add("category1", new JsonPrimitive(false));
data.add("category2", new JsonPrimitive(true));
data.add("category3", new JsonPrimitive(false));
data.add("category4", new JsonPrimitive(false));
data.add("category5", new JsonPrimitive(false));
data.add("category6", new JsonPrimitive(false));
AdditionalDataManager dataManager = task.additionalDataManager();
dataManager.put("appliedCategories", data);
PlannerTask newTask = prb.tasks(planTask.id).buildRequest().get();
IPlannerTaskRequest req = prb.tasks(planTask.id).buildRequest();
req.addHeader("If-Match", newTask.etag);
req.addHeader("If-None-Match", newTask.etag);
req.addHeader("Prefer", "return=representation");
PlannerTask updatedTask = req.patch(task);
JsonElement appliedCategories = updatedTask.getRawObject().get("appliedCategories");
assertNotNull(appliedCategories);
}
use of com.microsoft.graph.models.extensions.PlannerTask 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;
IPlannerTaskRequest req = prb.tasks(planTask.id).buildRequest();
req.addHeader("If-Match", planTask.etag);
req.patch(task);
Thread.sleep(4000);
PlannerTask updatedTask = prb.tasks(planTask.id).buildRequest().get();
JsonElement createdAssignment = updatedTask.getRawObject().get("assignments").getAsJsonObject().get(me.id);
assertNotNull(createdAssignment);
}
use of com.microsoft.graph.models.extensions.PlannerTask in project msgraph-sdk-java by microsoftgraph.
the class PlannerTests method setUp.
@BeforeClass
public static void setUp() {
testBase = new TestBase();
prb = testBase.graphClient.planner();
PlannerBucket newBucket = new PlannerBucket();
newBucket.name = "Test Bucket";
newBucket.planId = planId;
planBucket = prb.buckets().buildRequest().post(newBucket);
PlannerTask newTask = new PlannerTask();
newTask.title = "Test Task";
newTask.planId = planId;
newTask.bucketId = planBucket.id;
planTask = prb.tasks().buildRequest().post(newTask);
}
use of com.microsoft.graph.models.extensions.PlannerTask in project msgraph-sdk-java by microsoftgraph.
the class PlannerTests method tearDown.
@AfterClass
public static void tearDown() throws InterruptedException {
Thread.sleep(4000);
// This may have updated since we last saw it
PlannerTask task = testBase.graphClient.planner().tasks(planTask.id).buildRequest().get();
IPlannerTaskRequest taskReq = testBase.graphClient.planner().tasks(planTask.id).buildRequest();
taskReq.addHeader("If-Match", task.etag);
taskReq.delete();
PlannerBucket bucket = testBase.graphClient.planner().buckets(planBucket.id).buildRequest().get();
IPlannerBucketRequest bucketReq = testBase.graphClient.planner().buckets(planBucket.id).buildRequest();
bucketReq.addHeader("If-Match", bucket.etag);
bucketReq.delete();
// Fails with 403 Forbidden
// PlannerPlan plan = testBase.graphClient.getPlanner().getPlans(planId).buildRequest().get();
// IPlannerPlanRequest planReq = testBase.graphClient.getPlanner().getPlans(planId).buildRequest();
// planReq.addHeader("If-Match", getEtag(plan.getRawObject()));
// planReq.delete();
}
Aggregations