use of com.microsoft.graph.requests.PlannerTaskDetailsRequest in project msgraph-sdk-java by microsoftgraph.
the class PlannerTests method testUpdateTaskDetailsReferences.
// Fails due to delay from service
@Test
public void testUpdateTaskDetailsReferences() {
try {
PlannerTaskDetails details = new PlannerTaskDetails();
Gson gson = new Gson();
JsonObject data = new JsonObject();
PlannerExternalReference reference = new PlannerExternalReference();
reference.alias = "Msn";
reference.previewPriority = " !";
reference.type = "Other";
JsonElement referenceJson = gson.toJsonTree(reference);
data.add("http%3A//www%2Emsn%2Ecom", referenceJson);
AdditionalDataManager dataManager = details.additionalDataManager();
dataManager.put("references", 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.addHeader("Prefer", "return=representation");
PlannerTaskDetails updatedTaskDetails = req.patch(details);
Thread.sleep(4000);
updatedTaskDetails = prb.tasks(planTask.id).details().buildRequest().get();
JsonElement obj = updatedTaskDetails.additionalDataManager().get("references");
JsonArray array = new JsonArray();
array.add(obj);
int referencesCount = array.size();
assertEquals(1, referencesCount);
} catch (InterruptedException e) {
}
}
use of com.microsoft.graph.requests.PlannerTaskDetailsRequest in project msgraph-beta-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);
}
use of com.microsoft.graph.requests.PlannerTaskDetailsRequest 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);
}
use of com.microsoft.graph.requests.PlannerTaskDetailsRequest in project msgraph-beta-sdk-java by microsoftgraph.
the class PlannerTests method testUpdateTaskDetailsReferences.
// Fails due to delay from service
@Test
public void testUpdateTaskDetailsReferences() {
try {
PlannerTaskDetails details = new PlannerTaskDetails();
Gson gson = new Gson();
JsonObject data = new JsonObject();
PlannerExternalReference reference = new PlannerExternalReference();
reference.alias = "Msn";
reference.previewPriority = " !";
reference.type = "Other";
JsonElement referenceJson = gson.toJsonTree(reference);
data.add("http%3A//www%2Emsn%2Ecom", referenceJson);
AdditionalDataManager dataManager = details.additionalDataManager();
dataManager.put("references", 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.addHeader("Prefer", "return=representation");
PlannerTaskDetails updatedTaskDetails = req.patch(details);
Thread.sleep(4000);
updatedTaskDetails = prb.tasks(planTask.id).details().buildRequest().get();
JsonElement obj = updatedTaskDetails.additionalDataManager().get("references");
JsonArray array = new JsonArray();
array.add(obj);
int referencesCount = array.size();
assertEquals(1, referencesCount);
} catch (InterruptedException e) {
}
}
Aggregations