From af0f15b153d09885c6733f96f9caf44faa102f5e Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Thu, 22 Nov 2018 15:23:58 +0100 Subject: [PATCH] Remove legacy STS support Closes gh-766 --- .../web/project/LegacyStsController.java | 46 ---------- .../resources/templates/sts-home.mustache | 92 ------------------- .../LegacyStsControllerIntegrationTests.java | 74 --------------- 3 files changed, 212 deletions(-) delete mode 100644 initializr-web/src/main/java/io/spring/initializr/web/project/LegacyStsController.java delete mode 100644 initializr-web/src/main/resources/templates/sts-home.mustache delete mode 100755 initializr-web/src/test/java/io/spring/initializr/web/project/LegacyStsControllerIntegrationTests.java diff --git a/initializr-web/src/main/java/io/spring/initializr/web/project/LegacyStsController.java b/initializr-web/src/main/java/io/spring/initializr/web/project/LegacyStsController.java deleted file mode 100644 index 99541ceb..00000000 --- a/initializr-web/src/main/java/io/spring/initializr/web/project/LegacyStsController.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2012-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.spring.initializr.web.project; - -import java.util.Map; - -import io.spring.initializr.metadata.InitializrMetadataProvider; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.servlet.resource.ResourceUrlProvider; - -/** - * A controller used to serve the legacy home page used by STS. - * - * @author Stephane Nicoll - */ -@Controller -public class LegacyStsController extends AbstractInitializrController { - - public LegacyStsController(InitializrMetadataProvider metadataProvider, - ResourceUrlProvider resourceUrlProvider) { - super(metadataProvider, resourceUrlProvider); - } - - @GetMapping(path = "/sts", produces = "text/html") - public String stsHome(Map model) { - renderHome(model); - return "sts-home"; - } - -} diff --git a/initializr-web/src/main/resources/templates/sts-home.mustache b/initializr-web/src/main/resources/templates/sts-home.mustache deleted file mode 100644 index b8ba9623..00000000 --- a/initializr-web/src/main/resources/templates/sts-home.mustache +++ /dev/null @@ -1,92 +0,0 @@ - - - - Spring Initializr - - - -
- -

Spring Initializr

-
-
- - - - - - - {{#dependencies.content}} - {{#content}} - - {{/content}} - {{/dependencies.content}} - - {{#types.content}} - - {{/types.content}} - - {{#packagings.content}} - - {{/packagings.content}} - - {{#javaVersions.content}} - - {{/javaVersions.content}} - - {{#languages.content}} - - {{/languages.content}} - - {{#bootVersions.content}} - - {{/bootVersions.content}} - -
-
-
- - \ No newline at end of file diff --git a/initializr-web/src/test/java/io/spring/initializr/web/project/LegacyStsControllerIntegrationTests.java b/initializr-web/src/test/java/io/spring/initializr/web/project/LegacyStsControllerIntegrationTests.java deleted file mode 100755 index 7bdd916f..00000000 --- a/initializr-web/src/test/java/io/spring/initializr/web/project/LegacyStsControllerIntegrationTests.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2012-2018 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.spring.initializr.web.project; - -import java.util.Collections; - -import io.spring.initializr.metadata.InitializrMetadataProvider; -import io.spring.initializr.web.AbstractInitializrControllerIntegrationTests; -import io.spring.initializr.web.project.LegacyStsControllerIntegrationTests.LegacyConfig; -import org.junit.Test; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpMethod; -import org.springframework.http.MediaType; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.web.servlet.resource.ResourceUrlProvider; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * @author Stephane Nicoll - */ -@ActiveProfiles("test-default") -@ContextConfiguration(classes = LegacyConfig.class) -public class LegacyStsControllerIntegrationTests - extends AbstractInitializrControllerIntegrationTests { - - @Test - public void legacyStsHome() { - String body = htmlHome(); - assertThat(body).contains("com.example", "demo", "Demo project for Spring Boot", - "", - ""); - } - - @Override - protected String htmlHome() { - HttpHeaders headers = new HttpHeaders(); - headers.setAccept(Collections.singletonList(MediaType.TEXT_HTML)); - return getRestTemplate().exchange(createUrl("/sts"), HttpMethod.GET, - new HttpEntity(headers), String.class).getBody(); - } - - @Configuration - protected static class LegacyConfig { - - @Bean - public LegacyStsController legacyStsController( - InitializrMetadataProvider metadataProvider, - ResourceUrlProvider resourceUrlProvider) { - return new LegacyStsController(metadataProvider, resourceUrlProvider); - } - - } - -}