public void TableOperationExecuteRetryAPM() { CloudTableClient tableClient = GenerateCloudTableClient(); DynamicTableEntity insertEntity = new DynamicTableEntity("insert test", "foo"); for (int m = 0; m < 20; m++) { insertEntity.Properties.Add("prop" + m.ToString(), new EntityProperty(new byte[50 * 1024])); } TestHelper.ExecuteAPMMethodWithRetry(3, new[] { //Insert upstream network delay to prevent upload to server @ 1000ms / kb PerformanceBehaviors.InsertUpstreamNetworkDelay(10000, XStoreSelectors.TableTraffic().IfHostNameContains(tableClient.Credentials.AccountName), new BehaviorOptions(2)), // After 500 ms return throttle message DelayedActionBehaviors.ExecuteAfter(Actions.ThrottleTableRequest, 100, XStoreSelectors.TableTraffic().IfHostNameContains(tableClient.Credentials.AccountName), new BehaviorOptions(2)) }, (options, opContext, callback, state) => currentTable.BeginExecute(TableOperation.Insert(insertEntity), (TableRequestOptions)options, opContext, callback, state), (res) => currentTable.EndExecute(res)); }
public void TableIngressEgressTableOperation() { CloudTableClient tableClient = GenerateCloudTableClient(); DynamicTableEntity insertEntity = new DynamicTableEntity("insert test", "foo"); for (int m = 0; m < 20; m++) { insertEntity.Properties.Add("prop" + m.ToString(), new EntityProperty(new byte[50 * 1024])); } // APM TestHelper.ValidateIngressEgress(Selectors.IfUrlContains(currentTable.Uri.ToString()), () => { OperationContext opContext = new OperationContext(); currentTable.EndExecute(currentTable.BeginExecute(TableOperation.InsertOrMerge(insertEntity), new TableRequestOptions() { RetryPolicy = new RetryPolicies.NoRetry() }, opContext, null, null)); return(opContext.LastResult); }); // Sync TestHelper.ValidateIngressEgress(Selectors.IfUrlContains(currentTable.Uri.ToString()), () => { OperationContext opContext = new OperationContext(); currentTable.Execute(TableOperation.InsertOrMerge(insertEntity), new TableRequestOptions() { RetryPolicy = new RetryPolicies.NoRetry() }, opContext); return(opContext.LastResult); }); }
public void TableOperationCancellation() { CloudTableClient tableClient = GenerateCloudTableClient(); DynamicTableEntity insertEntity = new DynamicTableEntity("insert test", "foo"); for (int m = 0; m < 20; m++) { insertEntity.Properties.Add("prop" + m.ToString(), new EntityProperty(new byte[50 * 1024])); } TestHelper.ExecuteAPMMethodWithCancellation(4000, new[] { DelayBehaviors.DelayAllRequestsIf(4000 * 3, XStoreSelectors.TableTraffic().IfHostNameContains(tableClient.Credentials.AccountName)) }, (options, opContext, callback, state) => currentTable.BeginExecute(TableOperation.Insert(insertEntity), (TableRequestOptions)options, opContext, callback, state), (res) => currentTable.EndExecute(res)); }