@Test @WithMockUser(authorities = { "BACKUP_CONFIGURATION" }) public void getBackups() throws Exception { ResponseEntity<List<Backup>> response = backupsApiController.getBackups(); assertEquals(HttpStatus.OK, response.getStatusCode()); List<Backup> backups = response.getBody(); assertEquals(2, backups.size()); assertEquals(BACKUP_FILE_1_NAME, backups.get(0).getFilename()); assertEquals(BACKUP_FILE_1_CREATED_AT, backups.get(0).getCreatedAt().toString()); assertEquals(BACKUP_FILE_2_NAME, backups.get(1).getFilename()); assertEquals(BACKUP_FILE_2_CREATED_AT, backups.get(1).getCreatedAt().toString()); }
@Override @PreAuthorize("hasAuthority('BACKUP_CONFIGURATION')") public ResponseEntity<List<Backup>> getBackups() { List<BackupFile> backupFiles = backupService.getBackupFiles(); return new ResponseEntity<>(backupConverter.convert(backupFiles), HttpStatus.OK); }
BackupsApiController implements BackupsApi { @Override @PreAuthorize("hasAuthority('BACKUP_CONFIGURATION')") public ResponseEntity<List<Backup>> getBackups() { List<BackupFile> backupFiles = backupService.getBackupFiles(); return new ResponseEntity<>(backupConverter.convert(backupFiles), HttpStatus.OK); } }
BackupsApiController implements BackupsApi { @Override @PreAuthorize("hasAuthority('BACKUP_CONFIGURATION')") public ResponseEntity<List<Backup>> getBackups() { List<BackupFile> backupFiles = backupService.getBackupFiles(); return new ResponseEntity<>(backupConverter.convert(backupFiles), HttpStatus.OK); } @Autowired  BackupsApiController(BackupService backupService,
            RestoreService restoreService, BackupConverter backupConverter,
            TokenService tokenService); }
BackupsApiController implements BackupsApi { @Override @PreAuthorize("hasAuthority('BACKUP_CONFIGURATION')") public ResponseEntity<List<Backup>> getBackups() { List<BackupFile> backupFiles = backupService.getBackupFiles(); return new ResponseEntity<>(backupConverter.convert(backupFiles), HttpStatus.OK); } @Autowired  BackupsApiController(BackupService backupService,
            RestoreService restoreService, BackupConverter backupConverter,
            TokenService tokenService); @Override @PreAuthorize("hasAuthority('BACKUP_CONFIGURATION')") ResponseEntity<List<Backup>> getBackups(); @Override @PreAuthorize("hasAuthority('BACKUP_CONFIGURATION')") @AuditEventMethod(event = DELETE_BACKUP) ResponseEntity<Void> deleteBackup(String filename); @Override @PreAuthorize("hasAuthority('BACKUP_CONFIGURATION')") ResponseEntity<Resource> downloadBackup(String filename); @Override @PreAuthorize("hasAuthority('BACKUP_CONFIGURATION')") @AuditEventMethod(event = BACKUP) ResponseEntity<Backup> addBackup(); @Override @PreAuthorize("hasAuthority('BACKUP_CONFIGURATION')") @AuditEventMethod(event = UPLOAD_BACKUP) ResponseEntity<Backup> uploadBackup(Boolean ignoreWarnings, MultipartFile file); @Override @PreAuthorize("hasAuthority('RESTORE_CONFIGURATION')") @AuditEventMethod(event = RESTORE_BACKUP) synchronized ResponseEntity<TokensLoggedOut> restoreBackup(String filename); }
BackupsApiController implements BackupsApi { @Override @PreAuthorize("hasAuthority('BACKUP_CONFIGURATION')") public ResponseEntity<List<Backup>> getBackups() { List<BackupFile> backupFiles = backupService.getBackupFiles(); return new ResponseEntity<>(backupConverter.convert(backupFiles), HttpStatus.OK); } @Autowired  BackupsApiController(BackupService backupService,
            RestoreService restoreService, BackupConverter backupConverter,
            TokenService tokenService); @Override @PreAuthorize("hasAuthority('BACKUP_CONFIGURATION')") ResponseEntity<List<Backup>> getBackups(); @Override @PreAuthorize("hasAuthority('BACKUP_CONFIGURATION')") @AuditEventMethod(event = DELETE_BACKUP) ResponseEntity<Void> deleteBackup(String filename); @Override @PreAuthorize("hasAuthority('BACKUP_CONFIGURATION')") ResponseEntity<Resource> downloadBackup(String filename); @Override @PreAuthorize("hasAuthority('BACKUP_CONFIGURATION')") @AuditEventMethod(event = BACKUP) ResponseEntity<Backup> addBackup(); @Override @PreAuthorize("hasAuthority('BACKUP_CONFIGURATION')") @AuditEventMethod(event = UPLOAD_BACKUP) ResponseEntity<Backup> uploadBackup(Boolean ignoreWarnings, MultipartFile file); @Override @PreAuthorize("hasAuthority('RESTORE_CONFIGURATION')") @AuditEventMethod(event = RESTORE_BACKUP) synchronized ResponseEntity<TokensLoggedOut> restoreBackup(String filename); static final String GENERATE_BACKUP_INTERRUPTED; static final String RESTORE_INTERRUPTED; }