-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(login): extract urls and make it environment variables
- Loading branch information
1 parent
a002ab5
commit 73c1edb
Showing
10 changed files
with
115 additions
and
8 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
src/main/java/es/in2/vcverifier/config/properties/UiUrlsProperties.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,7 @@ | ||
package es.in2.vcverifier.config.properties; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
@ConfigurationProperties(prefix = "ui.urls") | ||
public record UiUrlsProperties(String onboardingUrl, String supportUrl, String walletUrl) { | ||
} |
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
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 |
---|---|---|
|
@@ -57,3 +57,9 @@ trustedIssuerList: | |
|
||
crypto: | ||
privateKey: | ||
|
||
ui: | ||
urls: | ||
onboardingUrl: | ||
supportUrl: | ||
walletUrl: |
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
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 |
---|---|---|
|
@@ -56,4 +56,10 @@ trustedIssuerList: | |
uri: | ||
|
||
crypto: | ||
privateKey: | ||
privateKey: | ||
|
||
ui: | ||
urls: | ||
onboardingUrl: | ||
supportUrl: | ||
walletUrl: |
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 |
---|---|---|
|
@@ -56,4 +56,10 @@ trustedIssuerList: | |
uri: | ||
|
||
crypto: | ||
privateKey: | ||
privateKey: | ||
|
||
ui: | ||
urls: | ||
onboardingUrl: | ||
supportUrl: | ||
walletUrl: |
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
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
42 changes: 42 additions & 0 deletions
42
src/test/java/es/in2/vcverifier/config/properties/UiUrlPropertiesTest.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,42 @@ | ||
package es.in2.vcverifier.config.properties; | ||
|
||
import es.in2.vcverifier.objectmothers.UiUrlsPropertiesMother; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.DynamicPropertyRegistry; | ||
import org.springframework.test.context.DynamicPropertySource; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
@SpringBootTest | ||
class UiUrlPropertiesTest { | ||
@Autowired | ||
private UiUrlsProperties uiUrlsProperties; | ||
|
||
private static final String ONBOARDING_URL = UiUrlsPropertiesMother.createOnboardingUrl(); | ||
private static final String SUPPORT_URL = UiUrlsPropertiesMother.createSupportUrl(); | ||
private static final String WALLET_URL = UiUrlsPropertiesMother.createWalletUrl(); | ||
|
||
@DynamicPropertySource | ||
static void setDynamicProperties(DynamicPropertyRegistry registry) { | ||
registry.add("ui.urls.onboardingUrl", () -> ONBOARDING_URL); | ||
registry.add("ui.urls.supportUrl", () -> SUPPORT_URL); | ||
registry.add("ui.urls.walletUrl", () -> WALLET_URL); | ||
} | ||
|
||
@Test | ||
void testUiUrlsOnboardingUrl() { | ||
assertThat(uiUrlsProperties.onboardingUrl()).isEqualTo(ONBOARDING_URL); | ||
} | ||
|
||
@Test | ||
void testUiUrlSupportUrl() { | ||
assertThat(uiUrlsProperties.supportUrl()).isEqualTo(SUPPORT_URL); | ||
} | ||
|
||
@Test | ||
void testUiUrlwalletUrl() { | ||
assertThat(uiUrlsProperties.walletUrl()).isEqualTo(WALLET_URL); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/test/java/es/in2/vcverifier/objectmothers/UiUrlsPropertiesMother.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,18 @@ | ||
package es.in2.vcverifier.objectmothers; | ||
|
||
public final class UiUrlsPropertiesMother { | ||
private UiUrlsPropertiesMother() { | ||
} | ||
|
||
public static String createOnboardingUrl(){ | ||
return "knowledge-base.example.org"; | ||
} | ||
|
||
public static String createSupportUrl(){ | ||
return "ticketing.example.org"; | ||
} | ||
|
||
public static String createWalletUrl(){ | ||
return "wallet.example.org"; | ||
} | ||
} |