@Test @WithMockUser(authorities = {"DIAGNOSTICS"}) public void getOcspResponderDiagnosticsWaiting() { OcspResponderDiagnosticsStatus status = new OcspResponderDiagnosticsStatus(CA_NAME_2); DiagnosticsStatus diagnosticsStatus = new DiagnosticsStatus( DiagnosticsErrorCodes.ERROR_CODE_OCSP_UNINITIALIZED, null, NEXT_UPDATE); diagnosticsStatus.setDescription(OCSP_URL_2); status.setOcspResponderStatusMap(Arrays.asList(diagnosticsStatus)); when(diagnosticService.queryOcspResponderStatus()).thenReturn(Arrays.asList(status)); ResponseEntity<List<OcspResponderDiagnostics>> response = diagnosticsApiController .getOcspRespondersDiagnostics(); assertEquals(HttpStatus.OK, response.getStatusCode()); List<OcspResponderDiagnostics> diagnostics = response.getBody(); assertEquals(1, diagnostics.size()); assertEquals(1, diagnostics.get(0).getOcspResponders().size()); assertEquals(CA_NAME_2, diagnostics.get(0).getDistinguishedName()); assertEquals(OcspStatus.ERROR_CODE_OCSP_UNINITIALIZED, diagnostics.get(0).getOcspResponders() .get(0).getStatusCode()); assertEquals(DiagnosticStatusClass.WAITING, diagnostics.get(0).getOcspResponders().get(0).getStatusClass()); assertEquals(null, diagnostics.get(0).getOcspResponders().get(0).getPrevUpdateAt()); assertEquals(NEXT_UPDATE, diagnostics.get(0).getOcspResponders().get(0).getNextUpdateAt()); assertEquals(OCSP_URL_2, diagnostics.get(0).getOcspResponders().get(0).getUrl()); }
@Override @PreAuthorize("hasAuthority('DIAGNOSTICS')") public ResponseEntity<List<OcspResponderDiagnostics>> getOcspRespondersDiagnostics() { List<OcspResponderDiagnosticsStatus> statuses = diagnosticService.queryOcspResponderStatus(); return new ResponseEntity<>(ocspResponderDiagnosticConverter.convert(statuses), HttpStatus.OK); }
DiagnosticsApiController implements DiagnosticsApi { @Override @PreAuthorize("hasAuthority('DIAGNOSTICS')") public ResponseEntity<List<OcspResponderDiagnostics>> getOcspRespondersDiagnostics() { List<OcspResponderDiagnosticsStatus> statuses = diagnosticService.queryOcspResponderStatus(); return new ResponseEntity<>(ocspResponderDiagnosticConverter.convert(statuses), HttpStatus.OK); } }
DiagnosticsApiController implements DiagnosticsApi { @Override @PreAuthorize("hasAuthority('DIAGNOSTICS')") public ResponseEntity<List<OcspResponderDiagnostics>> getOcspRespondersDiagnostics() { List<OcspResponderDiagnosticsStatus> statuses = diagnosticService.queryOcspResponderStatus(); return new ResponseEntity<>(ocspResponderDiagnosticConverter.convert(statuses), HttpStatus.OK); } @Autowired  DiagnosticsApiController(DiagnosticService diagnosticService,
            GlobalConfDiagnosticConverter globalConfDiagnosticConverter,
            TimestampingServiceDiagnosticConverter timestampingServiceDiagnosticConverter,
            OcspResponderDiagnosticConverter ocspResponderDiagnosticConverter); }
DiagnosticsApiController implements DiagnosticsApi { @Override @PreAuthorize("hasAuthority('DIAGNOSTICS')") public ResponseEntity<List<OcspResponderDiagnostics>> getOcspRespondersDiagnostics() { List<OcspResponderDiagnosticsStatus> statuses = diagnosticService.queryOcspResponderStatus(); return new ResponseEntity<>(ocspResponderDiagnosticConverter.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<OcspResponderDiagnostics>> getOcspRespondersDiagnostics() { List<OcspResponderDiagnosticsStatus> statuses = diagnosticService.queryOcspResponderStatus(); return new ResponseEntity<>(ocspResponderDiagnosticConverter.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();  }