Skip to content

Commit

Permalink
do not Autowired cosmosTemplate
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackbaud-MikeLueders committed Oct 3, 2021
1 parent ab366c5 commit 1017b80
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -663,20 +663,20 @@ public void createWithAutoscale() throws ClassNotFoundException {

@Test
public void createDatabaseWithThroughput() throws ClassNotFoundException {
final String dbName = TestConstants.DB_NAME + "-other";
deleteDatabaseIfExists(dbName);
final String configuredThroughputDbName = TestConstants.DB_NAME + "-configured-throughput";
deleteDatabaseIfExists(configuredThroughputDbName);

Integer expectedRequestUnits = 700;
final CosmosConfig config = CosmosConfig.builder()
.enableDatabaseThroughput(false, expectedRequestUnits)
.build();
cosmosTemplate = createCosmosTemplate(config, dbName);
final CosmosTemplate configuredThroughputCosmosTemplate = createCosmosTemplate(config, configuredThroughputDbName);

final CosmosEntityInformation<Person, String> personInfo =
new CosmosEntityInformation<>(Person.class);
cosmosTemplate.createContainerIfNotExists(personInfo);
configuredThroughputCosmosTemplate.createContainerIfNotExists(personInfo);

final CosmosAsyncDatabase database = client.getDatabase(dbName);
final CosmosAsyncDatabase database = client.getDatabase(configuredThroughputDbName);
final ThroughputResponse response = database.readThroughput().block();
assertEquals(expectedRequestUnits, response.getProperties().getManualThroughput());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,20 +549,20 @@ public void createWithAutoscale() {

@Test
public void createDatabaseWithThroughput() throws ClassNotFoundException {
final String dbName = TestConstants.DB_NAME + "-other";
deleteDatabaseIfExists(dbName);
final String configuredThroughputDbName = TestConstants.DB_NAME + "-other";
deleteDatabaseIfExists(configuredThroughputDbName);

Integer expectedRequestUnits = 700;
final CosmosConfig config = CosmosConfig.builder()
.enableDatabaseThroughput(false, expectedRequestUnits)
.build();
cosmosTemplate = createReactiveCosmosTemplate(config, dbName);
final ReactiveCosmosTemplate configuredThroughputCosmosTemplate = createReactiveCosmosTemplate(config, configuredThroughputDbName);

final CosmosEntityInformation<Person, String> personInfo =
new CosmosEntityInformation<>(Person.class);
cosmosTemplate.createContainerIfNotExists(personInfo).block();
configuredThroughputCosmosTemplate.createContainerIfNotExists(personInfo).block();

final CosmosAsyncDatabase database = client.getDatabase(dbName);
final CosmosAsyncDatabase database = client.getDatabase(configuredThroughputDbName);
final ThroughputResponse response = database.readThroughput().block();
assertEquals(expectedRequestUnits, response.getProperties().getManualThroughput());
}
Expand Down

0 comments on commit 1017b80

Please sign in to comment.