@Test public void testSuccessfulRestore() { Stack stack = getStack(); when(stackService.findStackByNameAndWorkspaceId(any(), anyLong())).thenReturn(Optional.of(stack)); when(stackService.getByNameOrCrnInWorkspace(any(), anyLong())).thenReturn(stack); when(flowLogService.findAllByResourceIdAndFinalizedIsFalseOrderByCreatedDesc(1L)).thenReturn(Collections.EMPTY_LIST); when(flowManager.triggerDatalakeDatabaseRestore(anyLong(), any(), any())).thenReturn(FlowIdentifier.notTriggered()); service.restoreDatabase(WORKSPACE_ID, ofName, null, null); }
public FlowIdentifier restoreDatabase(Long workspaceId, NameOrCrn nameOrCrn, String location, String backupId) { Stack stack = stackService.getByNameOrCrnInWorkspace(nameOrCrn, workspaceId); MDCBuilder.buildMdcContext(stack); LOGGER.info("Initiating database restore flow for stack {}", stack.getId()); return flowManager.triggerDatalakeDatabaseRestore(stack.getId(), location, backupId); }
DatabaseBackupRestoreService { public FlowIdentifier restoreDatabase(Long workspaceId, NameOrCrn nameOrCrn, String location, String backupId) { Stack stack = stackService.getByNameOrCrnInWorkspace(nameOrCrn, workspaceId); MDCBuilder.buildMdcContext(stack); LOGGER.info("Initiating database restore flow for stack {}", stack.getId()); return flowManager.triggerDatalakeDatabaseRestore(stack.getId(), location, backupId); } }
DatabaseBackupRestoreService { public FlowIdentifier restoreDatabase(Long workspaceId, NameOrCrn nameOrCrn, String location, String backupId) { Stack stack = stackService.getByNameOrCrnInWorkspace(nameOrCrn, workspaceId); MDCBuilder.buildMdcContext(stack); LOGGER.info("Initiating database restore flow for stack {}", stack.getId()); return flowManager.triggerDatalakeDatabaseRestore(stack.getId(), location, backupId); }  }
DatabaseBackupRestoreService { public FlowIdentifier restoreDatabase(Long workspaceId, NameOrCrn nameOrCrn, String location, String backupId) { Stack stack = stackService.getByNameOrCrnInWorkspace(nameOrCrn, workspaceId); MDCBuilder.buildMdcContext(stack); LOGGER.info("Initiating database restore flow for stack {}", stack.getId()); return flowManager.triggerDatalakeDatabaseRestore(stack.getId(), location, backupId); }  void validate(Long workspaceId, NameOrCrn nameOrCrn, String location, String backupId); FlowIdentifier backupDatabase(Long workspaceId, NameOrCrn nameOrCrn, String location, String backupId); FlowIdentifier restoreDatabase(Long workspaceId, NameOrCrn nameOrCrn, String location, String backupId); }
DatabaseBackupRestoreService { public FlowIdentifier restoreDatabase(Long workspaceId, NameOrCrn nameOrCrn, String location, String backupId) { Stack stack = stackService.getByNameOrCrnInWorkspace(nameOrCrn, workspaceId); MDCBuilder.buildMdcContext(stack); LOGGER.info("Initiating database restore flow for stack {}", stack.getId()); return flowManager.triggerDatalakeDatabaseRestore(stack.getId(), location, backupId); }  void validate(Long workspaceId, NameOrCrn nameOrCrn, String location, String backupId); FlowIdentifier backupDatabase(Long workspaceId, NameOrCrn nameOrCrn, String location, String backupId); FlowIdentifier restoreDatabase(Long workspaceId, NameOrCrn nameOrCrn, String location, String backupId);  }