Search in sources :

Example 1 with PlannerBucketRequest

use of com.microsoft.graph.requests.PlannerBucketRequest in project msgraph-sdk-java by microsoftgraph.

the class PlannerTests method tearDown.

@AfterEach
public 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();
    PlannerTaskRequest taskReq = testBase.graphClient.planner().tasks(planTask.id).buildRequest();
    taskReq.addHeader("If-Match", task.additionalDataManager().get("@odata.etag").getAsString());
    taskReq.delete();
    PlannerBucket bucket = testBase.graphClient.planner().buckets(planBucket.id).buildRequest().get();
    PlannerBucketRequest bucketReq = testBase.graphClient.planner().buckets(planBucket.id).buildRequest();
    bucketReq.addHeader("If-Match", bucket.additionalDataManager().get("@odata.etag").getAsString());
    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();
}
Also used : PlannerTask(com.microsoft.graph.models.PlannerTask) PlannerTaskRequest(com.microsoft.graph.requests.PlannerTaskRequest) PlannerBucket(com.microsoft.graph.models.PlannerBucket) PlannerBucketRequest(com.microsoft.graph.requests.PlannerBucketRequest) AfterEach(org.junit.jupiter.api.AfterEach)

Example 2 with PlannerBucketRequest

use of com.microsoft.graph.requests.PlannerBucketRequest in project msgraph-sdk-java by microsoftgraph.

the class PlannerTests method testDeleteBucket.

@Test
public void testDeleteBucket() {
    PlannerBucket newBucket = new PlannerBucket();
    newBucket.name = "Delete Me";
    newBucket.planId = planId;
    PlannerBucket createdBucket = testBase.graphClient.planner().buckets().buildRequest().post(newBucket);
    PlannerBucketRequest req = testBase.graphClient.planner().buckets(createdBucket.id).buildRequest();
    req.addHeader("If-Match", createdBucket.additionalDataManager().get("@odata.etag").getAsString());
    req.delete();
}
Also used : PlannerBucket(com.microsoft.graph.models.PlannerBucket) PlannerBucketRequest(com.microsoft.graph.requests.PlannerBucketRequest) Test(org.junit.jupiter.api.Test)

Example 3 with PlannerBucketRequest

use of com.microsoft.graph.requests.PlannerBucketRequest in project msgraph-sdk-java by microsoftgraph.

the class PlannerTests method testUpdateBucket.

@Test
public void testUpdateBucket() {
    PlannerBucket patchBucket = new PlannerBucket();
    patchBucket.name = "RenamedBucket";
    PlannerBucketRequest req = prb.buckets(planBucket.id).buildRequest();
    req.addHeader("If-Match", planBucket.additionalDataManager().get("@odata.etag").getAsString());
    req.patch(patchBucket);
    PlannerBucket updatedBucket = prb.buckets(planBucket.id).buildRequest().get();
    assertEquals(patchBucket.name, updatedBucket.name);
    patchBucket.name = "Test Bucket";
    PlannerBucketRequest req2 = testBase.graphClient.planner().buckets(planBucket.id).buildRequest();
    req2.addHeader("If-Match", updatedBucket.additionalDataManager().get("@odata.etag").getAsString());
    req2.patch(patchBucket);
}
Also used : PlannerBucket(com.microsoft.graph.models.PlannerBucket) PlannerBucketRequest(com.microsoft.graph.requests.PlannerBucketRequest) Test(org.junit.jupiter.api.Test)

Example 4 with PlannerBucketRequest

use of com.microsoft.graph.requests.PlannerBucketRequest in project msgraph-beta-sdk-java by microsoftgraph.

the class PlannerTests method tearDown.

@AfterEach
public 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();
    PlannerTaskRequest taskReq = testBase.graphClient.planner().tasks(planTask.id).buildRequest();
    taskReq.addHeader("If-Match", task.additionalDataManager().get("@odata.etag").getAsString());
    taskReq.delete();
    PlannerBucket bucket = testBase.graphClient.planner().buckets(planBucket.id).buildRequest().get();
    PlannerBucketRequest bucketReq = testBase.graphClient.planner().buckets(planBucket.id).buildRequest();
    bucketReq.addHeader("If-Match", bucket.additionalDataManager().get("@odata.etag").getAsString());
    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();
}
Also used : PlannerTask(com.microsoft.graph.models.PlannerTask) PlannerTaskRequest(com.microsoft.graph.requests.PlannerTaskRequest) PlannerBucket(com.microsoft.graph.models.PlannerBucket) PlannerBucketRequest(com.microsoft.graph.requests.PlannerBucketRequest) AfterEach(org.junit.jupiter.api.AfterEach)

Example 5 with PlannerBucketRequest

use of com.microsoft.graph.requests.PlannerBucketRequest in project msgraph-beta-sdk-java by microsoftgraph.

the class PlannerTests method testUpdateBucket.

@Test
public void testUpdateBucket() {
    PlannerBucket patchBucket = new PlannerBucket();
    patchBucket.name = "RenamedBucket";
    PlannerBucketRequest req = prb.buckets(planBucket.id).buildRequest();
    req.addHeader("If-Match", planBucket.additionalDataManager().get("@odata.etag").getAsString());
    req.patch(patchBucket);
    PlannerBucket updatedBucket = prb.buckets(planBucket.id).buildRequest().get();
    assertEquals(patchBucket.name, updatedBucket.name);
    patchBucket.name = "Test Bucket";
    PlannerBucketRequest req2 = testBase.graphClient.planner().buckets(planBucket.id).buildRequest();
    req2.addHeader("If-Match", updatedBucket.additionalDataManager().get("@odata.etag").getAsString());
    req2.patch(patchBucket);
}
Also used : PlannerBucket(com.microsoft.graph.models.PlannerBucket) PlannerBucketRequest(com.microsoft.graph.requests.PlannerBucketRequest) Test(org.junit.jupiter.api.Test)

Aggregations

PlannerBucket (com.microsoft.graph.models.PlannerBucket)6 PlannerBucketRequest (com.microsoft.graph.requests.PlannerBucketRequest)6 Test (org.junit.jupiter.api.Test)4 PlannerTask (com.microsoft.graph.models.PlannerTask)2 PlannerTaskRequest (com.microsoft.graph.requests.PlannerTaskRequest)2 AfterEach (org.junit.jupiter.api.AfterEach)2