Skip to content

Commit

Permalink
fix: compile error after IH update
Browse files Browse the repository at this point in the history
  • Loading branch information
paullatzelsperger committed Dec 6, 2024
1 parent a3cf1d2 commit aadab76
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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()));
Expand All @@ -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()));
Expand All @@ -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()));
Expand Down

0 comments on commit aadab76

Please sign in to comment.