-
Notifications
You must be signed in to change notification settings - Fork 40.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Register required class names for reflection in Testcontainer factory
Closes gh-36606
- Loading branch information
1 parent
6fb127e
commit 73685d1
Showing
10 changed files
with
317 additions
and
2 deletions.
There are no files selected for viewing
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
12 changes: 11 additions & 1 deletion
12
...-boot-project/spring-boot-testcontainers/src/main/resources/META-INF/spring/aot.factories
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 |
---|---|---|
@@ -1,2 +1,12 @@ | ||
org.springframework.beans.factory.aot.BeanRegistrationExcludeFilter=\ | ||
org.springframework.boot.testcontainers.service.connection.ConnectionDetailsRegistrar.ServiceConnectionBeanRegistrationExcludeFilter | ||
org.springframework.boot.testcontainers.service.connection.ConnectionDetailsRegistrar.ServiceConnectionBeanRegistrationExcludeFilter | ||
|
||
org.springframework.aot.hint.RuntimeHintsRegistrar=\ | ||
org.springframework.boot.testcontainers.service.connection.mongo.MongoContainerConnectionDetailsFactory,\ | ||
org.springframework.boot.testcontainers.service.connection.neo4j.Neo4jContainerConnectionDetailsFactory,\ | ||
org.springframework.boot.testcontainers.service.connection.r2dbc.MariaDbR2dbcContainerConnectionDetailsFactory,\ | ||
org.springframework.boot.testcontainers.service.connection.r2dbc.MySqlR2dbcContainerConnectionDetailsFactory,\ | ||
org.springframework.boot.testcontainers.service.connection.r2dbc.OracleR2dbcContainerConnectionDetailsFactory,\ | ||
org.springframework.boot.testcontainers.service.connection.r2dbc.PostgresR2dbcContainerConnectionDetailsFactory,\ | ||
org.springframework.boot.testcontainers.service.connection.r2dbc.SqlServerR2dbcContainerConnectionDetailsFactory,\ | ||
org.springframework.boot.testcontainers.service.connection.zipkin.ZipkinContainerConnectionDetailsFactory |
41 changes: 41 additions & 0 deletions
41
.../testcontainers/service/connection/mongo/MongoContainerConnectionDetailsFactoryTests.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,41 @@ | ||
/* | ||
* Copyright 2012-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 | ||
* | ||
* https://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.springframework.boot.testcontainers.service.connection.mongo; | ||
|
||
import com.mongodb.ConnectionString; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import org.springframework.aot.hint.RuntimeHints; | ||
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* Tests for {@link MongoContainerConnectionDetailsFactory}. | ||
* | ||
* @author Moritz Halbritter | ||
*/ | ||
class MongoContainerConnectionDetailsFactoryTests { | ||
|
||
@Test | ||
void shouldRegisterHints() { | ||
RuntimeHints hints = new RuntimeHints(); | ||
new MongoContainerConnectionDetailsFactory().registerHints(hints, getClass().getClassLoader()); | ||
assertThat(RuntimeHintsPredicates.reflection().onType(ConnectionString.class)).accepts(hints); | ||
} | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
.../testcontainers/service/connection/neo4j/Neo4jContainerConnectionDetailsFactoryTests.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,41 @@ | ||
/* | ||
* Copyright 2012-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 | ||
* | ||
* https://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.springframework.boot.testcontainers.service.connection.neo4j; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.neo4j.driver.AuthToken; | ||
|
||
import org.springframework.aot.hint.RuntimeHints; | ||
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* Tests for {@link Neo4jContainerConnectionDetailsFactory}. | ||
* | ||
* @author Moritz Halbritter | ||
*/ | ||
class Neo4jContainerConnectionDetailsFactoryTests { | ||
|
||
@Test | ||
void shouldRegisterHints() { | ||
RuntimeHints hints = new RuntimeHints(); | ||
new Neo4jContainerConnectionDetailsFactory().registerHints(hints, getClass().getClassLoader()); | ||
assertThat(RuntimeHintsPredicates.reflection().onType(AuthToken.class)).accepts(hints); | ||
} | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
...ntainers/service/connection/r2dbc/MariaDbR2dbcContainerConnectionDetailsFactoryTests.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,41 @@ | ||
/* | ||
* Copyright 2012-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 | ||
* | ||
* https://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.springframework.boot.testcontainers.service.connection.r2dbc; | ||
|
||
import io.r2dbc.spi.ConnectionFactoryOptions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import org.springframework.aot.hint.RuntimeHints; | ||
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* Tests for {@link MariaDbR2dbcContainerConnectionDetailsFactory}. | ||
* | ||
* @author Moritz Halbritter | ||
*/ | ||
class MariaDbR2dbcContainerConnectionDetailsFactoryTests { | ||
|
||
@Test | ||
void shouldRegisterHints() { | ||
RuntimeHints hints = new RuntimeHints(); | ||
new MariaDbR2dbcContainerConnectionDetailsFactory().registerHints(hints, getClass().getClassLoader()); | ||
assertThat(RuntimeHintsPredicates.reflection().onType(ConnectionFactoryOptions.class)).accepts(hints); | ||
} | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
...containers/service/connection/r2dbc/MySqlR2dbcContainerConnectionDetailsFactoryTests.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,41 @@ | ||
/* | ||
* Copyright 2012-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 | ||
* | ||
* https://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.springframework.boot.testcontainers.service.connection.r2dbc; | ||
|
||
import io.r2dbc.spi.ConnectionFactoryOptions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import org.springframework.aot.hint.RuntimeHints; | ||
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* Tests for {@link MySqlR2dbcContainerConnectionDetailsFactory}. | ||
* | ||
* @author Moritz Halbritter | ||
*/ | ||
class MySqlR2dbcContainerConnectionDetailsFactoryTests { | ||
|
||
@Test | ||
void shouldRegisterHints() { | ||
RuntimeHints hints = new RuntimeHints(); | ||
new MySqlR2dbcContainerConnectionDetailsFactory().registerHints(hints, getClass().getClassLoader()); | ||
assertThat(RuntimeHintsPredicates.reflection().onType(ConnectionFactoryOptions.class)).accepts(hints); | ||
} | ||
|
||
} |
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
41 changes: 41 additions & 0 deletions
41
...tainers/service/connection/r2dbc/PostgresR2dbcContainerConnectionDetailsFactoryTests.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,41 @@ | ||
/* | ||
* Copyright 2012-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 | ||
* | ||
* https://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.springframework.boot.testcontainers.service.connection.r2dbc; | ||
|
||
import io.r2dbc.spi.ConnectionFactoryOptions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import org.springframework.aot.hint.RuntimeHints; | ||
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* Tests for {@link PostgresR2dbcContainerConnectionDetailsFactory}. | ||
* | ||
* @author Moritz Halbritter | ||
*/ | ||
class PostgresR2dbcContainerConnectionDetailsFactoryTests { | ||
|
||
@Test | ||
void shouldRegisterHints() { | ||
RuntimeHints hints = new RuntimeHints(); | ||
new PostgresR2dbcContainerConnectionDetailsFactory().registerHints(hints, getClass().getClassLoader()); | ||
assertThat(RuntimeHintsPredicates.reflection().onType(ConnectionFactoryOptions.class)).accepts(hints); | ||
} | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
...ainers/service/connection/r2dbc/SqlServerR2dbcContainerConnectionDetailsFactoryTests.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,41 @@ | ||
/* | ||
* Copyright 2012-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 | ||
* | ||
* https://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.springframework.boot.testcontainers.service.connection.r2dbc; | ||
|
||
import io.r2dbc.spi.ConnectionFactoryOptions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import org.springframework.aot.hint.RuntimeHints; | ||
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* Tests for {@link SqlServerR2dbcContainerConnectionDetailsFactory}. | ||
* | ||
* @author Moritz Halbritter | ||
*/ | ||
class SqlServerR2dbcContainerConnectionDetailsFactoryTests { | ||
|
||
@Test | ||
void shouldRegisterHints() { | ||
RuntimeHints hints = new RuntimeHints(); | ||
new SqlServerR2dbcContainerConnectionDetailsFactory().registerHints(hints, getClass().getClassLoader()); | ||
assertThat(RuntimeHintsPredicates.reflection().onType(ConnectionFactoryOptions.class)).accepts(hints); | ||
} | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
...estcontainers/service/connection/zipkin/ZipkinContainerConnectionDetailsFactoryTests.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,41 @@ | ||
/* | ||
* Copyright 2012-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 | ||
* | ||
* https://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.springframework.boot.testcontainers.service.connection.zipkin; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import org.springframework.aot.hint.RuntimeHints; | ||
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates; | ||
import org.springframework.boot.actuate.autoconfigure.tracing.zipkin.ZipkinAutoConfiguration; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* Tests for {@link ZipkinContainerConnectionDetailsFactory}. | ||
* | ||
* @author Moritz Halbritter | ||
*/ | ||
class ZipkinContainerConnectionDetailsFactoryTests { | ||
|
||
@Test | ||
void shouldRegisterHints() { | ||
RuntimeHints hints = new RuntimeHints(); | ||
new ZipkinContainerConnectionDetailsFactory().registerHints(hints, getClass().getClassLoader()); | ||
assertThat(RuntimeHintsPredicates.reflection().onType(ZipkinAutoConfiguration.class)).accepts(hints); | ||
} | ||
|
||
} |