public async Task when_the_snapshot_is_over_table_storage_limits_it_should_save_and_load_to_blob_storage()
        {
            var blobStore               = new BlobStore(new BlobSettings());
            var azureBlobStore          = new AzureBlobSnapshotStore(blobStore);
            var azureTableService       = new AzureTableService(new AzureTableSettings());
            var domainEntityTypeBuilder = new DomainEntityTypeBuilder();
            var sut = new AzureTableSnapshotStore(
                azureBlobStore,
                new AzureSnapshotBuilder(azureBlobStore),
                azureTableService,
                domainEntityTypeBuilder
                );
            var item = new SnapshotContent {
                AggregateRootId = new Guid("cc3ea6b8-6396-4c95-be2e-4d90f2c23736")
            };

            // set a new AggregateRootId for this to be tested
            //var snapshot = await sut.GetSnapshot(item.AggregateRootId).ConfigureAwait(false);
            //snapshot.ShouldBeNull();

            item.SetToLength(99999);
            await sut.SaveSnapshot(item).ConfigureAwait(false);

            var snapshot = await sut.GetSnapshot(item.AggregateRootId).ConfigureAwait(false);

            snapshot.ShouldNotBeNull();
            var cast = snapshot as SnapshotContent;

            cast.ShouldNotBeNull();
            cast.Content.Count.ShouldBe(item.Content.Count);
        }
Exemple #2
0
 public static System.Collections.IEnumerable ListTables(
     SqlString accountName, SqlString sharedKey, SqlBoolean useHTTPS,
     SqlString xmsclientrequestId)
 {
     ITPCfSQL.Azure.AzureTableService ats = new AzureTableService(accountName.Value, sharedKey.Value, useHTTPS.Value);
     return(ats.ListTables(xmsclientrequestId != null ? xmsclientrequestId.Value : null));
 }
        public async Task when_the_snapshot_is_under_table_storage_limits_it_should_save_and_load_to_table_storage()
        {
            var blobStore         = new BlobStore(new BlobSettings());
            var azureBlobStore    = new AzureBlobSnapshotStore(blobStore);
            var azureTableService = new AzureTableService(new AzureTableSettings());
            var sut = new AzureTableSnapshotStore(
                azureBlobStore,
                new AzureSnapshotBuilder(azureBlobStore),
                azureTableService,
                new DomainEntityTypeBuilder()
                );
            var item = new SnapshotContent {
                AggregateRootId = new Guid("b87bc654-3d76-4a46-ab58-c71c16b6a000")
            };

            item.SetToLength(10);
            await sut.SaveSnapshot(item).ConfigureAwait(false);

            var snapshot = await sut.GetSnapshot(item.AggregateRootId).ConfigureAwait(false);

            snapshot.ShouldNotBeNull();
            var cast = snapshot as SnapshotContent;

            cast.ShouldNotBeNull();
            cast.Content.Count.ShouldBe(item.Content.Count);
        }
Exemple #4
0
 public static void CreateTable(
     SqlString accountName, SqlString sharedKey, SqlBoolean useHTTPS,
     SqlString tableName,
     SqlString xmsclientrequestId)
 {
     ITPCfSQL.Azure.AzureTableService ats = new AzureTableService(accountName.Value, sharedKey.Value, useHTTPS.Value);
     ats.CreateTable(tableName.Value, xmsclientrequestId != null ? xmsclientrequestId.Value : null);
 }
Exemple #5
0
 public static void CreateTable(
     SqlString accountName, SqlString sharedKey, SqlBoolean useHTTPS,
     SqlString tableName,
     SqlString xmsclientrequestId)
 {
     ITPCfSQL.Azure.AzureTableService ats = new AzureTableService(accountName.Value, sharedKey.Value, useHTTPS.Value);
     ats.CreateTable(tableName.Value, xmsclientrequestId != null ? xmsclientrequestId.Value : null);
 }
Exemple #6
0
 public static void DropTable(
     SqlString accountName, SqlString sharedKey, SqlBoolean useHTTPS,
     SqlString tableName,
     SqlGuid xmsclientrequestId)
 {
     ITPCfSQL.Azure.AzureTableService ats = new AzureTableService(accountName.Value, sharedKey.Value, useHTTPS.Value);
     ats.GetTable(tableName.Value).Drop(
         xmsclientrequestId.IsNull ? (Guid?)null : xmsclientrequestId.Value);
 }
Exemple #7
0
 public static void DropTable(
     SqlString accountName, SqlString sharedKey, SqlBoolean useHTTPS,
     SqlString tableName,
     SqlGuid xmsclientrequestId)
 {
     ITPCfSQL.Azure.AzureTableService ats = new AzureTableService(accountName.Value, sharedKey.Value, useHTTPS.Value);
     ats.GetTable(tableName.Value).Drop(
         xmsclientrequestId.IsNull ? (Guid?)null : xmsclientrequestId.Value);
 }
Exemple #8
0
 public static void DeleteEntity(
     SqlString accountName, SqlString sharedKey, SqlBoolean useHTTPS,
     SqlString tableName,
     SqlString partitionKey,
     SqlString rowKey,
     SqlString xmsclientrequestId)
 {
     ITPCfSQL.Azure.AzureTableService ats = new AzureTableService(accountName.Value, sharedKey.Value, useHTTPS.Value);
     ITPCfSQL.Azure.Table table = ats.GetTable(tableName.Value);
     table.Delete(new ITPCfSQL.Azure.TableEntity() { RowKey = rowKey.Value, PartitionKey = partitionKey.Value, TimeStamp = DateTime.Now },
         (xmsclientrequestId != null ? xmsclientrequestId.Value : null));
 }
Exemple #9
0
 public static void DeleteEntity(
     SqlString accountName, SqlString sharedKey, SqlBoolean useHTTPS,
     SqlString tableName,
     SqlString partitionKey,
     SqlString rowKey,
     SqlString xmsclientrequestId)
 {
     ITPCfSQL.Azure.AzureTableService ats   = new AzureTableService(accountName.Value, sharedKey.Value, useHTTPS.Value);
     ITPCfSQL.Azure.Table             table = ats.GetTable(tableName.Value);
     table.Delete(new ITPCfSQL.Azure.TableEntity()
     {
         RowKey = rowKey.Value, PartitionKey = partitionKey.Value, TimeStamp = DateTime.Now
     },
                  (xmsclientrequestId != null ? xmsclientrequestId.Value : null));
 }
        public async Task when_the_snapshot_changes_from_under_to_over_limits()
        {
            var blobStore         = new BlobStore(new BlobSettings());
            var azureBlobStore    = new AzureBlobSnapshotStore(blobStore);
            var azureTableService = new AzureTableService(new AzureTableSettings());
            var sut = new AzureTableSnapshotStore(
                azureBlobStore,
                new AzureSnapshotBuilder(azureBlobStore),
                azureTableService,
                new DomainEntityTypeBuilder()
                );
            var item = new SnapshotContent {
                AggregateRootId = new Guid("e8ae8dd3-d3fd-434a-9775-82887bf1b2ce")
            };

            item.SetToLength(10);
            await sut.SaveSnapshot(item).ConfigureAwait(false);

            var snapshot = await sut.GetSnapshot(item.AggregateRootId).ConfigureAwait(false);

            snapshot.ShouldNotBeNull();
            var cast = snapshot as SnapshotContent;

            cast.ShouldNotBeNull();
            cast.Content.Count.ShouldBe(item.Content.Count);

            item.Content.Clear();
            item.SetToLength(99999);

            await sut.SaveSnapshot(item).ConfigureAwait(false);

            snapshot = await sut.GetSnapshot(item.AggregateRootId).ConfigureAwait(false);

            snapshot.ShouldNotBeNull();
            cast = snapshot as SnapshotContent;
            cast.ShouldNotBeNull();
            cast.Content.Count.ShouldBe(item.Content.Count);
        }
Exemple #11
0
        public static void InsertOrReplaceEntity(
            SqlString accountName, SqlString sharedKey, SqlBoolean useHTTPS,
            SqlString tableName,
            SqlString partitionKey,
            SqlString rowKey,
            SqlXml AttributeList,
            SqlString xmsclientrequestId)
        {
            ITPCfSQL.Azure.AzureTableService ats   = new AzureTableService(accountName.Value, sharedKey.Value, useHTTPS.Value);
            ITPCfSQL.Azure.Table             table = ats.GetTable(tableName.Value);

            ITPCfSQL.Azure.TableEntity te = new TableEntity(partitionKey.Value, rowKey.Value);

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.LoadXml(AttributeList.Value);

            foreach (System.Xml.XmlNode nAttrib in doc.FirstChild.ChildNodes)
            {
                te.Attributes[nAttrib.Name] = nAttrib.InnerText;
            }

            table.InsertOrUpdate(te,
                                 xmsclientrequestId != null ? xmsclientrequestId.Value : null);
        }
Exemple #12
0
        public static void InsertOrReplaceEntity(
            SqlString accountName, SqlString sharedKey, SqlBoolean useHTTPS,
            SqlString tableName,
            SqlString partitionKey,
            SqlString rowKey,
            SqlXml AttributeList,
            SqlString xmsclientrequestId)
        {
            ITPCfSQL.Azure.AzureTableService ats = new AzureTableService(accountName.Value, sharedKey.Value, useHTTPS.Value);
            ITPCfSQL.Azure.Table table = ats.GetTable(tableName.Value);

            ITPCfSQL.Azure.TableEntity te = new TableEntity(partitionKey.Value, rowKey.Value);

            System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
            doc.LoadXml(AttributeList.Value);

            foreach (System.Xml.XmlNode nAttrib in doc.FirstChild.ChildNodes)
            {
                te.Attributes[nAttrib.Name] = nAttrib.InnerText;
            }

            table.InsertOrUpdate(te,
                xmsclientrequestId != null ? xmsclientrequestId.Value : null);
        }
Exemple #13
0
        public static System.Collections.IEnumerable QueryTable(
            SqlString accountName, SqlString sharedKey, SqlBoolean useHTTPS,
            SqlString tableName,
            SqlString xmsclientrequestId)
        {
            ITPCfSQL.Azure.AzureTableService ats = new AzureTableService(accountName.Value, sharedKey.Value, useHTTPS.Value);
            ITPCfSQL.Azure.Table t = ats.GetTable(tableName.Value);

            return t.Query(xmsclientrequestId != null ? xmsclientrequestId.Value : null);
        }