public static void SetTenantData(string language)
        {
            try
            {
                using (var backupClient = new BackupServiceClient())
                {
                    int          tenantID = CoreContext.TenantManager.GetCurrentTenant().TenantId;
                    BackupResult result   = null;
                    do
                    {
                        if (result == null)
                        {
                            result = backupClient.RestorePortal(tenantID, language);
                        }
                        else
                        {
                            result = backupClient.GetRestoreStatus(tenantID);
                        }
                        Thread.Sleep(TimeSpan.FromSeconds(5));
                    } while (!result.Completed);
                    //Thread.Sleep(TimeSpan.FromSeconds(15)); // wait to invalidate users cache...
                }

                var apiServer = new ApiServer();
                apiServer.CallApiMethod(SetupInfo.WebApiBaseUrl + "/crm/settings", "PUT");
            }
            catch (Exception error)
            {
                LogManager.GetLogger("ASC.Web").Error("Can't set default data", error);
            }
        }
Exemplo n.º 2
0
        public void Should_BackupTwoEpisodes_When_FourEpisodesCollectedAndFourWatched_WithDuplicatedEpisodeNumbers()
        {
            // Arrange
            IMediaPortalServices mediaPortalServices = Substitute.For <IMediaPortalServices>();
            IContentDirectory    contentDirectory    = Substitute.For <IContentDirectory>();
            IList <MediaItem>    databaseMediaItems  = new List <MediaItem>
            {
                new MockedDatabaseEpisode("272127", 1, new List <int> {
                    7, 8
                }, 100).Episode,
                new MockedDatabaseEpisode("275278", 2, new List <int> {
                    1, 1, 1
                }, 100).Episode,
                new MockedDatabaseEpisode("275278", 4, new List <int> {
                    10, 10
                }, 100).Episode,
                new MockedDatabaseEpisode("275271", 2, new List <int> {
                    11, 12
                }, 90).Episode
            };

            contentDirectory.SearchAsync(Arg.Any <MediaItemQuery>(), true, null, false).Returns(databaseMediaItems);
            mediaPortalServices.GetServerConnectionManager().ContentDirectory.Returns(contentDirectory);
            IFileOperations fileOperations = Substitute.For <IFileOperations>();

            IMoverOperations operations = new MoverOperations(mediaPortalServices, fileOperations);

            // Act
            BackupResult result = operations.BackupSeries(FakePath);

            // Assert
            Assert.Equal(4, result.WatchedCount);
            Assert.Equal(6, result.CollectedCount);
        }
        public async Task BackupAndRestore()
        {
            var source = new CancellationTokenSource(TimeSpan.FromMinutes(2));

            UriBuilder builder = new UriBuilder(TestEnvironment.StorageUri);

            builder.Path = BlobContainerName;

            // Start the backup.
            BackupOperation backupOperation = await Client.StartBackupAsync(builder.Uri, "?" + SasToken, source.Token);

            // Wait for completion of the LRO.
            BackupResult backupResult = await backupOperation.WaitForCompletionAsync(source.Token);

            await WaitForOperationAsync();

            Assert.That(source.IsCancellationRequested, Is.False);
            Assert.That(backupResult, Is.Not.Null);
            Assert.That(backupOperation.HasValue, Is.True);

            // Start the restore.
            RestoreOperation restoreOperation = await Client.StartRestoreAsync(backupResult.FolderUri, "?" + SasToken, source.Token);

            // Wait for completion of the LRO
            var restoreResult = await restoreOperation.WaitForCompletionAsync(source.Token);

            await WaitForOperationAsync();

            Assert.That(source.IsCancellationRequested, Is.False);
            Assert.That(restoreResult, Is.Not.Null);
            Assert.That(restoreOperation.HasValue, Is.True);
        }
Exemplo n.º 4
0
        private static BackupResult ToResult(IProgressItem task)
        {
            if (task == null)
            {
                return(null);
            }

            if (task.Error != null)
            {
                throw new FaultException(((Exception)task.Error).Message);
            }

            var result = new BackupResult
            {
                Id        = task.Id.ToString(),
                Completed = task.IsCompleted,
                Percent   = (int)task.Percentage,
            };

            var backupTask = task as BackupTask;

            if (backupTask != null)
            {
                result.Link       = task.Status as string;
                result.ExpireDate = backupTask.ExpireDate;
            }
            return(result);
        }
Exemplo n.º 5
0
        /// <inheritdoc />
        public BackupResult BackupMovies(string path)
        {
            BackupResult result = new BackupResult {
                CollectedCount = 0, WatchedCount = 0
            };

            Guid[] types =
            {
                MediaAspect.ASPECT_ID,              MovieAspect.ASPECT_ID,            VideoAspect.ASPECT_ID, ImporterAspect.ASPECT_ID,
                ExternalIdentifierAspect.ASPECT_ID, ProviderResourceAspect.ASPECT_ID, VideoStreamAspect.ASPECT_ID
            };

            IContentDirectory contentDirectory = GetContentDirectory();
            Guid?userProfile = GetUserProfileId();

            IList <MediaItem> collectedMovieMediaItems = contentDirectory.SearchAsync(new MediaItemQuery(types, null, null), true, userProfile, false).Result;

            result.CollectedCount = collectedMovieMediaItems.Count;
            List <MediaItem>          watchedMovieMediaItems = collectedMovieMediaItems.Where(MediaItemAspectsUtl.IsWatched).ToList();
            IList <MediaLibraryMovie> watchedMovies          = new List <MediaLibraryMovie>();

            foreach (MediaItem watchedMovieItem in watchedMovieMediaItems)
            {
                watchedMovies.Add(new MediaLibraryMovie
                {
                    Title = MediaItemAspectsUtl.GetMovieTitle(watchedMovieItem),
                    Imdb  = MediaItemAspectsUtl.GetMovieImdbId(watchedMovieItem),
                    Year  = MediaItemAspectsUtl.GetMovieYear(watchedMovieItem)
                });
            }
            SaveLibraryMovies(path, watchedMovies);
            result.WatchedCount = watchedMovies.Count;

            return(result);
        }
Exemplo n.º 6
0
        private static BackupResult ToResult(BackupProgressItemBase task)
        {
            if (task == null)
            {
                return(null);
            }

            if (task.Error != null)
            {
                throw new FaultException(task.Error.Message);
            }

            var result = new BackupResult
            {
                Id        = task.TenantId.ToString(),
                Completed = task.IsCompleted,
                Percent   = task.Progress,
            };

            var backupTask = task as BackupProgressItem;

            if (backupTask != null)
            {
                result.Link       = backupTask.Link;
                result.ExpireDate = backupTask.ExpirationDate;
            }
            return(result);
        }
Exemplo n.º 7
0
        public LogInfo(string file)
        {
            if (string.IsNullOrEmpty(file))
            {
                throw new ArgumentNullException("file");
            }

            _logFile   = file;
            _timeStamp = File.GetCreationTime(_logFile);

            try
            {
                string contents = File.ReadAllText(_logFile);
                if (contents.Contains(Files.SuccesfullBackupMarkInHtmlLog))
                {
                    _result = BackupResult.Successfull;
                }
                else if (contents.Contains(Files.ErroneousBackupMarkInHtmlLog))
                {
                    _result = BackupResult.Erroneous;
                }
                else
                {
                    _result = BackupResult.Unknown;
                }
            }
            catch (IOException e)
            {
                _result = BackupResult.Unknown;
                System.Diagnostics.Debug.WriteLine("Cannot open file: " + file + ". This log file is still opened so it marked with unknown status:" + e.ToString());
            }
        }
Exemplo n.º 8
0
 /// <summary>
 /// Determines whether the result is considered an error.
 /// </summary>
 /// <param name="result">BackupResult value</param>
 /// <returns>true if an error</returns>
 public static bool IsError(this BackupResult result)
 {
     return(result == BackupResult.UnableToAccess ||
            result == BackupResult.UnauthorizedAccess ||
            result == BackupResult.Exception ||
            result == BackupResult.WriteInProgress ||
            result == BackupResult.PathTooLong);
 }
 public override void WriteResult(BackupResult result)
 {
     _writer.WriteLine($"    UPDATE photo.photo ");
     _writer.WriteLine($"       SET aws_glacier_vault_id = (SELECT id FROM aws.glacier_vault WHERE region = '{result.Region.SystemName}' AND vault_name = '{result.Vault}'),");
     _writer.WriteLine($"           aws_archive_id = '{result.Result?.ArchiveId}',");
     _writer.WriteLine($"           aws_treehash = '{result.Result?.Checksum}'");
     _writer.WriteLine($"     WHERE src_path = '/images/{result.Backup.GlacierDescription}';");
     _writer.WriteLine();
 }
Exemplo n.º 10
0
            internal static string PrintBackupResultMessagesStatus(BackupResult result)
            {
                if (result == null)
                {
                    return("No backup result.");
                }

                return(string.Join(Environment.NewLine, result.Messages));
            }
        public void TestConstructor(BackupResult result, string sourceFile, string targetDir)
        {
            // Source/Target properties read-only (set in constructor)
            BackupErrorInfo info = new(result, sourceFile, targetDir);

            Assert.AreEqual(result, info.Result);
            Assert.AreEqual(sourceFile, info.SourceFile);
            Assert.AreEqual(targetDir, info.TargetDir);
        }
Exemplo n.º 12
0
 private static ProgressInfo ToProgressInfo(BackupResult response)
 {
     return(new ProgressInfo
     {
         IsCompleted = response.Completed,
         Progress = response.Percent,
         Link = response.Link
     });
 }
Exemplo n.º 13
0
 private BackupRequest ToBackupRequest(BackupResult result)
 {
     return(new BackupRequest
     {
         Id = result.Id,
         Completed = result.Completed,
         FileLink = result.Link,
         Percentdone = result.Percent,
         Status = BackupRequestStatus.Started,
     });
 }
Exemplo n.º 14
0
        public void WriteResult(BackupResult result)
        {
            _csv.WriteField(result.Region.SystemName);
            _csv.WriteField(result.Vault);
            _csv.WriteField(result.Backup.FullPath);
            _csv.WriteField(result.Backup.GlacierDescription);
            _csv.WriteField(result.Result.ArchiveId);
            _csv.WriteField(result.Result.Checksum);

            _csv.NextRecord();
        }
Exemplo n.º 15
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: protected void doWork() throws Exception
        protected internal override void DoWork()
        {
            BackupResult backupResult = BackupHelper.backup(_backupHostname, _backupPort, _backupDir);

            if (!backupResult.Consistent)
            {
                throw new Exception("Inconsistent backup");
            }
            if (backupResult.TransientErrorOnBackup)
            {
                LockSupport.parkNanos(TimeUnit.MILLISECONDS.toNanos(10));
            }
        }
Exemplo n.º 16
0
        // GET: ServerResults/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BackupResult result = sprocs.ReturnBackupResult(0, (int)id).SingleOrDefault();

            if (result == null)
            {
                return(HttpNotFound());
            }
            return(View(result));
        }
Exemplo n.º 17
0
        /// <inheritdoc />
        public BackupResult BackupSeries(string path)
        {
            BackupResult result = new BackupResult {
                WatchedCount = 0, CollectedCount = 0
            };

            Guid[] types =
            {
                MediaAspect.ASPECT_ID,            EpisodeAspect.ASPECT_ID, VideoAspect.ASPECT_ID, ImporterAspect.ASPECT_ID,
                ProviderResourceAspect.ASPECT_ID, ExternalIdentifierAspect.ASPECT_ID
            };

            IContentDirectory contentDirectory = GetContentDirectory();
            Guid?userProfile = GetUserProfileId();

            IList <MediaItem> collectedEpisodeMediaItems = contentDirectory.Search(new MediaItemQuery(types, null, null), true, userProfile, false);

            foreach (MediaItem collectedEpisodeMediaItem in collectedEpisodeMediaItems)
            {
                List <int> episodeNumbers = MediaItemAspectsUtl.GetEpisodeNumbers(collectedEpisodeMediaItem);
                result.CollectedCount = result.CollectedCount + episodeNumbers.Count;
            }


            List <MediaItem> watchedEpisodeMediaItems = collectedEpisodeMediaItems.Where(MediaItemAspectsUtl.IsWatched).ToList();

            _mediaPortalServices.GetLogger().Info("watched {0}", watchedEpisodeMediaItems.Count);
            IList <MediaLibraryEpisode> watchedEpisodes = new List <MediaLibraryEpisode>();

            foreach (MediaItem watchedEpisodeItem in watchedEpisodeMediaItems)
            {
                List <int> episodeNumbers = MediaItemAspectsUtl.GetEpisodeNumbers(watchedEpisodeItem);
                _mediaPortalServices.GetLogger().Info("FlagMover: ep numb: {0}", episodeNumbers.Count);
                if (episodeNumbers.Any())
                {
                    AddEpisodes(watchedEpisodes, watchedEpisodeItem, episodeNumbers);
                }
                else
                {
                    _mediaPortalServices.GetLogger().Warn("FlagMover: Skipping series episode without episode number.");
                }
            }

            SaveLibraryEpisodes(path, watchedEpisodes);
            result.WatchedCount = watchedEpisodes.Count;

            return(result);
        }
Exemplo n.º 18
0
        /// <summary>
        /// Gets the description associated with the enum value.
        /// </summary>
        /// <param name="result">BackupResult value</param>
        /// <returns>enum description as string</returns>
        public static string GetDescription(this BackupResult result)
        {
            // Query enum for info
            FieldInfo?fi = result.GetType().GetField(result.ToString());

            if (fi != null)
            {
                // Get first description attribute
                DescriptionAttribute?attr = ((DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false)).FirstOrDefault();

                // Get description value (default to enum string if missing)
                return(attr?.Description ?? result.ToString());
            }

            return(result.ToString());
        }
Exemplo n.º 19
0
        public string CheckTransferProgress(string tenantID)
        {
            SecurityContext.DemandPermissions(SecutiryConstants.EditPortalSettings);
            if (string.IsNullOrEmpty(tenantID))
            {
                return(ToJsonSuccess(new BackupResult()));
            }

            try
            {
                using (var backupClient = new BackupServiceClient())
                {
                    BackupResult status = backupClient.GetTransferStatus(Convert.ToInt32(tenantID));
                    return(ToJsonSuccess(status));
                }
            }
            catch (Exception error)
            {
                return(ToJsonError(error.Message));
            }
        }
Exemplo n.º 20
0
        public void Should_BackupThreeMovies_When_FiveMoviesCollectedAndThreeWatched()
        {
            // Arrange
            IMediaPortalServices mediaPortalServices = Substitute.For <IMediaPortalServices>();
            IContentDirectory    contentDirectory    = Substitute.For <IContentDirectory>();
            IList <MediaItem>    databaseMediaItems  = new List <MediaItem>
            {
                new MockedDatabaseMovie(new MediaLibraryMovie {
                    Imdb = "tt0268380", Title = "Title_1", Tmdb = 12345, Year = 2017
                }, 100).Movie,
                new MockedDatabaseMovie(new MediaLibraryMovie {
                    Imdb = "tt0034492", Title = "Title_2", Tmdb = 12111, Year = 2016
                }, 100).Movie,
                new MockedDatabaseMovie(new MediaLibraryMovie {
                    Imdb = "tt1355630", Title = "Title_3", Tmdb = 12388, Year = 2013
                }, 100).Movie,
                new MockedDatabaseMovie(new MediaLibraryMovie {
                    Imdb = "tt1599348", Title = "Title_4", Tmdb = 12100, Year = 2011
                }, 10).Movie,
                new MockedDatabaseMovie(new MediaLibraryMovie {
                    Imdb = "tt0457939", Title = "Title_5", Tmdb = 12144, Year = 2010
                }, 0).Movie
            };

            contentDirectory.SearchAsync(Arg.Any <MediaItemQuery>(), true, null, false).Returns(databaseMediaItems);
            mediaPortalServices.GetServerConnectionManager().ContentDirectory.Returns(contentDirectory);
            IFileOperations fileOperations = Substitute.For <IFileOperations>();

            IMoverOperations operations = new MoverOperations(mediaPortalServices, fileOperations);

            // Act
            BackupResult result = operations.BackupMovies(FakePath);

            // Assert
            Assert.Equal(3, result.WatchedCount);
            Assert.Equal(5, result.CollectedCount);
        }
        private async Task CompareBackupResults(IAzureTableBackup backupSettings, BackupResult currentBackup)
        {
            var previousBackupTracker = await _azureTableBackupRepository.GetLastestBackupResultTrackerAsync(backupSettings);

            await _azureTableBackupRepository.AddBackupResultTrackerAsync(backupSettings, currentBackup);

            if (previousBackupTracker == null)
            {
                return;
            }

            var delta   = currentBackup.RowCount - previousBackupTracker.RowCount;
            var message = delta == 0 ? " same number of" : ((delta > 0) ? " more" : " less");
            await _loggingRepository.LogMessageAsync(
                new LogMessage
            {
                Message           = $"Current backup for {backupSettings.SourceTableName} has {delta}{message} rows than previous backup",
                DynamicProperties =
                {
                    { "status",   "Delta"          },
                    { "rowCount", delta.ToString() }
                }
            });
        }
Exemplo n.º 22
0
 public BackupException(BackupResult rc, string message) : base(message)
 {
     this.Result = rc;
 }
Exemplo n.º 23
0
 public void TestIsError(BackupResult result, bool canBeRetried)
 {
     Assert.AreEqual(canBeRetried, result.IsError());
 }
Exemplo n.º 24
0
 public static string ToString(this BackupResult result, Context context)
 {
     return(result.IsVoid()
         ? context.GetString(Resource.String.noAuthenticators)
         : String.Format(context.GetString(Resource.String.backupSuccess), result.FileName));
 }
Exemplo n.º 25
0
 public void TestGetDescription(BackupResult result, string description)
 {
     Assert.AreEqual(description, result.GetDescription());
 }
Exemplo n.º 26
0
 /// <summary>
 /// Determines whether the result is suitable for retry.
 /// </summary>
 /// <param name="result">BackupResult value</param>
 /// <returns>true if retry possible</returns>
 public static bool CanBeRetried(this BackupResult result)
 {
     return(result == BackupResult.WriteInProgress ||
            result == BackupResult.UnableToAccess);
 }
Exemplo n.º 27
0
 private static void TryGetBackupStatusFromPeriodicBackupAndPrint(OperationStatus expected, OperationStatus actual, long opId, PeriodicBackupRunner periodicBackupRunner, PeriodicBackupStatus status, BackupResult result)
 {
     if (status?.LastOperationId != opId)
     {
         // failed to save backup status, lets fetch it from memory
         var pb = periodicBackupRunner?.PeriodicBackups.FirstOrDefault(x => x.BackupStatus != null && x.BackupStatus.LastOperationId == opId);
         if (pb == null)
         {
             Assert.True(false,
                         $"Backup status expected: '{expected}', actual '{actual}',{Environment.NewLine}Could not fetch backup status for current operation id: '{opId}', previous backup status:{Environment.NewLine}" +
                         PrintBackupStatus(status) + Environment.NewLine + "BackupResult Messages:" + Environment.NewLine + PrintBackupResultMessagesStatus(result));
         }
         else
         {
             Assert.True(false,
                         $"Backup status expected: '{expected}', actual '{actual}',{Environment.NewLine}Could not fetch backup status from storage for current operation id: '{opId}', current in memory backup status:{Environment.NewLine}" +
                         PrintBackupStatus(pb.BackupStatus) + Environment.NewLine + "BackupResult Messages:" + Environment.NewLine +
                         PrintBackupResultMessagesStatus(result));
         }
     }
 }
Exemplo n.º 28
0
        private static string ToJsonSuccess(BackupResult result)
        {
            var data = new { result.Completed, result.Id, result.Percent };

            return(JsonConvert.SerializeObject(new { success = true, data }));
        }
Exemplo n.º 29
0
 public ActionResult DeleteConfirmed(BackupResult result)
 {
     sprocs.DeleteBackupResult(result.ResultID);
     return(RedirectToAction("Index", new { backupID = result.ServerBackup_BackupID }));
 }
Exemplo n.º 30
0
        private void can_backup_and_restore_internal(bool oneTimeBackup)
        {
            using (var holder = new Azure.AzureClientHolder(AzureFactAttribute.AzureSettings))
            {
                using (var store = GetDocumentStore())
                {
                    using (var session = store.OpenSession())
                    {
                        session.Store(new User {
                            Name = "oren"
                        }, "users/1");
                        session.CountersFor("users/1").Increment("likes", 100);
                        session.SaveChanges();
                    }

                    PeriodicBackupStatus status = null;
                    long backupTaskId           = 0;
                    GetPeriodicBackupStatusOperation operation = null;
                    BackupResult backupResult = null;
                    if (oneTimeBackup == false)
                    {
                        var config = new PeriodicBackupConfiguration {
                            BackupType = BackupType.Backup, AzureSettings = holder.Settings, IncrementalBackupFrequency = "0 0 1 1 *"
                        };
                        backupTaskId = (store.Maintenance.Send(new UpdatePeriodicBackupOperation(config))).TaskId;
                        operation    = new GetPeriodicBackupStatusOperation(backupTaskId);
                        store.Maintenance.Send(new StartBackupOperation(true, backupTaskId));

                        var value = WaitForValue(() =>
                        {
                            status = store.Maintenance.Send(operation).Status;
                            return(status?.LastEtag);
                        }, 4);
                        Assert.True(4 == value, $"4 == value, Got status: {status != null}, exception: {status?.Error?.Exception}");
                        Assert.True(status.LastOperationId != null, $"status.LastOperationId != null, Got status: {status != null}, exception: {status?.Error?.Exception}");

                        OperationState backupOperation = null;
                        var            operationStatus = WaitForValue(() =>
                        {
                            backupOperation = store.Maintenance.Send(new GetOperationStateOperation(status.LastOperationId.Value));
                            return(backupOperation.Status);
                        }, OperationStatus.Completed);
                        Assert.Equal(OperationStatus.Completed, operationStatus);

                        backupResult = backupOperation.Result as BackupResult;
                        Assert.NotNull(backupResult);
                        Assert.True(backupResult.Counters.Processed, "backupResult.Counters.Processed");
                        Assert.Equal(1, backupResult.Counters.ReadCount);
                    }

                    using (var session = store.OpenSession())
                    {
                        session.Store(new User {
                            Name = "ayende"
                        }, "users/2");
                        session.CountersFor("users/2").Increment("downloads", 200);

                        session.SaveChanges();
                    }

                    if (oneTimeBackup == false)
                    {
                        var lastEtag = store.Maintenance.Send(new GetStatisticsOperation()).LastDocEtag;
                        store.Maintenance.Send(new StartBackupOperation(false, backupTaskId));
                        var value2 = WaitForValue(() => store.Maintenance.Send(operation).Status.LastEtag, lastEtag);
                        Assert.Equal(lastEtag, value2);
                    }

                    if (oneTimeBackup)
                    {
                        var backupConfiguration = new BackupConfiguration
                        {
                            BackupType    = BackupType.Backup,
                            AzureSettings = holder.Settings,
                        };

                        backupResult = (BackupResult)store.Maintenance.Send(new BackupOperation(backupConfiguration)).WaitForCompletion(TimeSpan.FromSeconds(15));
                        Assert.True(backupResult != null && backupResult.Counters.Processed, "backupResult != null && backupResult.Counters.Processed");
                        Assert.Equal(2, backupResult.Counters.ReadCount);
                    }

                    // restore the database with a different name
                    var databaseName = $"restored_database-{Guid.NewGuid()}";

                    holder.Settings.RemoteFolderName = oneTimeBackup ? $"{holder.Settings.RemoteFolderName}/{backupResult.LocalBackup.BackupDirectory}" : $"{holder.Settings.RemoteFolderName}/{status.FolderName}";
                    var restoreFromGoogleCloudConfiguration = new RestoreFromAzureConfiguration()
                    {
                        DatabaseName        = databaseName,
                        Settings            = holder.Settings,
                        DisableOngoingTasks = true
                    };
                    var googleCloudOperation = new RestoreBackupOperation(restoreFromGoogleCloudConfiguration);
                    var restoreOperation     = store.Maintenance.Server.Send(googleCloudOperation);

                    restoreOperation.WaitForCompletion(TimeSpan.FromSeconds(30));
                    using (var store2 = GetDocumentStore(new Options()
                    {
                        CreateDatabase = false, ModifyDatabaseName = s => databaseName
                    }))
                    {
                        using (var session = store2.OpenSession(databaseName))
                        {
                            var users = session.Load <User>(new[] { "users/1", "users/2" });
                            Assert.True(users.Any(x => x.Value.Name == "oren"));
                            Assert.True(users.Any(x => x.Value.Name == "ayende"));

                            var val = session.CountersFor("users/1").Get("likes");
                            Assert.Equal(100, val);
                            val = session.CountersFor("users/2").Get("downloads");
                            Assert.Equal(200, val);
                        }

                        var originalDatabase = Server.ServerStore.DatabasesLandlord.TryGetOrCreateResourceStore(store.Database).Result;
                        var restoredDatabase = Server.ServerStore.DatabasesLandlord.TryGetOrCreateResourceStore(databaseName).Result;
                        using (restoredDatabase.DocumentsStorage.ContextPool.AllocateOperationContext(out DocumentsOperationContext ctx))
                            using (ctx.OpenReadTransaction())
                            {
                                var databaseChangeVector = DocumentsStorage.GetDatabaseChangeVector(ctx);
                                Assert.Contains($"A:7-{originalDatabase.DbBase64Id}", databaseChangeVector);
                                Assert.Contains($"A:8-{restoredDatabase.DbBase64Id}", databaseChangeVector);
                            }
                    }
                }
            }
        }