Skip to content

Commit

Permalink
Quarkus-tests: Update test resources to use new storage test code (#6902
Browse files Browse the repository at this point in the history
)

These lifecycle-managers relied on database-adapter test support code.
  • Loading branch information
snazy committed May 26, 2023
1 parent d477cef commit f1c4ea4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
2 changes: 2 additions & 0 deletions servers/quarkus-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ dependencies {
implementation(project(":nessie-versioned-persist-transactional"))
implementation(project(":nessie-versioned-persist-transactional-test"))
implementation(project(":nessie-versioned-storage-cassandra"))
implementation(project(":nessie-versioned-storage-dynamodb"))
implementation(project(":nessie-versioned-storage-mongodb"))
implementation(project(":nessie-versioned-storage-testextension"))

implementation(enforcedPlatform(libs.quarkus.bom))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import java.util.Collections;
import java.util.Map;
import java.util.Optional;
import org.projectnessie.versioned.persist.dynamodb.LocalDynamoTestConnectionProviderSource;
import org.projectnessie.versioned.storage.dynamodb.DynamoDBBackendTestFactory;

public class DynamoTestResourceLifecycleManager
implements QuarkusTestResourceLifecycleManager, DevServicesContext.ContextAware {

private LocalDynamoTestConnectionProviderSource dynamo;
private DynamoDBBackendTestFactory dynamo;

private Optional<String> containerNetworkId = Optional.empty();

Expand All @@ -36,12 +36,11 @@ public void setIntegrationTestContext(DevServicesContext context) {

@Override
public Map<String, String> start() {
dynamo = new LocalDynamoTestConnectionProviderSource();
dynamo = new DynamoDBBackendTestFactory();

try {
// Only start the Docker container (local Dynamo-compatible). The DynamoDatabaseClient will
// be configured via Quarkus -> Quarkus-Dynamo / DynamoVersionStoreFactory.
dynamo.startDynamo(containerNetworkId, true);
// Only start the Docker container (local Dynamo-compatible).
dynamo.startDynamo(containerNetworkId);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@
*/
package org.projectnessie.quarkus.tests.profiles;

import com.google.common.collect.ImmutableMap;
import io.quarkus.test.common.DevServicesContext;
import io.quarkus.test.common.QuarkusTestResourceLifecycleManager;
import java.util.Map;
import java.util.Optional;
import org.projectnessie.versioned.persist.mongodb.LocalMongoTestConnectionProviderSource;
import org.projectnessie.versioned.storage.mongodb.MongoDBBackendTestFactory;

public class MongoTestResourceLifecycleManager
implements QuarkusTestResourceLifecycleManager, DevServicesContext.ContextAware {

private LocalMongoTestConnectionProviderSource mongo;
private MongoDBBackendTestFactory mongo;

private Optional<String> containerNetworkId;

Expand All @@ -36,19 +35,15 @@ public void setIntegrationTestContext(DevServicesContext context) {

@Override
public Map<String, String> start() {
mongo = new LocalMongoTestConnectionProviderSource();
mongo = new MongoDBBackendTestFactory();

try {
mongo.startMongo(containerNetworkId, true);
mongo.startMongo(containerNetworkId);
} catch (Exception e) {
throw new RuntimeException(e);
}

return ImmutableMap.of(
"quarkus.mongodb.connection-string",
mongo.getConnectionString(),
"quarkus.mongodb.database",
mongo.getDatabaseName());
return mongo.getQuarkusConfig();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ DynamoDbClient buildNewClient() {
}

@SuppressWarnings("resource")
private void startDynamo(Optional<String> containerNetworkId) {
public void startDynamo(Optional<String> containerNetworkId) {
if (container != null) {
throw new IllegalStateException("Already started");
}
Expand Down Expand Up @@ -106,4 +106,8 @@ public void stop() {
container = null;
}
}

public String getEndpointURI() {
return endpointURI;
}
}

0 comments on commit f1c4ea4

Please sign in to comment.