@Test void testReactivateTimer() { List<Timer> returnedTimers = createTimers(3, false); when(this.tLogic.getTimer(1)).thenReturn(returnedTimers.get(0)); Entity<Timer> entity = Entity.entity(returnedTimers.get(0), MediaType.APPLICATION_JSON); Response response = this.target.path("timers/de.activate/1").request().post(entity); assertThat(response, status(204)); verify(this.tLogic).reactivateTimer(any()); }
@GET @Path("timers/{pathid}") @Produces(MediaType.APPLICATION_JSON) public Timer getTimer(@PathParam("pathid") int timerNumber) { Timer timer; try { timer = this.logic.getTimer(timerNumber); } catch (NoSuchElementException e) { throw new WebApplicationException("there is no timer" + timerNumber, e, Status.NOT_FOUND); } timer.setLink(createTimerPath(timerNumber)); return timer; }
TimerResource implements Resource { @GET @Path("timers/{pathid}") @Produces(MediaType.APPLICATION_JSON) public Timer getTimer(@PathParam("pathid") int timerNumber) { Timer timer; try { timer = this.logic.getTimer(timerNumber); } catch (NoSuchElementException e) { throw new WebApplicationException("there is no timer" + timerNumber, e, Status.NOT_FOUND); } timer.setLink(createTimerPath(timerNumber)); return timer; } }
TimerResource implements Resource { @GET @Path("timers/{pathid}") @Produces(MediaType.APPLICATION_JSON) public Timer getTimer(@PathParam("pathid") int timerNumber) { Timer timer; try { timer = this.logic.getTimer(timerNumber); } catch (NoSuchElementException e) { throw new WebApplicationException("there is no timer" + timerNumber, e, Status.NOT_FOUND); } timer.setLink(createTimerPath(timerNumber)); return timer; }  }
TimerResource implements Resource { @GET @Path("timers/{pathid}") @Produces(MediaType.APPLICATION_JSON) public Timer getTimer(@PathParam("pathid") int timerNumber) { Timer timer; try { timer = this.logic.getTimer(timerNumber); } catch (NoSuchElementException e) { throw new WebApplicationException("there is no timer" + timerNumber, e, Status.NOT_FOUND); } timer.setLink(createTimerPath(timerNumber)); return timer; }  @GET @Path("timers") @Produces(MediaType.APPLICATION_JSON) List<Timer> getAllTimers(); @GET @Path("timers/{pathid}") @Produces(MediaType.APPLICATION_JSON) Timer getTimer(@PathParam("pathid") int timerNumber); @POST @Path("timers/new") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Timer newTimer(Timer timer); @POST @Path("timers/deleteAll") void deleteAllTimers(); @POST @Path("timers/delete/{pathid}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Timer deleteTimer(@PathParam("pathid") int timerNumber); @POST @Path("timers/de.activate/{pathid}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Timer activatedeactivateAlarm(@PathParam("pathid") int timerNumber, Timer timerInc); @Override ResourceEntity getPluginDescripion(); }
TimerResource implements Resource { @GET @Path("timers/{pathid}") @Produces(MediaType.APPLICATION_JSON) public Timer getTimer(@PathParam("pathid") int timerNumber) { Timer timer; try { timer = this.logic.getTimer(timerNumber); } catch (NoSuchElementException e) { throw new WebApplicationException("there is no timer" + timerNumber, e, Status.NOT_FOUND); } timer.setLink(createTimerPath(timerNumber)); return timer; }  @GET @Path("timers") @Produces(MediaType.APPLICATION_JSON) List<Timer> getAllTimers(); @GET @Path("timers/{pathid}") @Produces(MediaType.APPLICATION_JSON) Timer getTimer(@PathParam("pathid") int timerNumber); @POST @Path("timers/new") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Timer newTimer(Timer timer); @POST @Path("timers/deleteAll") void deleteAllTimers(); @POST @Path("timers/delete/{pathid}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Timer deleteTimer(@PathParam("pathid") int timerNumber); @POST @Path("timers/de.activate/{pathid}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Timer activatedeactivateAlarm(@PathParam("pathid") int timerNumber, Timer timerInc); @Override ResourceEntity getPluginDescripion(); static final String PATH; }