Exemplo n.º 1
0
        public virtual void TestGetNextVolumeWithClosedVolume()
        {
            FsVolumeList volumeList = new FsVolumeList(Collections.EmptyList <VolumeFailureInfo
                                                                              >(), blockScanner, blockChooser);
            IList <FsVolumeImpl> volumes = new AList <FsVolumeImpl>();

            for (int i = 0; i < 3; i++)
            {
                FilePath curDir = new FilePath(baseDir, "nextvolume-" + i);
                curDir.Mkdirs();
                FsVolumeImpl volume = new FsVolumeImpl(dataset, "storage-id", curDir, conf, StorageType
                                                       .Default);
                volume.SetCapacityForTesting(1024 * 1024 * 1024);
                volumes.AddItem(volume);
                volumeList.AddVolume(volume.ObtainReference());
            }
            // Close the second volume.
            volumes[1].CloseAndWait();
            for (int i_1 = 0; i_1 < 10; i_1++)
            {
                using (FsVolumeReference @ref = volumeList.GetNextVolume(StorageType.Default, 128
                                                                         ))
                {
                    // volume No.2 will not be chosen.
                    Assert.AssertNotEquals(@ref.GetVolume(), volumes[1]);
                }
            }
        }