@Test public void testValidationSuccess() { Stack stack = getStack(); when(stackService.findStackByNameAndWorkspaceId(any(), anyLong())).thenReturn(Optional.of(stack)); when(stackService.getByNameOrCrnInWorkspace(any(), anyLong())).thenReturn(stack); when(requestValidator.validate(any(), any(), any())).thenReturn(getValidationResult(null)); service.validate(WORKSPACE_ID, ofName, null, null); }
public void validate(Long workspaceId, NameOrCrn nameOrCrn, String location, String backupId) { Stack stack = stackService.getByNameOrCrnInWorkspace(nameOrCrn, workspaceId); ValidationResult validationResult = requestValidator.validate(stack, location, backupId); if (validationResult.hasError()) { throw new BadRequestException(validationResult.getFormattedErrors()); } }
DatabaseBackupRestoreService { public void validate(Long workspaceId, NameOrCrn nameOrCrn, String location, String backupId) { Stack stack = stackService.getByNameOrCrnInWorkspace(nameOrCrn, workspaceId); ValidationResult validationResult = requestValidator.validate(stack, location, backupId); if (validationResult.hasError()) { throw new BadRequestException(validationResult.getFormattedErrors()); } } }
DatabaseBackupRestoreService { public void validate(Long workspaceId, NameOrCrn nameOrCrn, String location, String backupId) { Stack stack = stackService.getByNameOrCrnInWorkspace(nameOrCrn, workspaceId); ValidationResult validationResult = requestValidator.validate(stack, location, backupId); if (validationResult.hasError()) { throw new BadRequestException(validationResult.getFormattedErrors()); } }  }
DatabaseBackupRestoreService { public void validate(Long workspaceId, NameOrCrn nameOrCrn, String location, String backupId) { Stack stack = stackService.getByNameOrCrnInWorkspace(nameOrCrn, workspaceId); ValidationResult validationResult = requestValidator.validate(stack, location, backupId); if (validationResult.hasError()) { throw new BadRequestException(validationResult.getFormattedErrors()); } }  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 void validate(Long workspaceId, NameOrCrn nameOrCrn, String location, String backupId) { Stack stack = stackService.getByNameOrCrnInWorkspace(nameOrCrn, workspaceId); ValidationResult validationResult = requestValidator.validate(stack, location, backupId); if (validationResult.hasError()) { throw new BadRequestException(validationResult.getFormattedErrors()); } }  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);  }