@Test @WithMockUser(authorities = {"DIAGNOSTICS"}) public void getGlobalConfDiagnosticsSuccess() { final OffsetDateTime prevUpdate = OffsetDateTime.now(); final OffsetDateTime nextUpdate = prevUpdate.plusHours(1); when(diagnosticService.queryGlobalConfStatus()).thenReturn(new DiagnosticsStatus( DiagnosticsErrorCodes.RETURN_SUCCESS, prevUpdate, nextUpdate)); ResponseEntity<GlobalConfDiagnostics> response = diagnosticsApiController.getGlobalConfDiagnostics(); assertEquals(HttpStatus.OK, response.getStatusCode()); GlobalConfDiagnostics globalConfDiagnostics = response.getBody(); assertEquals(ConfigurationStatus.SUCCESS, globalConfDiagnostics.getStatusCode()); assertEquals(DiagnosticStatusClass.OK, globalConfDiagnostics.getStatusClass()); assertEquals(prevUpdate, globalConfDiagnostics.getPrevUpdateAt()); assertEquals(nextUpdate, globalConfDiagnostics.getNextUpdateAt()); }
@Override @PreAuthorize("hasAuthority('DIAGNOSTICS')") public ResponseEntity<GlobalConfDiagnostics> getGlobalConfDiagnostics() { DiagnosticsStatus status = diagnosticService.queryGlobalConfStatus(); return new ResponseEntity<>(globalConfDiagnosticConverter.convert(status), HttpStatus.OK); }
DiagnosticsApiController implements DiagnosticsApi { @Override @PreAuthorize("hasAuthority('DIAGNOSTICS')") public ResponseEntity<GlobalConfDiagnostics> getGlobalConfDiagnostics() { DiagnosticsStatus status = diagnosticService.queryGlobalConfStatus(); return new ResponseEntity<>(globalConfDiagnosticConverter.convert(status), HttpStatus.OK); } }
DiagnosticsApiController implements DiagnosticsApi { @Override @PreAuthorize("hasAuthority('DIAGNOSTICS')") public ResponseEntity<GlobalConfDiagnostics> getGlobalConfDiagnostics() { DiagnosticsStatus status = diagnosticService.queryGlobalConfStatus(); return new ResponseEntity<>(globalConfDiagnosticConverter.convert(status), HttpStatus.OK); } @Autowired  DiagnosticsApiController(DiagnosticService diagnosticService,
            GlobalConfDiagnosticConverter globalConfDiagnosticConverter,
            TimestampingServiceDiagnosticConverter timestampingServiceDiagnosticConverter,
            OcspResponderDiagnosticConverter ocspResponderDiagnosticConverter); }
DiagnosticsApiController implements DiagnosticsApi { @Override @PreAuthorize("hasAuthority('DIAGNOSTICS')") public ResponseEntity<GlobalConfDiagnostics> getGlobalConfDiagnostics() { DiagnosticsStatus status = diagnosticService.queryGlobalConfStatus(); return new ResponseEntity<>(globalConfDiagnosticConverter.convert(status), HttpStatus.OK); } @Autowired  DiagnosticsApiController(DiagnosticService diagnosticService,
            GlobalConfDiagnosticConverter globalConfDiagnosticConverter,
            TimestampingServiceDiagnosticConverter timestampingServiceDiagnosticConverter,
            OcspResponderDiagnosticConverter ocspResponderDiagnosticConverter); @Override @PreAuthorize("hasAuthority('DIAGNOSTICS')") ResponseEntity<GlobalConfDiagnostics> getGlobalConfDiagnostics(); @Override @PreAuthorize("hasAuthority('DIAGNOSTICS')") ResponseEntity<List<TimestampingServiceDiagnostics>> getTimestampingServicesDiagnostics(); @Override @PreAuthorize("hasAuthority('DIAGNOSTICS')") ResponseEntity<List<OcspResponderDiagnostics>> getOcspRespondersDiagnostics(); }
DiagnosticsApiController implements DiagnosticsApi { @Override @PreAuthorize("hasAuthority('DIAGNOSTICS')") public ResponseEntity<GlobalConfDiagnostics> getGlobalConfDiagnostics() { DiagnosticsStatus status = diagnosticService.queryGlobalConfStatus(); return new ResponseEntity<>(globalConfDiagnosticConverter.convert(status), HttpStatus.OK); } @Autowired  DiagnosticsApiController(DiagnosticService diagnosticService,
            GlobalConfDiagnosticConverter globalConfDiagnosticConverter,
            TimestampingServiceDiagnosticConverter timestampingServiceDiagnosticConverter,
            OcspResponderDiagnosticConverter ocspResponderDiagnosticConverter); @Override @PreAuthorize("hasAuthority('DIAGNOSTICS')") ResponseEntity<GlobalConfDiagnostics> getGlobalConfDiagnostics(); @Override @PreAuthorize("hasAuthority('DIAGNOSTICS')") ResponseEntity<List<TimestampingServiceDiagnostics>> getTimestampingServicesDiagnostics(); @Override @PreAuthorize("hasAuthority('DIAGNOSTICS')") ResponseEntity<List<OcspResponderDiagnostics>> getOcspRespondersDiagnostics();  }