diff --git a/extensions/superuser-seed/src/main/java/org/eclipse/edc/identityhub/seed/ParticipantContextSeedExtension.java b/extensions/superuser-seed/src/main/java/org/eclipse/edc/identityhub/seed/ParticipantContextSeedExtension.java index 5a9910ea..df2634a0 100644 --- a/extensions/superuser-seed/src/main/java/org/eclipse/edc/identityhub/seed/ParticipantContextSeedExtension.java +++ b/extensions/superuser-seed/src/main/java/org/eclipse/edc/identityhub/seed/ParticipantContextSeedExtension.java @@ -91,7 +91,7 @@ public void start() { .onFailure(f -> monitor.warning("Error overriding API key for '%s': %s".formatted(superUserParticipantId, f.getFailureDetail()))); return key; }) - .orElse(generatedKey.get("apiKey").toString()); + .orElse(generatedKey.apiKey()); monitor.info("Created user 'super-user'. Please take note of the API Key: %s".formatted(apiKey)); }) .orElseThrow(f -> new EdcException("Error creating Super-User: " + f.getFailureDetail())); diff --git a/extensions/superuser-seed/src/test/java/org/eclipse/edc/identityhub/seed/ParticipantContextSeedExtensionTest.java b/extensions/superuser-seed/src/test/java/org/eclipse/edc/identityhub/seed/ParticipantContextSeedExtensionTest.java index 54e207bc..ed63f155 100644 --- a/extensions/superuser-seed/src/test/java/org/eclipse/edc/identityhub/seed/ParticipantContextSeedExtensionTest.java +++ b/extensions/superuser-seed/src/test/java/org/eclipse/edc/identityhub/seed/ParticipantContextSeedExtensionTest.java @@ -15,6 +15,7 @@ package org.eclipse.edc.identityhub.seed; import org.eclipse.edc.identityhub.spi.participantcontext.ParticipantContextService; +import org.eclipse.edc.identityhub.spi.participantcontext.model.CreateParticipantContextResponse; import org.eclipse.edc.identityhub.spi.participantcontext.model.ParticipantContext; import org.eclipse.edc.junit.extensions.DependencyInjectionExtension; import org.eclipse.edc.spi.EdcException; @@ -27,8 +28,6 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import java.util.Map; - import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.contains; @@ -60,7 +59,7 @@ void setup(ServiceExtensionContext context) { void start_verifySuperUser(ParticipantContextSeedExtension ext, ServiceExtensionContext context) { - when(participantContextService.createParticipantContext(any())).thenReturn(ServiceResult.success(Map.of(API_KEY, "some-key"))); + when(participantContextService.createParticipantContext(any())).thenReturn(ServiceResult.success(new CreateParticipantContextResponse("some-key", null, null))); ext.initialize(context); ext.start(); @@ -94,7 +93,7 @@ void start_withApiKeyOverride(ParticipantContextSeedExtension ext, .thenReturn(apiKeyOverride); when(participantContextService.createParticipantContext(any())) - .thenReturn(ServiceResult.success(Map.of(API_KEY, "generated-api-key"))); + .thenReturn(ServiceResult.success(new CreateParticipantContextResponse("generated-api-key", null, null))); when(participantContextService.getParticipantContext(eq(SUPER_USER))) .thenReturn(ServiceResult.notFound("foobar")) .thenReturn(ServiceResult.success(superUserContext().build())); @@ -117,7 +116,7 @@ void start_withInvalidKeyOverride(ParticipantContextSeedExtension ext, .thenReturn(apiKeyOverride); when(participantContextService.createParticipantContext(any())) - .thenReturn(ServiceResult.success(Map.of(API_KEY, "generated-api-key"))); + .thenReturn(ServiceResult.success(new CreateParticipantContextResponse("generated-api-key", null, null))); when(participantContextService.getParticipantContext(eq(SUPER_USER))) .thenReturn(ServiceResult.notFound("foobar")) .thenReturn(ServiceResult.success(superUserContext().build())); @@ -141,7 +140,7 @@ void start_whenVaultReturnsFailure(ParticipantContextSeedExtension ext, .thenReturn(apiKeyOverride); when(participantContextService.createParticipantContext(any())) - .thenReturn(ServiceResult.success(Map.of(API_KEY, "generated-api-key"))); + .thenReturn(ServiceResult.success(new CreateParticipantContextResponse("generated-api-key", null, null))); when(participantContextService.getParticipantContext(eq(SUPER_USER))) .thenReturn(ServiceResult.notFound("foobar")) .thenReturn(ServiceResult.success(superUserContext().build()));