-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Lars Geyer-Blaumeiser <[email protected]>
- Loading branch information
1 parent
aa91759
commit 91a2423
Showing
2 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
...tractusx/bdrs/api/directory/authentication/ApiAuthenticationProviderRegistryImplTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.tractusx.bdrs.api.directory.authentication; | ||
|
||
import org.eclipse.edc.api.auth.spi.ApiAuthenticationProvider; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.mockito.Mockito.mock; | ||
|
||
class ApiAuthenticationProviderRegistryImplTest { | ||
|
||
private final ApiAuthenticationProviderRegistryImpl registry = new ApiAuthenticationProviderRegistryImpl(); | ||
|
||
@Test | ||
void shouldResolveRegisteredProvider() { | ||
ApiAuthenticationProvider provider = mock(); | ||
registry.register("authType", provider); | ||
|
||
var actual = registry.resolve("authType"); | ||
|
||
assertThat(actual).isSameAs(provider); | ||
} | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
...ava/org/eclipse/tractusx/bdrs/api/directory/authentication/TrustedIssuerRegistryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) | ||
* Copyright (c) 2025 Cofinity-X GmbH | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Apache License, Version 2.0 which is available at | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Contributors: | ||
* Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation | ||
* | ||
*/ | ||
|
||
package org.eclipse.tractusx.bdrs.api.directory.authentication; | ||
|
||
import org.eclipse.edc.iam.verifiablecredentials.spi.model.Issuer; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.util.Map; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
class TrustedIssuerRegistryTest { | ||
|
||
private final TrustedIssuerRegistryImpl registry = new TrustedIssuerRegistryImpl(); | ||
|
||
@Test | ||
void trustedIssuer() { | ||
var issuer = new Issuer("test-id", Map.of()); | ||
|
||
registry.register(issuer, "test-type1"); | ||
registry.register(issuer, "test-type2"); | ||
|
||
assertThat(registry.getSupportedTypes(issuer)).containsExactly("test-type1", "test-type2"); | ||
} | ||
|
||
@Test | ||
void invalidIssuer() { | ||
var issuer = new Issuer("test-id", Map.of()); | ||
|
||
assertThat(registry.getSupportedTypes(issuer)).isEmpty(); | ||
} | ||
|
||
} |