Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/**
* Callback interface that can be implemented to customize the URL of an {@linkplain
* LaunchpadConfigProperties.App}.
* de.focus_shift.launchpad.core.LaunchpadConfigProperties.App}.
*
* <p>Example Configuration:
*
Expand All @@ -23,7 +23,7 @@
*
* <pre><code>
* LaunchpadAppUrlCustomizer launchpadAppUrlCustomizer() {
* return url -> new URL(url.replace("{tenantId}", "awesome-tenant-id"));
* return url -> URI.create(url.replace("{tenantId}", "awesome-tenant-id")).toURL();
* }
* </code></pre>
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package de.focus_shift.launchpad.tenancy;

import de.focus_shift.launchpad.api.LaunchpadAppUrlCustomizer;
import java.net.URL;
import java.net.URI;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
Expand All @@ -14,7 +14,7 @@ public class LaunchpadTenantConfiguration {

@Bean
LaunchpadAppUrlCustomizer appUrlCustomizer(TenantSupplier tenantSupplier) {
return url -> new URL(url.replace("{tenantId}", tenantSupplier.get()));
return url -> URI.create(url.replace("{tenantId}", tenantSupplier.get())).toURL();
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import de.focus_shift.launchpad.api.HasLaunchpad;
import de.focus_shift.launchpad.api.LaunchpadAppUrlCustomizer;
import java.net.URL;
import java.net.URI;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -49,9 +49,12 @@ void controllerWithLaunchpad() throws Exception {
.thenReturn(
new Launchpad(
List.of(
new App(new URL("https://example.org"), new AppName("App 1", Map.of()), "icon"),
new App(
new URL("https://example-2.org"),
URI.create("https://example.org").toURL(),
new AppName("App 1", Map.of()),
"icon"),
new App(
URI.create("https://example-2.org").toURL(),
new AppName("App 2", Map.of()),
"icon-2"))));

Expand Down Expand Up @@ -81,7 +84,7 @@ static class TestConfig {

@Bean
LaunchpadAppUrlCustomizer appUrlCustomizer() {
return URL::new;
return url -> URI.create(url).toURL();
}

@Controller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import static org.assertj.core.api.Assertions.assertThat;

import de.focus_shift.launchpad.api.LaunchpadAppUrlCustomizer;
import java.net.URL;
import java.net.URI;
import java.util.List;
import java.util.Locale;
import java.util.Map;
Expand Down Expand Up @@ -36,12 +36,12 @@ void ensureLaunchpad() throws Exception {
assertThat(launchpad.getApps())
.containsExactly(
new App(
new URL("https://first.app.example.org"),
URI.create("https://first.app.example.org").toURL(),
new AppName(
"Anwendung 1", Map.of(Locale.GERMAN, "Anwendung 1", Locale.ENGLISH, "App 1")),
"icon-first"),
new App(
new URL("https://second.app.example.org"),
URI.create("https://second.app.example.org").toURL(),
new AppName(
"Anwendung 2", Map.of(Locale.GERMAN, "Anwendung 2", Locale.ENGLISH, "App 2")),
"icon-second"));
Expand All @@ -51,7 +51,7 @@ void ensureLaunchpad() throws Exception {
static class TestConfig {
@Bean
LaunchpadAppUrlCustomizer appUrlCustomizer() {
return URL::new;
return url -> URI.create(url).toURL();
}
}
}