EntryPointResources { @POST @Path("/{id : .+}/try-commit-pending") @Produces(MediaType.TEXT_PLAIN) public String tryCommitPending(@Auth final User user, @PathParam("id") String id) { TryCommitPendingConfigurationEvent event = new TryCommitPendingConfigurationEvent(CorrelationId.newCorrelationId(), new EntryPointKeyDefaultImpl(id)); tryCommitPendingConfigurationSubscriber.onNext(event); return "Request posted, look info to follow actions"; } EntryPointResources(EntryPointRepository repository, HaproxyResources haproxyResources,
                               Subscriber<AutoReloadConfigEvent> autoReloadConfigSubscriber,
                               Subscriber<AddEntryPointEvent> addEntryPointSubscriber,
                               Subscriber<UpdateEntryPointEvent> updateEntryPointSubscriber,
                               Subscriber<DeleteEntryPointEvent> deleteEntryPointSubscriber,
                               Subscriber<TryCommitPendingConfigurationEvent> tryCommitPendingConfigurationSubscriber,
                               Subscriber<TryCommitCurrentConfigurationEvent> tryCommitCurrentConfigurationSubscriber,
                               Subscriber<RegisterServerEvent> registerServerSubscriber,
                               Subscriber<CommitCompletedEvent> commitSuccessSubscriber,
                               Subscriber<CommitFailedEvent> commitFailureSubscriber); @GET @Timed Set<String> getEntryPoints(@Auth final User user); @GET @Path("/{id : .+}/autoreload") Boolean isAutoreloaded(@Auth final User user, @PathParam("id") String entryPointKey); @PATCH @Path("/{id : .+}/autoreload/swap") void swapAutoReload(@Auth final User user, @Suspended AsyncResponse asyncResponse, @PathParam("id") String key); @PUT @Path("/{id : .+}") @Timed void addEntryPoint(@Auth final User user, @Suspended AsyncResponse asyncResponse, @PathParam("id") String key, @Valid EntryPointMappingJson configuration); @PATCH @Path("/{id : .+}") @Timed void updateEntryPoint(@Auth final User user, @Suspended AsyncResponse asyncResponse, @PathParam("id") String id, @Valid UpdatedEntryPointMappingJson updatedConfiguration); @GET @Path("/{id : .+}/current") @Timed EntryPointMappingJson getCurrent(@Auth final User user, @PathParam("id") String id); @DELETE @Path("/{id : .+}") @Timed Response deleteEntrypoint(@Auth final User user, @PathParam("id") String id); @GET @Path("/{id : .+}/pending") @Timed EntryPointMappingJson getPending(@Auth final User user, @PathParam("id") String id); @GET @Path("/{id : .+}/committing") @Timed EntryPointMappingJson getCommitting(@Auth final User user, @PathParam("id") String id); @POST @Path("/{id : .+}/try-commit-current") @Produces(MediaType.TEXT_PLAIN) String tryCommitCurrent(@Auth final User user, @PathParam("id") String id); @POST @Path("/{id : .+}/try-commit-pending") @Produces(MediaType.TEXT_PLAIN) String tryCommitPending(@Auth final User user, @PathParam("id") String id); @POST @Path("/{id : .+}/backend/{backend}/register-server") @Produces(MediaType.TEXT_PLAIN) String registerServer( @Auth final User user, 
    							@PathParam("id") String id,
                                 @PathParam("backend") String backend,
                                 IncomingEntryPointBackendServerJsonRepresentation serverJson); @POST @Path("/{id : .+}/send-commit-success/{correlationId}") @Produces(MediaType.TEXT_PLAIN) String sendCommitSuccess(@Auth final User user, 
    									@PathParam("id") String id, @PathParam("correlationId") String correlationId); @POST @Path("/{id : .+}/send-commit-failure/{correlationId}") @Produces(MediaType.TEXT_PLAIN) String sendCommitFailure(@Auth final User user,
    									@PathParam("id") String id, @PathParam("correlationId") String correlationId);  }
@Test public void try_commit_pending_entry_point_should_send_event_to_subscriber() throws Exception { String entryPointKey = "entryPointKey"; @SuppressWarnings("unchecked") ArgumentCaptor<TryCommitPendingConfigurationEvent> tryCommitPendingEntryPointCaptor = ArgumentCaptor.forClass(TryCommitPendingConfigurationEvent.class); String result = entryPointResources.tryCommitPending(USER_PROD, entryPointKey); assertThat(result).isNotNull(); verify(tryCommitPendingConfigurationSubscriber).onNext(tryCommitPendingEntryPointCaptor.capture()); assertThat(tryCommitPendingEntryPointCaptor.getValue().getKey().getID()).isEqualTo(entryPointKey); }