@Test void testGetAllAlarms() { List<Alarm> returnedAlarms = createAlarms(3, true); when(this.acl.getAllAlarms()).thenReturn(returnedAlarms); Response response = this.target.path("alarms").request().get(); assertThat(returnedAlarms.size(), is(3)); assertThat(response, status(200)); }
@GET @Path("alarms") @Produces(MediaType.APPLICATION_JSON) public List<Alarm> getAllAlarms() { List<Alarm> alarmlist = this.logic.getAllAlarms(); for (Alarm a : alarmlist) { a.setLink(createAlarmPath(a.getId())); } return this.logic.getAllAlarms(); }
AlarmClockResource implements Resource { @GET @Path("alarms") @Produces(MediaType.APPLICATION_JSON) public List<Alarm> getAllAlarms() { List<Alarm> alarmlist = this.logic.getAllAlarms(); for (Alarm a : alarmlist) { a.setLink(createAlarmPath(a.getId())); } return this.logic.getAllAlarms(); } }
AlarmClockResource implements Resource { @GET @Path("alarms") @Produces(MediaType.APPLICATION_JSON) public List<Alarm> getAllAlarms() { List<Alarm> alarmlist = this.logic.getAllAlarms(); for (Alarm a : alarmlist) { a.setLink(createAlarmPath(a.getId())); } return this.logic.getAllAlarms(); }  }
AlarmClockResource implements Resource { @GET @Path("alarms") @Produces(MediaType.APPLICATION_JSON) public List<Alarm> getAllAlarms() { List<Alarm> alarmlist = this.logic.getAllAlarms(); for (Alarm a : alarmlist) { a.setLink(createAlarmPath(a.getId())); } return this.logic.getAllAlarms(); }  @GET @Path("alarms") @Produces(MediaType.APPLICATION_JSON) List<Alarm> getAllAlarms(); @GET @Path("alarms/{pathid}") @Produces(MediaType.APPLICATION_JSON) Alarm getAlarm(@PathParam("pathid") int alarmnumber); @POST @Path("alarms/{pathid}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Alarm editAlarm(@PathParam("pathid") int alarmNumber, Alarm alarmInc); @POST @Path("alarms/de.activate/{pathid}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Alarm activatedeactivateAlarm(@PathParam("pathid") int alarmNumber, Alarm alarmInc); @POST @Path("alarms/delete/{pathid}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Alarm deleteAlarm(@PathParam("pathid") int alarmNumber); @POST @Path("alarms/new") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Alarm newAlarm(Alarm alarm); @POST @Path("alarms/reset") void resetAlarms(); @Override ResourceEntity getPluginDescripion(); }
AlarmClockResource implements Resource { @GET @Path("alarms") @Produces(MediaType.APPLICATION_JSON) public List<Alarm> getAllAlarms() { List<Alarm> alarmlist = this.logic.getAllAlarms(); for (Alarm a : alarmlist) { a.setLink(createAlarmPath(a.getId())); } return this.logic.getAllAlarms(); }  @GET @Path("alarms") @Produces(MediaType.APPLICATION_JSON) List<Alarm> getAllAlarms(); @GET @Path("alarms/{pathid}") @Produces(MediaType.APPLICATION_JSON) Alarm getAlarm(@PathParam("pathid") int alarmnumber); @POST @Path("alarms/{pathid}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Alarm editAlarm(@PathParam("pathid") int alarmNumber, Alarm alarmInc); @POST @Path("alarms/de.activate/{pathid}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Alarm activatedeactivateAlarm(@PathParam("pathid") int alarmNumber, Alarm alarmInc); @POST @Path("alarms/delete/{pathid}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) Alarm deleteAlarm(@PathParam("pathid") int alarmNumber); @POST @Path("alarms/new") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Alarm newAlarm(Alarm alarm); @POST @Path("alarms/reset") void resetAlarms(); @Override ResourceEntity getPluginDescripion(); static final String PATH; }