This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 56d5d644db46afe9ae6072308471da98459959d8 Author: Rene Cordier <rcord...@linagora.com> AuthorDate: Fri Mar 1 12:01:21 2019 +0700 MAILBOX-382 renaming service methods and javadoc fixes --- .../james/webadmin/routes/EventDeadLettersRoutes.java | 18 +++++++++--------- .../service/EventDeadLettersRedeliverTask.java | 3 --- .../webadmin/service/EventDeadLettersService.java | 14 +++++++------- .../webadmin/routes/EventDeadLettersRoutesTest.java | 10 +++++----- 4 files changed, 21 insertions(+), 24 deletions(-) diff --git a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/EventDeadLettersRoutes.java b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/EventDeadLettersRoutes.java index 4fec31b..46b3242 100644 --- a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/EventDeadLettersRoutes.java +++ b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/routes/EventDeadLettersRoutes.java @@ -92,7 +92,7 @@ public class EventDeadLettersRoutes implements Routes { @POST @Path("") - @ApiOperation(value = "Performing operations on all events") + @ApiOperation(value = "Performing action on all events") @ApiImplicitParams({ @ApiImplicitParam( required = true, @@ -100,7 +100,7 @@ public class EventDeadLettersRoutes implements Routes { name = "action", paramType = "query", example = "?action=reDeliver", - value = "Specify the action to perform on all events. For now only 'reDeliver' is supported as an action, " + value = "Specify the action to perform on all events. 'reDeliver' is supported as an action, " + "and its purpose is to attempt a redelivery of all events present in dead letter."), }) @ApiResponses(value = { @@ -114,7 +114,7 @@ public class EventDeadLettersRoutes implements Routes { public TaskIdDto performActionOnAllEvents(Request request, Response response) { assertValidActionParameter(request); - Task task = eventDeadLettersService.createActionOnEventsTask(); + Task task = eventDeadLettersService.redeliverAllEvents(); TaskId taskId = taskManager.submit(task); return TaskIdDto.respond(response, taskId); } @@ -154,7 +154,7 @@ public class EventDeadLettersRoutes implements Routes { @POST @Path("/groups/" + GROUP_PARAM) - @ApiOperation(value = "Performing operations on events of a particular group") + @ApiOperation(value = "Performing action on events of a particular group") @ApiImplicitParams({ @ApiImplicitParam( required = true, @@ -169,7 +169,7 @@ public class EventDeadLettersRoutes implements Routes { name = "action", paramType = "query", example = "?action=reDeliver", - value = "Specify the action to perform on all events of a particular group. For now only 'reDeliver' is supported as an action, " + value = "Specify the action to perform on all events of a particular group. 'reDeliver' is supported as an action, " + "and its purpose is to attempt a redelivery of all events present in dead letter for the specified group."), }) @ApiResponses(value = { @@ -184,7 +184,7 @@ public class EventDeadLettersRoutes implements Routes { Group group = parseGroup(request); assertValidActionParameter(request); - Task task = eventDeadLettersService.createActionOnEventsTask(group); + Task task = eventDeadLettersService.redeliverGroupEvents(group); TaskId taskId = taskManager.submit(task); return TaskIdDto.respond(response, taskId); } @@ -256,7 +256,7 @@ public class EventDeadLettersRoutes implements Routes { @POST @Path("/groups/" + GROUP_PARAM + "/" + EVENT_ID_PARAM) - @ApiOperation(value = "Performing operations on an event") + @ApiOperation(value = "Performing action on an event") @ApiImplicitParams({ @ApiImplicitParam( required = true, @@ -278,7 +278,7 @@ public class EventDeadLettersRoutes implements Routes { name = "action", paramType = "query", example = "?action=reDeliver", - value = "Specify the action to perform on an unique event. For now only 'reDeliver' is supported as an action, " + value = "Specify the action to perform on an unique event. 'reDeliver' is supported as an action, " + "and its purpose is to attempt a redelivery of the specified event."), }) @ApiResponses(value = { @@ -295,7 +295,7 @@ public class EventDeadLettersRoutes implements Routes { Event.EventId eventId = parseEventId(request); assertValidActionParameter(request); - Task task = eventDeadLettersService.createActionOnEventsTask(group, eventId); + Task task = eventDeadLettersService.redeliverSingleEvent(group, eventId); TaskId taskId = taskManager.submit(task); return TaskIdDto.respond(response, taskId); } diff --git a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/EventDeadLettersRedeliverTask.java b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/EventDeadLettersRedeliverTask.java index ea5553c..6d38495 100644 --- a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/EventDeadLettersRedeliverTask.java +++ b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/EventDeadLettersRedeliverTask.java @@ -23,8 +23,6 @@ import java.util.Optional; import java.util.concurrent.atomic.AtomicLong; import java.util.function.Supplier; -import javax.inject.Inject; - import org.apache.james.mailbox.events.Event; import org.apache.james.mailbox.events.EventBus; import org.apache.james.mailbox.events.EventDeadLetters; @@ -66,7 +64,6 @@ public class EventDeadLettersRedeliverTask implements Task { private final AtomicLong successfulRedeliveriesCount; private final AtomicLong failedRedeliveriesCount; - @Inject EventDeadLettersRedeliverTask(EventBus eventBus, EventDeadLetters deadLetters, Supplier<Flux<Tuple2<Group, Event>>> groupsWithEvents) { this.eventBus = eventBus; this.deadLetters = deadLetters; diff --git a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/EventDeadLettersService.java b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/EventDeadLettersService.java index e9ea848..639e322 100644 --- a/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/EventDeadLettersService.java +++ b/server/protocols/webadmin/webadmin-mailbox/src/main/java/org/apache/james/webadmin/service/EventDeadLettersService.java @@ -97,23 +97,23 @@ public class EventDeadLettersService { .flatMap(event -> Flux.zip(Mono.just(group), Mono.just(event))); } - public Task createActionOnEventsTask() { + public Task redeliverAllEvents() { Supplier<Flux<Tuple2<Group, Event>>> groupsWithEvents = () -> listGroups().flatMap(this::getGroupWithEvents); - return redeliverEvents(groupsWithEvents); + return createRedeliverEventsTask(groupsWithEvents); } - public Task createActionOnEventsTask(Group group) { - return redeliverEvents(() -> getGroupWithEvents(group)); + public Task redeliverGroupEvents(Group group) { + return createRedeliverEventsTask(() -> getGroupWithEvents(group)); } - public Task createActionOnEventsTask(Group group, Event.EventId eventId) { + public Task redeliverSingleEvent(Group group, Event.EventId eventId) { Supplier<Flux<Tuple2<Group, Event>>> groupWithEvent = () -> Flux.just(group).zipWith(getEvent(group, eventId)); - return redeliverEvents(groupWithEvent); + return createRedeliverEventsTask(groupWithEvent); } - private Task redeliverEvents(Supplier<Flux<Tuple2<Group, Event>>> groupsWithEvents) { + private Task createRedeliverEventsTask(Supplier<Flux<Tuple2<Group, Event>>> groupsWithEvents) { return new EventDeadLettersRedeliverTask(eventBus, deadLetters, groupsWithEvents); } } diff --git a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/EventDeadLettersRoutesTest.java b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/EventDeadLettersRoutesTest.java index f4c9e36..e5c2661 100644 --- a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/EventDeadLettersRoutesTest.java +++ b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/EventDeadLettersRoutesTest.java @@ -408,7 +408,7 @@ class EventDeadLettersRoutesTest { } @Test - void postRedeliverAllEventsShouldRedeliverAndRemoveEventFromDeadLetters() { + void postRedeliverAllEventsShouldRemoveEventFromDeadLetters() { deadLetters.store(groupA, EVENT_1).block(); String taskId = with() @@ -433,7 +433,7 @@ class EventDeadLettersRoutesTest { } @Test - void postRedeliverAllEventsShouldRedeliverAndRemoveAllEventsFromDeadLetters() { + void postRedeliverAllEventsShouldRemoveAllEventsFromDeadLetters() { deadLetters.store(groupA, EVENT_1).block(); deadLetters.store(groupA, EVENT_2).block(); deadLetters.store(groupB, EVENT_2).block(); @@ -553,7 +553,7 @@ class EventDeadLettersRoutesTest { } @Test - void postRedeliverGroupEventsShouldRedeliverAndRemoveEventFromDeadLetters() { + void postRedeliverGroupEventsShouldRemoveEventFromDeadLetters() { deadLetters.store(groupA, EVENT_1).block(); String taskId = with() @@ -578,7 +578,7 @@ class EventDeadLettersRoutesTest { } @Test - void postRedeliverGroupEventsShouldRedeliverAndRemoveAllGroupEventsFromDeadLetters() { + void postRedeliverGroupEventsShouldRemoveAllGroupEventsFromDeadLetters() { deadLetters.store(groupA, EVENT_1).block(); deadLetters.store(groupA, EVENT_2).block(); @@ -706,7 +706,7 @@ class EventDeadLettersRoutesTest { } @Test - void postRedeliverSingleEventShouldRedeliverAndRemoveEventFromDeadLetters() { + void postRedeliverSingleEventShouldRemoveEventFromDeadLetters() { deadLetters.store(groupA, EVENT_1).block(); String taskId = with() --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org