@Test public void testNoIntygEvents() { when(certificateEventService.getCertificateEvents(anyString())).thenReturn(Collections.<CertificateEvent>emptyList()); Response response = intygCtrl.getEventsForCertificate(INTYG_ID); List<CertificateEvent> responseList = (List<CertificateEvent>) response.getEntity(); assertEquals(Status.OK.getStatusCode(), response.getStatus()); assertNotNull(responseList); assertEquals(0, responseList.size()); }
@GET @Path("/{certificateId}/events") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod public Response getEventsForCertificate(@PathParam("certificateId") String certificateId) { List<CertificateEvent> eventList = certificateEventService.getCertificateEvents(certificateId); if (eventList == null) { LOG.error("Could not complete the request for certificate with id {}", certificateId); return Response.status(Status.BAD_REQUEST).build(); } if (eventList.size() > 0) { LOG.debug("Got {} events for certificate with id {}", eventList.size(), certificateId); } else if (eventList.isEmpty()) { LOG.debug("No events for certificate with id {}", certificateId); } List<CertificateEventDTO> eventDTOList = eventList .stream() .map(event -> certificateEventConverter.convertToCertificateEventDTO(event)) .collect(Collectors.toList()); return Response.ok(eventDTOList).build(); }
IntygApiController extends AbstractApiController { @GET @Path("/{certificateId}/events") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod public Response getEventsForCertificate(@PathParam("certificateId") String certificateId) { List<CertificateEvent> eventList = certificateEventService.getCertificateEvents(certificateId); if (eventList == null) { LOG.error("Could not complete the request for certificate with id {}", certificateId); return Response.status(Status.BAD_REQUEST).build(); } if (eventList.size() > 0) { LOG.debug("Got {} events for certificate with id {}", eventList.size(), certificateId); } else if (eventList.isEmpty()) { LOG.debug("No events for certificate with id {}", certificateId); } List<CertificateEventDTO> eventDTOList = eventList .stream() .map(event -> certificateEventConverter.convertToCertificateEventDTO(event)) .collect(Collectors.toList()); return Response.ok(eventDTOList).build(); } }
IntygApiController extends AbstractApiController { @GET @Path("/{certificateId}/events") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod public Response getEventsForCertificate(@PathParam("certificateId") String certificateId) { List<CertificateEvent> eventList = certificateEventService.getCertificateEvents(certificateId); if (eventList == null) { LOG.error("Could not complete the request for certificate with id {}", certificateId); return Response.status(Status.BAD_REQUEST).build(); } if (eventList.size() > 0) { LOG.debug("Got {} events for certificate with id {}", eventList.size(), certificateId); } else if (eventList.isEmpty()) { LOG.debug("No events for certificate with id {}", certificateId); } List<CertificateEventDTO> eventDTOList = eventList .stream() .map(event -> certificateEventConverter.convertToCertificateEventDTO(event)) .collect(Collectors.toList()); return Response.ok(eventDTOList).build(); }  }
IntygApiController extends AbstractApiController { @GET @Path("/{certificateId}/events") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod public Response getEventsForCertificate(@PathParam("certificateId") String certificateId) { List<CertificateEvent> eventList = certificateEventService.getCertificateEvents(certificateId); if (eventList == null) { LOG.error("Could not complete the request for certificate with id {}", certificateId); return Response.status(Status.BAD_REQUEST).build(); } if (eventList.size() > 0) { LOG.debug("Got {} events for certificate with id {}", eventList.size(), certificateId); } else if (eventList.isEmpty()) { LOG.debug("No events for certificate with id {}", certificateId); } List<CertificateEventDTO> eventDTOList = eventList .stream() .map(event -> certificateEventConverter.convertToCertificateEventDTO(event)) .collect(Collectors.toList()); return Response.ok(eventDTOList).build(); }  @GET @Path("/person/{personNummer}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response listDraftsAndIntygForPerson(@PathParam("personNummer") String personNummerIn); @PUT @Path("/{intygsTyp}/{intygsId}/{version}/vidarebefordra") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @Consumes(MediaType.APPLICATION_JSON) @PrometheusTimeMethod Response setNotifiedOnIntyg(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId,
        @PathParam("version") long version, NotifiedState notifiedState); @PUT @Path("/{intygsTyp}/{intygsId}/{version}/redoattsignera") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @Consumes(MediaType.APPLICATION_JSON) @PrometheusTimeMethod Response setKlarForSigneraAndSendStatusMessage(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId,
        @PathParam("version") long version); @GET @Path("/{certificateId}/events") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response getEventsForCertificate(@PathParam("certificateId") String certificateId); @GET @Path("/intygTypeVersion/{intygsId}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @Consumes(MediaType.APPLICATION_JSON) Response getIntygTypeVersion(@PathParam("intygsId") String intygsId); @GET @Path("/allowToApprovedReceivers/{intygsId}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @Consumes(MediaType.APPLICATION_JSON) Response getAllowToApprovedReceivers(@PathParam("intygsId") String intygsId); }
IntygApiController extends AbstractApiController { @GET @Path("/{certificateId}/events") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod public Response getEventsForCertificate(@PathParam("certificateId") String certificateId) { List<CertificateEvent> eventList = certificateEventService.getCertificateEvents(certificateId); if (eventList == null) { LOG.error("Could not complete the request for certificate with id {}", certificateId); return Response.status(Status.BAD_REQUEST).build(); } if (eventList.size() > 0) { LOG.debug("Got {} events for certificate with id {}", eventList.size(), certificateId); } else if (eventList.isEmpty()) { LOG.debug("No events for certificate with id {}", certificateId); } List<CertificateEventDTO> eventDTOList = eventList .stream() .map(event -> certificateEventConverter.convertToCertificateEventDTO(event)) .collect(Collectors.toList()); return Response.ok(eventDTOList).build(); }  @GET @Path("/person/{personNummer}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response listDraftsAndIntygForPerson(@PathParam("personNummer") String personNummerIn); @PUT @Path("/{intygsTyp}/{intygsId}/{version}/vidarebefordra") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @Consumes(MediaType.APPLICATION_JSON) @PrometheusTimeMethod Response setNotifiedOnIntyg(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId,
        @PathParam("version") long version, NotifiedState notifiedState); @PUT @Path("/{intygsTyp}/{intygsId}/{version}/redoattsignera") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @Consumes(MediaType.APPLICATION_JSON) @PrometheusTimeMethod Response setKlarForSigneraAndSendStatusMessage(@PathParam("intygsTyp") String intygsTyp, @PathParam("intygsId") String intygsId,
        @PathParam("version") long version); @GET @Path("/{certificateId}/events") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @PrometheusTimeMethod Response getEventsForCertificate(@PathParam("certificateId") String certificateId); @GET @Path("/intygTypeVersion/{intygsId}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @Consumes(MediaType.APPLICATION_JSON) Response getIntygTypeVersion(@PathParam("intygsId") String intygsId); @GET @Path("/allowToApprovedReceivers/{intygsId}") @Produces(MediaType.APPLICATION_JSON + UTF_8_CHARSET) @Consumes(MediaType.APPLICATION_JSON) Response getAllowToApprovedReceivers(@PathParam("intygsId") String intygsId);  }