diff --git a/src/main/java/com/contentgrid/gateway/runtime/RuntimeConfiguration.java b/src/main/java/com/contentgrid/gateway/runtime/RuntimeConfiguration.java index 3cfccc3f..5c75d0eb 100644 --- a/src/main/java/com/contentgrid/gateway/runtime/RuntimeConfiguration.java +++ b/src/main/java/com/contentgrid/gateway/runtime/RuntimeConfiguration.java @@ -3,10 +3,8 @@ import static com.contentgrid.gateway.runtime.web.ContentGridAppRequestWebFilter.CONTENTGRID_WEB_FILTER_CHAIN_FILTER_ORDER; import com.contentgrid.gateway.ServiceDiscoveryProperties; -import com.contentgrid.gateway.runtime.application.ContentGridApplicationMetadata; import com.contentgrid.gateway.runtime.application.ContentGridDeploymentMetadata; import com.contentgrid.gateway.runtime.application.ServiceCatalog; -import com.contentgrid.gateway.runtime.application.SimpleContentGridApplicationMetadata; import com.contentgrid.gateway.runtime.application.SimpleContentGridDeploymentMetadata; import com.contentgrid.gateway.runtime.config.ApplicationConfigurationRepository; import com.contentgrid.gateway.runtime.config.ComposableApplicationConfigurationRepository; @@ -40,7 +38,6 @@ import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.annotation.Order; -import org.springframework.http.server.reactive.ServerHttpRequest; import org.springframework.web.cors.reactive.CorsConfigurationSource; import org.springframework.web.server.ServerWebExchange; @@ -61,11 +58,6 @@ ContentGridDeploymentMetadata deploymentMetadata() { return new SimpleContentGridDeploymentMetadata(); } - @Bean - ContentGridApplicationMetadata applicationMetadata(ContentGridDeploymentMetadata deploymentMetadata) { - return new SimpleContentGridApplicationMetadata(deploymentMetadata); - } - @Bean RuntimeRequestResolver runtimeRequestResolver() { return new DefaultRuntimeRequestResolver(); diff --git a/src/main/java/com/contentgrid/gateway/runtime/application/ContentGridApplicationMetadata.java b/src/main/java/com/contentgrid/gateway/runtime/application/ContentGridApplicationMetadata.java deleted file mode 100644 index ac729903..00000000 --- a/src/main/java/com/contentgrid/gateway/runtime/application/ContentGridApplicationMetadata.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.contentgrid.gateway.runtime.application; - -import java.util.Optional; -import java.util.Set; -import lombok.NonNull; -import org.springframework.cloud.client.ServiceInstance; - -public interface ContentGridApplicationMetadata { - - Optional getApplicationId(ServiceInstance service); - - /** - * @deprecated domainname data will most probably be backed by another object, not `ServiceInstance` - * @param service - * @return - */ - @Deprecated - Set getDomainNames(@NonNull ServiceInstance service); -} diff --git a/src/main/java/com/contentgrid/gateway/runtime/application/SimpleContentGridApplicationMetadata.java b/src/main/java/com/contentgrid/gateway/runtime/application/SimpleContentGridApplicationMetadata.java deleted file mode 100644 index d46e0889..00000000 --- a/src/main/java/com/contentgrid/gateway/runtime/application/SimpleContentGridApplicationMetadata.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.contentgrid.gateway.runtime.application; - -import java.util.Optional; -import java.util.Set; -import java.util.stream.Collectors; -import lombok.NonNull; -import org.springframework.cloud.client.ServiceInstance; - -public class SimpleContentGridApplicationMetadata implements ContentGridApplicationMetadata { - - private final ContentGridDeploymentMetadata deploymentMetadata; - - public SimpleContentGridApplicationMetadata(ContentGridDeploymentMetadata deploymentMetadata) { - this.deploymentMetadata = deploymentMetadata; - } - - @Override - public Optional getApplicationId(ServiceInstance service) { - return deploymentMetadata.getApplicationId(service); - } - - @Override - @Deprecated - public Set getDomainNames(@NonNull ServiceInstance service) { - return this.getApplicationId(service) - .stream() - .map("%s.userapps.contentgrid.com"::formatted) - .collect(Collectors.toSet()); - } -} diff --git a/src/test/java/com/contentgrid/gateway/runtime/application/SimpleContentGridApplicationMetadataTest.java b/src/test/java/com/contentgrid/gateway/runtime/application/SimpleContentGridApplicationMetadataTest.java deleted file mode 100644 index c4a4d047..00000000 --- a/src/test/java/com/contentgrid/gateway/runtime/application/SimpleContentGridApplicationMetadataTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.contentgrid.gateway.runtime.application; - -import static org.assertj.core.api.Assertions.assertThat; - -import com.contentgrid.gateway.runtime.ServiceInstanceStubs; -import org.junit.jupiter.api.Test; - -class SimpleContentGridApplicationMetadataTest { - - ContentGridApplicationMetadata applicationMetadata = new SimpleContentGridApplicationMetadata( - new SimpleContentGridDeploymentMetadata() - ); - - @Test - void getApplicationId() { - var appId = ApplicationId.random(); - var service = ServiceInstanceStubs.serviceInstance(appId); - - assertThat(applicationMetadata.getApplicationId(service)).hasValue(appId); - - } - - @Test - void getDomainNames() { - var appId = ApplicationId.random(); - var service = ServiceInstanceStubs.serviceInstance(appId); - - assertThat(applicationMetadata.getDomainNames(service)) - .singleElement() - .isEqualTo("%s.userapps.contentgrid.com".formatted(appId)); - } -} \ No newline at end of file diff --git a/src/test/java/com/contentgrid/gateway/runtime/routing/SimpleRuntimeRequestRouterTest.java b/src/test/java/com/contentgrid/gateway/runtime/routing/SimpleRuntimeRequestRouterTest.java index 0cf40a85..8acec747 100644 --- a/src/test/java/com/contentgrid/gateway/runtime/routing/SimpleRuntimeRequestRouterTest.java +++ b/src/test/java/com/contentgrid/gateway/runtime/routing/SimpleRuntimeRequestRouterTest.java @@ -4,10 +4,8 @@ import com.contentgrid.gateway.runtime.ServiceInstanceStubs; import com.contentgrid.gateway.runtime.application.ApplicationId; -import com.contentgrid.gateway.runtime.application.ContentGridApplicationMetadata; import com.contentgrid.gateway.runtime.application.DeploymentId; import com.contentgrid.gateway.runtime.application.ServiceCatalog; -import com.contentgrid.gateway.runtime.application.SimpleContentGridApplicationMetadata; import com.contentgrid.gateway.runtime.application.SimpleContentGridDeploymentMetadata; import com.contentgrid.gateway.runtime.config.ApplicationConfiguration.Keys; import com.contentgrid.gateway.runtime.config.ApplicationConfigurationFragment; @@ -21,7 +19,6 @@ class SimpleRuntimeRequestRouterTest { - protected ContentGridApplicationMetadata applicationMetadata; protected ComposableApplicationConfigurationRepository appConfigRepo; protected ServiceCatalog serviceCatalog; protected RuntimeRequestRouter requestRouter; @@ -29,7 +26,6 @@ class SimpleRuntimeRequestRouterTest { @BeforeEach void setup() { var deployMetadata = new SimpleContentGridDeploymentMetadata(); - this.applicationMetadata = new SimpleContentGridApplicationMetadata(deployMetadata); this.appConfigRepo = new ComposableApplicationConfigurationRepository(); this.serviceCatalog = new ServiceCatalog(event -> { }, deployMetadata, appConfigRepo); this.requestRouter = new SimpleRuntimeRequestRouter(this.serviceCatalog, deployMetadata, appConfigRepo);