Skip to content

Commit 00ea126

Browse files
Remove unnecessary BatchConfiguration class and use ConfigurationManager directly
Co-authored-by: kirankumarkolli <6880899+kirankumarkolli@users.noreply.github.com>
1 parent 8abde21 commit 00ea126

4 files changed

Lines changed: 12 additions & 35 deletions

File tree

Microsoft.Azure.Cosmos/src/Batch/BatchAsyncContainerExecutorCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public BatchAsyncContainerExecutor GetExecutorForContainer(
3636
BatchAsyncContainerExecutor newExecutor = new BatchAsyncContainerExecutor(
3737
container,
3838
cosmosClientContext,
39-
BatchConfiguration.GetMaxOperationsInDirectModeBatchRequest(),
39+
ConfigurationManager.GetMaxOperationsInDirectModeBatchRequest(),
4040
DefaultMaxBulkRequestBodySizeInBytes);
4141
if (!this.executorsPerContainer.TryAdd(containerLink, newExecutor))
4242
{

Microsoft.Azure.Cosmos/src/Batch/BatchConfiguration.cs

Lines changed: 0 additions & 23 deletions
This file was deleted.

Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Batch/BatchAsyncContainerExecutorCacheTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public void GetExecutorForContainer_UsesCustomMaxOperationsFromEnvironment()
104104
Assert.IsNotNull(executor);
105105
// The executor should be created with the custom max operations value
106106
// We verify this indirectly by ensuring the executor was created successfully
107-
// The actual value is verified in the BatchConfiguration tests
107+
// The actual value is verified in the ConfigurationManager tests
108108
}
109109
finally
110110
{

Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Batch/BatchConfigurationTests.cs renamed to Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Batch/ConfigurationManagerBatchTests.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace Microsoft.Azure.Cosmos.Tests
99
using Microsoft.VisualStudio.TestTools.UnitTesting;
1010

1111
[TestClass]
12-
public class BatchConfigurationTests
12+
public class ConfigurationManagerTests
1313
{
1414
private const string EnvironmentVariableName = "COSMOS_MAX_OPERATIONS_IN_DIRECT_MODE_BATCH_REQUEST";
1515

@@ -27,7 +27,7 @@ public void GetMaxOperationsInDirectModeBatchRequest_WhenEnvironmentVariableNotS
2727
Environment.SetEnvironmentVariable(EnvironmentVariableName, null);
2828

2929
// Act
30-
int result = BatchConfiguration.GetMaxOperationsInDirectModeBatchRequest();
30+
int result = ConfigurationManager.GetMaxOperationsInDirectModeBatchRequest();
3131

3232
// Assert
3333
Assert.AreEqual(Constants.MaxOperationsInDirectModeBatchRequest, result);
@@ -41,7 +41,7 @@ public void GetMaxOperationsInDirectModeBatchRequest_WhenEnvironmentVariableSetT
4141
Environment.SetEnvironmentVariable(EnvironmentVariableName, expectedValue.ToString());
4242

4343
// Act
44-
int result = BatchConfiguration.GetMaxOperationsInDirectModeBatchRequest();
44+
int result = ConfigurationManager.GetMaxOperationsInDirectModeBatchRequest();
4545

4646
// Assert
4747
Assert.AreEqual(expectedValue, result);
@@ -55,7 +55,7 @@ public void GetMaxOperationsInDirectModeBatchRequest_WhenEnvironmentVariableSetT
5555
Environment.SetEnvironmentVariable(EnvironmentVariableName, expectedValue.ToString());
5656

5757
// Act
58-
int result = BatchConfiguration.GetMaxOperationsInDirectModeBatchRequest();
58+
int result = ConfigurationManager.GetMaxOperationsInDirectModeBatchRequest();
5959

6060
// Assert
6161
Assert.AreEqual(expectedValue, result);
@@ -71,7 +71,7 @@ public void GetMaxOperationsInDirectModeBatchRequest_WhenEnvironmentVariableSetT
7171
Environment.SetEnvironmentVariable(EnvironmentVariableName, valueGreaterThanMax.ToString());
7272

7373
// Act
74-
BatchConfiguration.GetMaxOperationsInDirectModeBatchRequest();
74+
ConfigurationManager.GetMaxOperationsInDirectModeBatchRequest();
7575

7676
// Assert - ExpectedException
7777
}
@@ -84,7 +84,7 @@ public void GetMaxOperationsInDirectModeBatchRequest_WhenEnvironmentVariableSetT
8484
Environment.SetEnvironmentVariable(EnvironmentVariableName, "0");
8585

8686
// Act
87-
BatchConfiguration.GetMaxOperationsInDirectModeBatchRequest();
87+
ConfigurationManager.GetMaxOperationsInDirectModeBatchRequest();
8888

8989
// Assert - ExpectedException
9090
}
@@ -97,7 +97,7 @@ public void GetMaxOperationsInDirectModeBatchRequest_WhenEnvironmentVariableSetT
9797
Environment.SetEnvironmentVariable(EnvironmentVariableName, "-1");
9898

9999
// Act
100-
BatchConfiguration.GetMaxOperationsInDirectModeBatchRequest();
100+
ConfigurationManager.GetMaxOperationsInDirectModeBatchRequest();
101101

102102
// Assert - ExpectedException
103103
}
@@ -110,7 +110,7 @@ public void GetMaxOperationsInDirectModeBatchRequest_WhenEnvironmentVariableSetT
110110
Environment.SetEnvironmentVariable(EnvironmentVariableName, "invalid");
111111

112112
// Act
113-
BatchConfiguration.GetMaxOperationsInDirectModeBatchRequest();
113+
ConfigurationManager.GetMaxOperationsInDirectModeBatchRequest();
114114

115115
// Assert - ExpectedException
116116
}
@@ -122,7 +122,7 @@ public void GetMaxOperationsInDirectModeBatchRequest_WhenEnvironmentVariableSetT
122122
Environment.SetEnvironmentVariable(EnvironmentVariableName, "");
123123

124124
// Act
125-
int result = BatchConfiguration.GetMaxOperationsInDirectModeBatchRequest();
125+
int result = ConfigurationManager.GetMaxOperationsInDirectModeBatchRequest();
126126

127127
// Assert
128128
Assert.AreEqual(Constants.MaxOperationsInDirectModeBatchRequest, result);
@@ -136,7 +136,7 @@ public void GetMaxOperationsInDirectModeBatchRequest_WhenEnvironmentVariableSetT
136136
Environment.SetEnvironmentVariable(EnvironmentVariableName, expectedValue.ToString());
137137

138138
// Act
139-
int result = BatchConfiguration.GetMaxOperationsInDirectModeBatchRequest();
139+
int result = ConfigurationManager.GetMaxOperationsInDirectModeBatchRequest();
140140

141141
// Assert
142142
Assert.AreEqual(expectedValue, result);

0 commit comments

Comments
 (0)