Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quarkus-tests: Update test resources to use new storage test code #6902

Merged
merged 1 commit into from
May 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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;
}
}