@Test @Ignore public void getAlarm() { WebTarget wt = target(); String response = wt.path("/alarms/1").request().get(String.class); assertThat(response, containsString("\"NE is not reachable\",")); assertThat(response, not(containsString("\"Equipment Missing\","))); }
@GET @Path("{id}") @Produces(MediaType.APPLICATION_JSON) public Response getAlarm(@PathParam("id") String id) { log.debug("HTTP GET alarm for id={}", id); AlarmId alarmId = toAlarmId(id); Alarm alarm = get(AlarmService.class).getAlarm(alarmId); ObjectNode result = new ObjectMapper().createObjectNode(); result.set("alarm", new AlarmCodec().encode(alarm, this)); return ok(result.toString()).build(); }
AlarmsWebResource extends AbstractWebResource { @GET @Path("{id}") @Produces(MediaType.APPLICATION_JSON) public Response getAlarm(@PathParam("id") String id) { log.debug("HTTP GET alarm for id={}", id); AlarmId alarmId = toAlarmId(id); Alarm alarm = get(AlarmService.class).getAlarm(alarmId); ObjectNode result = new ObjectMapper().createObjectNode(); result.set("alarm", new AlarmCodec().encode(alarm, this)); return ok(result.toString()).build(); } }
AlarmsWebResource extends AbstractWebResource { @GET @Path("{id}") @Produces(MediaType.APPLICATION_JSON) public Response getAlarm(@PathParam("id") String id) { log.debug("HTTP GET alarm for id={}", id); AlarmId alarmId = toAlarmId(id); Alarm alarm = get(AlarmService.class).getAlarm(alarmId); ObjectNode result = new ObjectMapper().createObjectNode(); result.set("alarm", new AlarmCodec().encode(alarm, this)); return ok(result.toString()).build(); }  }
AlarmsWebResource extends AbstractWebResource { @GET @Path("{id}") @Produces(MediaType.APPLICATION_JSON) public Response getAlarm(@PathParam("id") String id) { log.debug("HTTP GET alarm for id={}", id); AlarmId alarmId = toAlarmId(id); Alarm alarm = get(AlarmService.class).getAlarm(alarmId); ObjectNode result = new ObjectMapper().createObjectNode(); result.set("alarm", new AlarmCodec().encode(alarm, this)); return ok(result.toString()).build(); }  @GET @Produces(MediaType.APPLICATION_JSON) Response getAlarms(@DefaultValue("false") @QueryParam("includeCleared") boolean includeCleared,
            @DefaultValue("") @QueryParam("devId") String devId
    ); @GET @Path("{id}") @Produces(MediaType.APPLICATION_JSON) Response getAlarm(@PathParam("id") String id); @PUT @Path("{alarm_id}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response update(@PathParam("alarm_id") String alarmIdPath, InputStream stream); }
AlarmsWebResource extends AbstractWebResource { @GET @Path("{id}") @Produces(MediaType.APPLICATION_JSON) public Response getAlarm(@PathParam("id") String id) { log.debug("HTTP GET alarm for id={}", id); AlarmId alarmId = toAlarmId(id); Alarm alarm = get(AlarmService.class).getAlarm(alarmId); ObjectNode result = new ObjectMapper().createObjectNode(); result.set("alarm", new AlarmCodec().encode(alarm, this)); return ok(result.toString()).build(); }  @GET @Produces(MediaType.APPLICATION_JSON) Response getAlarms(@DefaultValue("false") @QueryParam("includeCleared") boolean includeCleared,
            @DefaultValue("") @QueryParam("devId") String devId
    ); @GET @Path("{id}") @Produces(MediaType.APPLICATION_JSON) Response getAlarm(@PathParam("id") String id); @PUT @Path("{alarm_id}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) Response update(@PathParam("alarm_id") String alarmIdPath, InputStream stream);  }