@Test public void testMonitoringBrowserInfo() { final String height = "height"; final String width = "width"; final String netIdVersion = "netIdVersion"; MonitoringRequest request = new MonitoringRequest(); request.setEvent(BROWSER_INFO); Map<String, String> extraInfo = new HashMap<>(); extraInfo.put(MonitoringRequest.HEIGHT, height); extraInfo.put(MonitoringRequest.WIDTH, width); extraInfo.put(MonitoringRequest.NET_ID_VERSION, netIdVersion); request.setInfo(extraInfo); Response response = controller.monitoring(request, userAgentString); assertNotNull(response); assertEquals(OK.getStatusCode(), response.getStatus()); verify(monLog).logBrowserInfo("IE", "1.0", "OS", "1.1", width, height, netIdVersion); verifyNoMoreInteractions(monLog); }
@POST @Path("/monitoring") @Consumes(APPLICATION_JSON) @PrometheusTimeMethod public Response monitoring(MonitoringRequest request, @HeaderParam(HttpHeaders.USER_AGENT) String userAgent) { if (request == null || !request.isValid()) { return status(BAD_REQUEST).build(); } switch (request.getEvent()) { case BROWSER_INFO: final UserAgentInfo userAgentInfo = userAgentParser.parse(userAgent); monitoringService .logBrowserInfo(userAgentInfo.getBrowserName(), userAgentInfo.getBrowserVersion(), userAgentInfo.getOsFamily(), userAgentInfo.getOsVersion(), request.getInfo().get(WIDTH), request.getInfo().get(HEIGHT), request.getInfo().get(NET_ID_VERSION)); break; case DIAGNOSKODVERK_CHANGED: monitoringService.logDiagnoskodverkChanged(request.getInfo().get(INTYG_ID), request.getInfo().get(INTYG_TYPE)); break; case SIGNING_FAILED: monitoringService.logUtkastSignFailed(request.getInfo().get(ERROR_MESSAGE), request.getInfo().get(INTYG_ID)); break; case IDP_CONNECTIVITY_CHECK: monitoringService.logIdpConnectivityCheck(request.getInfo().get(IP), request.getInfo().get(CONNECTIVITY)); break; default: return status(BAD_REQUEST).build(); } return ok().build(); }
JsLogApiController extends AbstractApiController { @POST @Path("/monitoring") @Consumes(APPLICATION_JSON) @PrometheusTimeMethod public Response monitoring(MonitoringRequest request, @HeaderParam(HttpHeaders.USER_AGENT) String userAgent) { if (request == null || !request.isValid()) { return status(BAD_REQUEST).build(); } switch (request.getEvent()) { case BROWSER_INFO: final UserAgentInfo userAgentInfo = userAgentParser.parse(userAgent); monitoringService .logBrowserInfo(userAgentInfo.getBrowserName(), userAgentInfo.getBrowserVersion(), userAgentInfo.getOsFamily(), userAgentInfo.getOsVersion(), request.getInfo().get(WIDTH), request.getInfo().get(HEIGHT), request.getInfo().get(NET_ID_VERSION)); break; case DIAGNOSKODVERK_CHANGED: monitoringService.logDiagnoskodverkChanged(request.getInfo().get(INTYG_ID), request.getInfo().get(INTYG_TYPE)); break; case SIGNING_FAILED: monitoringService.logUtkastSignFailed(request.getInfo().get(ERROR_MESSAGE), request.getInfo().get(INTYG_ID)); break; case IDP_CONNECTIVITY_CHECK: monitoringService.logIdpConnectivityCheck(request.getInfo().get(IP), request.getInfo().get(CONNECTIVITY)); break; default: return status(BAD_REQUEST).build(); } return ok().build(); } }
JsLogApiController extends AbstractApiController { @POST @Path("/monitoring") @Consumes(APPLICATION_JSON) @PrometheusTimeMethod public Response monitoring(MonitoringRequest request, @HeaderParam(HttpHeaders.USER_AGENT) String userAgent) { if (request == null || !request.isValid()) { return status(BAD_REQUEST).build(); } switch (request.getEvent()) { case BROWSER_INFO: final UserAgentInfo userAgentInfo = userAgentParser.parse(userAgent); monitoringService .logBrowserInfo(userAgentInfo.getBrowserName(), userAgentInfo.getBrowserVersion(), userAgentInfo.getOsFamily(), userAgentInfo.getOsVersion(), request.getInfo().get(WIDTH), request.getInfo().get(HEIGHT), request.getInfo().get(NET_ID_VERSION)); break; case DIAGNOSKODVERK_CHANGED: monitoringService.logDiagnoskodverkChanged(request.getInfo().get(INTYG_ID), request.getInfo().get(INTYG_TYPE)); break; case SIGNING_FAILED: monitoringService.logUtkastSignFailed(request.getInfo().get(ERROR_MESSAGE), request.getInfo().get(INTYG_ID)); break; case IDP_CONNECTIVITY_CHECK: monitoringService.logIdpConnectivityCheck(request.getInfo().get(IP), request.getInfo().get(CONNECTIVITY)); break; default: return status(BAD_REQUEST).build(); } return ok().build(); }  }
JsLogApiController extends AbstractApiController { @POST @Path("/monitoring") @Consumes(APPLICATION_JSON) @PrometheusTimeMethod public Response monitoring(MonitoringRequest request, @HeaderParam(HttpHeaders.USER_AGENT) String userAgent) { if (request == null || !request.isValid()) { return status(BAD_REQUEST).build(); } switch (request.getEvent()) { case BROWSER_INFO: final UserAgentInfo userAgentInfo = userAgentParser.parse(userAgent); monitoringService .logBrowserInfo(userAgentInfo.getBrowserName(), userAgentInfo.getBrowserVersion(), userAgentInfo.getOsFamily(), userAgentInfo.getOsVersion(), request.getInfo().get(WIDTH), request.getInfo().get(HEIGHT), request.getInfo().get(NET_ID_VERSION)); break; case DIAGNOSKODVERK_CHANGED: monitoringService.logDiagnoskodverkChanged(request.getInfo().get(INTYG_ID), request.getInfo().get(INTYG_TYPE)); break; case SIGNING_FAILED: monitoringService.logUtkastSignFailed(request.getInfo().get(ERROR_MESSAGE), request.getInfo().get(INTYG_ID)); break; case IDP_CONNECTIVITY_CHECK: monitoringService.logIdpConnectivityCheck(request.getInfo().get(IP), request.getInfo().get(CONNECTIVITY)); break; default: return status(BAD_REQUEST).build(); } return ok().build(); }  @POST @Path("/debug") @PrometheusTimeMethod Response debug(String message); @POST @Path("/monitoring") @Consumes(APPLICATION_JSON) @PrometheusTimeMethod Response monitoring(MonitoringRequest request, @HeaderParam(HttpHeaders.USER_AGENT) String userAgent); @POST @Path("/srs") @Consumes(APPLICATION_JSON) @PrometheusTimeMethod Response srsMonitoring(MonitoringRequest request); }
JsLogApiController extends AbstractApiController { @POST @Path("/monitoring") @Consumes(APPLICATION_JSON) @PrometheusTimeMethod public Response monitoring(MonitoringRequest request, @HeaderParam(HttpHeaders.USER_AGENT) String userAgent) { if (request == null || !request.isValid()) { return status(BAD_REQUEST).build(); } switch (request.getEvent()) { case BROWSER_INFO: final UserAgentInfo userAgentInfo = userAgentParser.parse(userAgent); monitoringService .logBrowserInfo(userAgentInfo.getBrowserName(), userAgentInfo.getBrowserVersion(), userAgentInfo.getOsFamily(), userAgentInfo.getOsVersion(), request.getInfo().get(WIDTH), request.getInfo().get(HEIGHT), request.getInfo().get(NET_ID_VERSION)); break; case DIAGNOSKODVERK_CHANGED: monitoringService.logDiagnoskodverkChanged(request.getInfo().get(INTYG_ID), request.getInfo().get(INTYG_TYPE)); break; case SIGNING_FAILED: monitoringService.logUtkastSignFailed(request.getInfo().get(ERROR_MESSAGE), request.getInfo().get(INTYG_ID)); break; case IDP_CONNECTIVITY_CHECK: monitoringService.logIdpConnectivityCheck(request.getInfo().get(IP), request.getInfo().get(CONNECTIVITY)); break; default: return status(BAD_REQUEST).build(); } return ok().build(); }  @POST @Path("/debug") @PrometheusTimeMethod Response debug(String message); @POST @Path("/monitoring") @Consumes(APPLICATION_JSON) @PrometheusTimeMethod Response monitoring(MonitoringRequest request, @HeaderParam(HttpHeaders.USER_AGENT) String userAgent); @POST @Path("/srs") @Consumes(APPLICATION_JSON) @PrometheusTimeMethod Response srsMonitoring(MonitoringRequest request);  }