示例#1
0
        public virtual async Task Init()
        {
            _bucket = "kalixtest";
            _client = await AmazonTestsHelper.SetupBlob(_bucket, "kalix-leo-tests\\AmazonStoreTests.testdata").ConfigureAwait(false);

            _location = new StoreLocation("kalix-leo-tests", "AmazonStoreTests.testdata");
            _store    = new AmazonStore(_client, _bucket);
        }
示例#2
0
            public void MultiUploadLargeFileIsSuccessful()
            {
                var data = AmazonTestsHelper.RandomData(7 * 1024);

                WriteData(_location, null, data);

                var metadata = GetMetadata(_location);

                Assert.IsNotNull(metadata);
            }
示例#3
0
            public async Task HasMetadataCorrectlySavesIt()
            {
                var data = AmazonTestsHelper.RandomData(1);
                var m    = new Metadata();

                m["metadata1"] = "somemetadata";
                WriteData(_location, m, data);

                var metadata = await GetMetadata(_location).ConfigureAwait(false);

                Assert.AreEqual("somemetadata", metadata["metadata1"]);
            }
示例#4
0
            public void BlobThatIsSoftDeletedShouldNotBeLoadable()
            {
                var data = AmazonTestsHelper.RandomData(1);

                WriteData(_location, null, data);

                _store.PermanentDelete(_location).Wait();

                var result = _store.LoadData(_location).Result;

                Assert.IsNull(result);
            }
示例#5
0
            public void SingleSnapshotCanBeFound()
            {
                var data = AmazonTestsHelper.RandomData(1);
                var m    = new Metadata();

                m["metadata1"] = "metadata";
                WriteData(_location, m, data);

                var snapshots = _store.FindSnapshots(_location).ToEnumerable();

                Assert.AreEqual(1, snapshots.Count());
            }
示例#6
0
            public void MetadataIsTransferedWhenSelectingAStream()
            {
                var data = AmazonTestsHelper.RandomData(1);
                var m    = new Metadata();

                m["metadata1"] = "metadata";
                WriteData(_location, m, data);

                var result = _store.LoadData(_location).Result;

                Assert.AreEqual("metadata", result.Metadata["metadata1"]);
            }
示例#7
0
            public void ShouldDeleteAllSnapshots()
            {
                var data = AmazonTestsHelper.RandomData(1);

                WriteData(_location, null, data);
                var shapshot = _store.FindSnapshots(_location).ToEnumerable().Single().Id;

                _store.PermanentDelete(_location).Wait();

                var result = _store.LoadData(_location, shapshot).Result;

                Assert.IsNull(result);
            }
示例#8
0
            public void FindsMetadataIncludingSizeAndLength()
            {
                var data = AmazonTestsHelper.RandomData(1);
                var m    = new Metadata();

                m["metadata1"] = "somemetadata";
                WriteData(_location, m, data);

                var result = _store.GetMetadata(_location).Result;

                Assert.AreEqual("1024", result[MetadataConstants.ContentLengthMetadataKey]);
                Assert.IsTrue(result.ContainsKey(MetadataConstants.ModifiedMetadataKey));
                Assert.AreEqual("somemetadata", result["metadata1"]);
            }
示例#9
0
            public async Task SubItemBlobSnapshotsAreNotIncluded()
            {
                var data = AmazonTestsHelper.RandomData(1);

                WriteData(_location, null, data);

                await AmazonTestsHelper.SetupBlob(_bucket, "kalix-leo-tests\\AzureStoreTests.testdata\\subitem.data").ConfigureAwait(false);

                var location2 = new StoreLocation("kalix-leo-tests", "AzureStoreTests.testdata\\subitem.data");

                WriteData(location2, null, data);

                var snapshots = _store.FindSnapshots(_location).ToList().Result;

                Assert.AreEqual(1, snapshots.Count());
            }
示例#10
0
            public void MetadataIsTransferedWhenSelectingAStream()
            {
                var data = AmazonTestsHelper.RandomData(1);
                var m    = new Metadata();

                m["metadata1"] = "metadata";
                WriteData(_location, m, data);
                var snapshots = _store.FindSnapshots(_location).ToList().Result;

                Assert.AreEqual(1, snapshots.Count);

                var shapshot = snapshots.Single().Id;

                var result = _store.LoadData(_location, shapshot).Result;

                Assert.AreEqual("metadata", result.Metadata["metadata1"]);
            }
示例#11
0
            public void AllDataLoadsCorrectly()
            {
                var data = AmazonTestsHelper.RandomData(1);

                WriteData(_location, null, data);

                var result = _store.LoadData(_location).Result;

                byte[] downloadedData;
                using (var ms = new MemoryStream())
                {
                    result.Stream.CopyToStream(ms, CancellationToken.None).Wait();
                    downloadedData = ms.ToArray();
                }

                Assert.IsTrue(data.SequenceEqual(downloadedData));
            }
示例#12
0
            public async Task AlwaysOverridesMetadata()
            {
                var data = AmazonTestsHelper.RandomData(1);
                var m    = new Metadata();

                m["metadata1"] = "somemetadata";
                WriteData(_location, m, data);

                var m2 = new Metadata();

                m2["metadata2"] = "othermetadata";
                WriteData(_location, m2, data);

                var metadata = await GetMetadata(_location).ConfigureAwait(false);

                Assert.IsFalse(metadata.ContainsKey("metadata1"));
                Assert.AreEqual("othermetadata", metadata["metadata2"]);
            }