diff --git a/acceptance-tests/acceptance-tests-spring/src/test/java/io/github/ascopes/jct/acceptancetests/spring/SpringContextIndexerTest.java b/acceptance-tests/acceptance-tests-spring/src/test/java/io/github/ascopes/jct/acceptancetests/spring/SpringContextIndexerTest.java deleted file mode 100644 index 15b8962fc..000000000 --- a/acceptance-tests/acceptance-tests-spring/src/test/java/io/github/ascopes/jct/acceptancetests/spring/SpringContextIndexerTest.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (C) 2022 - 2023, 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.github.ascopes.jct.acceptancetests.spring; - -import static io.github.ascopes.jct.assertions.JctAssertions.assertThatCompilation; - -import io.github.ascopes.jct.compilers.JctCompiler; -import io.github.ascopes.jct.junit.JavacCompilerTest; -import io.github.ascopes.jct.workspaces.Workspaces; -import org.junit.jupiter.api.DisplayName; -import org.springframework.context.index.processor.CandidateComponentsIndexer; - -@DisplayName("Spring Context Indexer acceptance tests") -class SpringContextIndexerTest { - - @DisplayName("Spring will index the application context as expected") - @JavacCompilerTest(minVersion = 17) - void springWillIndexTheApplicationContextAsExpected(JctCompiler compiler) { - try (var workspace = Workspaces.newWorkspace()) { - // Given - workspace - .createSourcePathPackage() - .createDirectory("org", "example") - .copyContentsFrom("src", "test", "resources", "code", "indexer", "org", "example"); - - // When - var compilation = compiler - .addAnnotationProcessors(new CandidateComponentsIndexer()) - .compile(workspace); - - // Then - assertThatCompilation(compilation) - .isSuccessfulWithoutWarnings() - .classOutputPackages() - .fileExists("META-INF", "spring.components") - .isNotEmptyFile(); - } - } - - @DisplayName("Spring will index the application context as expected with modules") - @JavacCompilerTest(minVersion = 17) - void springWillIndexTheApplicationContextAsExpectedWithModules(JctCompiler compiler) { - try (var workspace = Workspaces.newWorkspace()) { - // Given - workspace - .createSourcePathPackage() - .copyContentsFrom("src", "test", "resources", "code", "indexer"); - - // When - var compilation = compiler - .addAnnotationProcessors(new CandidateComponentsIndexer()) - .compile(workspace); - - // Then - assertThatCompilation(compilation) - .isSuccessfulWithoutWarnings() - .classOutputPackages() - .fileExists("META-INF", "spring.components") - .isNotEmptyFile(); - } - } - - - @DisplayName("Spring will index the application context as expected with multi-modules") - @JavacCompilerTest(minVersion = 17) - void springWillIndexTheApplicationContextAsExpectedWithMultiModules(JctCompiler compiler) { - try (var workspace = Workspaces.newWorkspace()) { - // Given - workspace - .createSourcePathModule("org.example") - .copyContentsFrom("src", "test", "resources", "code", "indexer"); - - // When - var compilation = compiler - .addAnnotationProcessors(new CandidateComponentsIndexer()) - .compile(workspace); - - // Then - assertThatCompilation(compilation) - .isSuccessfulWithoutWarnings() - .classOutputModules().moduleExists("org.example") - .fileExists("META-INF", "spring.components") - .isNotEmptyFile(); - } - } -} diff --git a/acceptance-tests/acceptance-tests-spring/src/test/resources/code/indexer/module-info.java b/acceptance-tests/acceptance-tests-spring/src/test/resources/code/indexer/module-info.java deleted file mode 100644 index 99847956e..000000000 --- a/acceptance-tests/acceptance-tests-spring/src/test/resources/code/indexer/module-info.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (C) 2022 - 2023, 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. - */ -module org.example { - requires java.base; - requires spring.beans; - requires spring.boot; - requires spring.context; - requires spring.core; - requires spring.web; - requires spring.webflux; -} diff --git a/acceptance-tests/acceptance-tests-spring/src/test/resources/code/indexer/org/example/Application.java b/acceptance-tests/acceptance-tests-spring/src/test/resources/code/indexer/org/example/Application.java deleted file mode 100644 index aac6d86e8..000000000 --- a/acceptance-tests/acceptance-tests-spring/src/test/resources/code/indexer/org/example/Application.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2022 - 2023, 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 org.example; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -/** - * Spring Boot application entrypoint. - */ -@SpringBootApplication -public class Application { - - public static void main(String[] args) { - SpringApplication.run(Application.class, args); - } -} diff --git a/acceptance-tests/acceptance-tests-spring/src/test/resources/code/indexer/org/example/config/RouteConfig.java b/acceptance-tests/acceptance-tests-spring/src/test/resources/code/indexer/org/example/config/RouteConfig.java deleted file mode 100644 index ab1f3fb1c..000000000 --- a/acceptance-tests/acceptance-tests-spring/src/test/resources/code/indexer/org/example/config/RouteConfig.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2022 - 2023, 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 org.example.config; - -import org.example.handlers.HelloWorldHandler; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.reactive.function.server.RouterFunction; -import org.springframework.web.reactive.function.server.RouterFunctions; -import org.springframework.web.reactive.function.server.ServerResponse; - -/** - * Routing configuration. - */ -@Configuration -public class RouteConfig { - - /** - * Application web router bean. - * - * @param handler the handler for "Hello, World!" responses. - * @return the router. - */ - @Bean - public RouterFunction router(HelloWorldHandler handler) { - return RouterFunctions - .route() - .GET("/api/v1/hello-world", handler::getHelloWorld) - .build(); - } -} diff --git a/acceptance-tests/acceptance-tests-spring/src/test/resources/code/indexer/org/example/handlers/HelloWorldHandler.java b/acceptance-tests/acceptance-tests-spring/src/test/resources/code/indexer/org/example/handlers/HelloWorldHandler.java deleted file mode 100644 index 9bc9935b8..000000000 --- a/acceptance-tests/acceptance-tests-spring/src/test/resources/code/indexer/org/example/handlers/HelloWorldHandler.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2022 - 2023, 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 org.example.handlers; - -import org.springframework.stereotype.Component; -import org.springframework.web.reactive.function.server.ServerRequest; -import org.springframework.web.reactive.function.server.ServerResponse; -import reactor.core.publisher.Mono; - -/** - * Handler that just says hello and then finishes. Very enterprise-oriented logic. - */ -@Component -public class HelloWorldHandler { - - /** - * Just say hello and then go away. - * - * @param request the GET request. - * @return a 200 OK response that very politely greets me and makes me feel like I have an AI as a - * friend. - */ - public Mono getHelloWorld(ServerRequest request) { - return ServerResponse - .ok() - .bodyValue("Hello, World!"); - } -}