|
19 | 19 | import java.util.ArrayList;
|
20 | 20 | import java.util.List;
|
21 | 21 |
|
22 |
| -import org.springframework.boot.SpringBootConfiguration; |
23 |
| -import org.springframework.boot.autoconfigure.ImportAutoConfiguration; |
24 |
| -import org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration; |
25 |
| -import org.springframework.boot.test.autoconfigure.filter.TypeExcludeFilters; |
26 |
| -import org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration; |
27 |
| -import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; |
28 |
| -import org.springframework.boot.test.context.SpringBootTest; |
29 | 22 | import org.springframework.nativex.hint.AccessBits;
|
30 |
| -import org.springframework.nativex.hint.FieldHint; |
31 | 23 | import org.springframework.nativex.hint.JdkProxyHint;
|
32 | 24 | import org.springframework.nativex.hint.NativeHint;
|
33 | 25 | import org.springframework.nativex.hint.TypeHint;
|
|
36 | 28 | import org.springframework.nativex.type.NativeConfiguration;
|
37 | 29 | import org.springframework.nativex.type.Type;
|
38 | 30 | import org.springframework.nativex.type.TypeSystem;
|
39 |
| -import org.springframework.security.test.context.support.WithSecurityContext; |
40 |
| -import org.springframework.security.web.FilterChainProxy; |
41 |
| -import org.springframework.security.web.context.SecurityContextPersistenceFilter; |
42 |
| -import org.springframework.test.context.ActiveProfiles; |
43 |
| -import org.springframework.test.context.TestPropertySource; |
44 | 31 |
|
45 |
| -@NativeHint(trigger = org.junit.jupiter.api.Test.class, types = { |
46 |
| - @TypeHint(types = { |
47 |
| - SpringBootTest.WebEnvironment.class, |
48 |
| - org.springframework.test.context.junit.jupiter.SpringExtension.class, |
49 |
| - org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.class, |
50 |
| - org.springframework.test.context.support.DefaultBootstrapContext.class, |
51 |
| - org.springframework.boot.test.context.SpringBootTestContextBootstrapper.class, |
52 |
| - org.springframework.boot.test.context.SpringBootContextLoader.class, |
53 |
| - org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener.class, |
54 |
| - org.springframework.boot.test.mock.mockito.MockitoPostProcessor.class, |
55 |
| - ImportAutoConfiguration.class, |
56 |
| - OverrideAutoConfiguration.class, |
57 |
| - TypeExcludeFilters.class, |
58 |
| - org.springframework.aot.test.AotCacheAwareContextLoaderDelegate.class |
| 32 | +/** |
| 33 | + * Native hints for Spring Boot's testing support. |
| 34 | + * |
| 35 | + * @see org.springframework.test.SpringTestHints |
| 36 | + */ |
| 37 | +@NativeHint(trigger = org.junit.jupiter.api.Test.class, |
| 38 | + types = { |
| 39 | + @TypeHint(types = { |
| 40 | + org.springframework.aot.test.AotCacheAwareContextLoaderDelegate.class, |
| 41 | + org.springframework.boot.autoconfigure.ImportAutoConfiguration.class, |
| 42 | + org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration.class, |
| 43 | + org.springframework.boot.test.autoconfigure.SpringBootDependencyInjectionTestExecutionListener.class, |
| 44 | + org.springframework.boot.test.autoconfigure.filter.TypeExcludeFilters.class, |
| 45 | + org.springframework.boot.test.context.SpringBootContextLoader.class, |
| 46 | + org.springframework.boot.test.context.SpringBootTest.WebEnvironment.class, |
| 47 | + org.springframework.boot.test.context.SpringBootTestContextBootstrapper.class, |
| 48 | + org.springframework.boot.test.mock.mockito.MockitoPostProcessor.class |
59 | 49 | }, typeNames = {
|
60 |
| - "org.springframework.boot.autoconfigure.test.ImportAutoConfiguration", |
61 |
| - "org.springframework.boot.test.mock.mockito.MockitoPostProcessor$SpyPostProcessor", |
62 |
| - "org.springframework.boot.test.context.ImportsContextCustomizer$ImportsCleanupPostProcessor" |
| 50 | + "org.springframework.boot.autoconfigure.test.ImportAutoConfiguration", |
| 51 | + "org.springframework.boot.test.mock.mockito.MockitoPostProcessor$SpyPostProcessor", |
| 52 | + "org.springframework.boot.test.context.ImportsContextCustomizer$ImportsCleanupPostProcessor" |
63 | 53 | }),
|
64 | 54 | @TypeHint(types = {
|
65 |
| - org.springframework.boot.test.context.SpringBootTest.class, |
66 |
| - ActiveProfiles.class, |
67 |
| - org.springframework.test.context.web.WebAppConfiguration.class, |
68 |
| - org.springframework.test.context.BootstrapWith.class, |
69 |
| - AutoConfigureMockMvc.class, |
70 |
| - SpringBootConfiguration.class, |
71 |
| - TestPropertySource.class |
| 55 | + org.springframework.boot.SpringBootConfiguration.class, |
| 56 | + org.springframework.boot.test.context.SpringBootTest.class, |
| 57 | + org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc.class, |
72 | 58 | }, access = AccessBits.ANNOTATION)
|
73 |
| -}, jdkProxies = { |
74 |
| - @JdkProxyHint(types = { org.springframework.test.context.BootstrapWith.class, org.springframework.core.annotation.SynthesizedAnnotation.class }), |
75 |
| - @JdkProxyHint(types = { org.springframework.boot.test.context.SpringBootTest.class, org.springframework.core.annotation.SynthesizedAnnotation.class }), |
| 59 | + }, |
| 60 | + jdkProxies = { |
76 | 61 | @JdkProxyHint(types = { org.springframework.context.annotation.Import.class, org.springframework.core.annotation.SynthesizedAnnotation.class }),
|
| 62 | + @JdkProxyHint(types = { org.springframework.boot.test.context.SpringBootTest.class, org.springframework.core.annotation.SynthesizedAnnotation.class }), |
77 | 63 | @JdkProxyHint(types = { org.springframework.boot.test.autoconfigure.OverrideAutoConfiguration.class, org.springframework.core.annotation.SynthesizedAnnotation.class }),
|
78 | 64 | @JdkProxyHint(types = { org.springframework.boot.test.autoconfigure.filter.TypeExcludeFilters.class, org.springframework.core.annotation.SynthesizedAnnotation.class }),
|
79 |
| - @JdkProxyHint(typeNames = { "org.springframework.context.annotation.ComponentScan$Filter", "org.springframework.core.annotation.SynthesizedAnnotation" }) |
80 |
| -}) |
81 |
| -@NativeHint(trigger = TestDatabaseAutoConfiguration.class, types = @TypeHint(typeNames = "org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration$EmbeddedDataSourceFactoryBean")) |
82 |
| -// TODO Move to Spring Security (test) hint |
83 |
| -@NativeHint(trigger = WithSecurityContext.class, types = { |
84 |
| - @TypeHint(types = { |
85 |
| - SecurityContextPersistenceFilter.class |
86 |
| - }, access = AccessBits.FULL_REFLECTION), |
87 |
| - @TypeHint(types = org.springframework.security.web.csrf.CsrfFilter.class, access = AccessBits.FULL_REFLECTION, fields = @FieldHint(name = "tokenRepository", allowWrite = true)), |
88 |
| - @TypeHint(types = FilterChainProxy.class, access = AccessBits.LOAD_AND_CONSTRUCT | AccessBits.DECLARED_METHODS), |
89 |
| - @TypeHint(types = WithSecurityContext.class, access = AccessBits.CLASS | AccessBits.DECLARED_METHODS), |
90 |
| - @TypeHint(typeNames = "org.springframework.security.test.context.support.WithMockUserSecurityContextFactory") |
91 |
| -}, jdkProxies = {@JdkProxyHint(types = { WithSecurityContext.class, org.springframework.core.annotation.SynthesizedAnnotation.class }) |
92 |
| -}) |
| 65 | + } |
| 66 | +) |
| 67 | + |
| 68 | +@NativeHint(trigger = org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration.class, |
| 69 | + types = @TypeHint(typeNames = "org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration$EmbeddedDataSourceFactoryBean")) |
| 70 | + |
93 | 71 | public class SpringBootTestHints implements NativeConfiguration {
|
94 | 72 |
|
95 | 73 | @Override
|
|
0 commit comments