Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
paullatzelsperger committed Mar 21, 2024
1 parent d7f117a commit d52f6e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
public class ManagementApiExtension implements ServiceExtension {
public static final String NAME = "Management API";
static final String CONTEXT_NAME = "management";
static final String PATH = "/management/v1";
static final int PORT = 8282;

@Inject
private DidEntryStore store;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

package org.eclipse.tractusx.bdrs.api.management;

import org.eclipse.edc.api.auth.spi.AuthenticationRequestFilter;
import org.eclipse.edc.junit.extensions.DependencyInjectionExtension;
import org.eclipse.edc.spi.system.ServiceExtensionContext;
import org.eclipse.edc.web.spi.WebServer;
Expand All @@ -23,8 +24,6 @@
import org.junit.jupiter.api.extension.ExtendWith;

import static org.eclipse.tractusx.bdrs.api.management.ManagementApiExtension.CONTEXT_NAME;
import static org.eclipse.tractusx.bdrs.api.management.ManagementApiExtension.PATH;
import static org.eclipse.tractusx.bdrs.api.management.ManagementApiExtension.PORT;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.mock;
Expand All @@ -33,23 +32,20 @@
@ExtendWith(DependencyInjectionExtension.class)
class ManagementApiExtensionTest {

private WebServer webServer;
private WebService webService;
private final WebServer webServer = mock();
private final WebService webService = mock();

@Test
void verifyBoot(ManagementApiExtension extension, ServiceExtensionContext context) {
extension.initialize(context);

verify(webServer).addPortMapping(CONTEXT_NAME, PORT, PATH);
verify(webService).registerResource(eq(CONTEXT_NAME), isA(ManagementApiController.class));
verify(webService).registerResource(eq(CONTEXT_NAME), isA(AuthenticationRequestFilter.class));
}

@BeforeEach
void setUp(ServiceExtensionContext context) {
webServer = mock(WebServer.class);
context.registerService(WebServer.class, webServer);

webService = mock(WebService.class);
context.registerService(WebService.class, webService);
}

Expand Down

0 comments on commit d52f6e4

Please sign in to comment.