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); }
public void MultiUploadLargeFileIsSuccessful() { var data = AmazonTestsHelper.RandomData(7 * 1024); WriteData(_location, null, data); var metadata = GetMetadata(_location); Assert.IsNotNull(metadata); }
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"]); }
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); }
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()); }
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"]); }
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); }
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"]); }
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()); }
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"]); }
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)); }
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"]); }