@Test @WithMockUser(authorities = {"DIAGNOSTICS"}) public void getTimestampingServiceDiagnosticsSuccess() { DiagnosticsStatus diagnosticsStatus = new DiagnosticsStatus( DiagnosticsErrorCodes.RETURN_SUCCESS, PREVIOUS_UPDATE); diagnosticsStatus.setDescription(TSA_URL_1); when(diagnosticService.queryTimestampingStatus()).thenReturn(Arrays.asList(diagnosticsStatus)); ResponseEntity<List<TimestampingServiceDiagnostics>> response = diagnosticsApiController .getTimestampingServicesDiagnostics(); assertEquals(HttpStatus.OK, response.getStatusCode()); List<TimestampingServiceDiagnostics> timestampingServiceDiagnostics = response.getBody(); assertEquals(1, timestampingServiceDiagnostics.size()); assertEquals(TimestampingStatus.SUCCESS, timestampingServiceDiagnostics.get(0).getStatusCode()); assertEquals(DiagnosticStatusClass.OK, timestampingServiceDiagnostics.get(0).getStatusClass()); assertEquals(PREVIOUS_UPDATE, timestampingServiceDiagnostics.get(0).getPrevUpdateAt()); assertEquals(TSA_URL_1, timestampingServiceDiagnostics.get(0).getUrl()); }
@Override @PreAuthorize("hasAuthority('DIAGNOSTICS')") public ResponseEntity<List<TimestampingServiceDiagnostics>> getTimestampingServicesDiagnostics() { List<DiagnosticsStatus> statuses = diagnosticService.queryTimestampingStatus(); return new ResponseEntity<>(timestampingServiceDiagnosticConverter.convert(statuses), HttpStatus.OK); }
DiagnosticsApiController implements DiagnosticsApi { @Override @PreAuthorize("hasAuthority('DIAGNOSTICS')") public ResponseEntity<List<TimestampingServiceDiagnostics>> getTimestampingServicesDiagnostics() { List<DiagnosticsStatus> statuses = diagnosticService.queryTimestampingStatus(); return new ResponseEntity<>(timestampingServiceDiagnosticConverter.convert(statuses), HttpStatus.OK); } }
DiagnosticsApiController implements DiagnosticsApi { @Override @PreAuthorize("hasAuthority('DIAGNOSTICS')") public ResponseEntity<List<TimestampingServiceDiagnostics>> getTimestampingServicesDiagnostics() { List<DiagnosticsStatus> statuses = diagnosticService.queryTimestampingStatus(); return new ResponseEntity<>(timestampingServiceDiagnosticConverter.convert(statuses), HttpStatus.OK); } @Autowired  DiagnosticsApiController(DiagnosticService diagnosticService,
            GlobalConfDiagnosticConverter globalConfDiagnosticConverter,
            TimestampingServiceDiagnosticConverter timestampingServiceDiagnosticConverter,
            OcspResponderDiagnosticConverter ocspResponderDiagnosticConverter); }
DiagnosticsApiController implements DiagnosticsApi { @Override @PreAuthorize("hasAuthority('DIAGNOSTICS')") public ResponseEntity<List<TimestampingServiceDiagnostics>> getTimestampingServicesDiagnostics() { List<DiagnosticsStatus> statuses = diagnosticService.queryTimestampingStatus(); return new ResponseEntity<>(timestampingServiceDiagnosticConverter.convert(statuses), 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<List<TimestampingServiceDiagnostics>> getTimestampingServicesDiagnostics() { List<DiagnosticsStatus> statuses = diagnosticService.queryTimestampingStatus(); return new ResponseEntity<>(timestampingServiceDiagnosticConverter.convert(statuses), 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();  }