Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/java/org/zendesk/client/v2/Zendesk.java
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,9 @@ public void markTicketAsSpam(long id) {
complete(submit(req("PUT", tmpl("/tickets/{id}/mark_as_spam.json").set("id", id)), handleStatus()));
}

public void deleteTickets(long id, long... ids) {
complete(submit(req("DELETE", tmpl("/tickets/destroy_many.json{?ids}").set("ids", idArray(id, ids))),
handleStatus()));
public JobStatus deleteTickets(long id, long... ids) {
return complete(submit(req("DELETE", tmpl("/tickets/destroy_many.json{?ids}").set("ids", idArray(id, ids))),
handleJobStatus()));
}

public JobStatus permanentlyDeleteTickets(long id, long... ids) {
Expand Down
16 changes: 8 additions & 8 deletions src/test/java/org/zendesk/client/v2/RealSmokeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -617,15 +617,15 @@ public void createPermanentlyDeleteTickets() throws Exception {
final Long[] ticketsIds = tickets.stream().map(Ticket::getId).toArray(Long[]::new);
// when
// We soft delete them
instance.deleteTickets(firstElement(ticketsIds), otherElements(ticketsIds));
waitTicketsDeleted(ticketsIds);
JobStatus softDeleteJobStatus = waitJobCompletion(instance.deleteTickets(firstElement(ticketsIds), otherElements(ticketsIds)));
assertThat("Soft Delete Job is completed", softDeleteJobStatus.getStatus(), is(JobStatus.JobStatusEnum.completed));
// We permanently delete them
JobStatus jobStatus =
JobStatus permDeleteJobStatus =
waitJobCompletion(
instance.permanentlyDeleteTickets(firstElement(ticketsIds), otherElements(ticketsIds)));
// then
assertThat("Job is completed", jobStatus.getStatus(), is(JobStatus.JobStatusEnum.completed));
jobStatus.getResults().forEach(jobResult -> {
assertThat("Job is completed", permDeleteJobStatus.getStatus(), is(JobStatus.JobStatusEnum.completed));
permDeleteJobStatus.getResults().forEach(jobResult -> {
assertThat("The job result has no account_id entry", jobResult.getAccountId(), nullValue());
assertThat("The job result has no action entry", jobResult.getAction(), nullValue());
assertThat("The job result has no details entry", jobResult.getDetails(), nullValue());
Expand Down Expand Up @@ -710,7 +710,7 @@ public void createTickets() throws Exception {
assertThat("A unique ID must be set", id, notNullValue()));
} finally {
// cleanup
instance.deleteTickets(firstElement(createdTicketsIds), otherElements(createdTicketsIds));
waitJobCompletion(instance.deleteTickets(firstElement(createdTicketsIds), otherElements(createdTicketsIds)));
}
}

Expand Down Expand Up @@ -752,7 +752,7 @@ public void updateTickets() throws Exception {
assertThat("The job result has a success entry", jobResult.getSuccess(), is(TRUE));
});
} finally {
instance.deleteTickets(firstElement(ticketsIds), otherElements(ticketsIds));
waitJobCompletion(instance.deleteTickets(firstElement(ticketsIds), otherElements(ticketsIds)));
}
}

Expand Down Expand Up @@ -839,7 +839,7 @@ public void importTickets() throws Exception {
// then
} finally {
// cleanup
instance.deleteTickets(firstElement(createdTicketsIds), otherElements(createdTicketsIds));
waitJobCompletion(instance.deleteTickets(firstElement(createdTicketsIds), otherElements(createdTicketsIds)));
}
}

Expand Down