From c66ef81d34db9dc9feddb644df8d0359ddec9b47 Mon Sep 17 00:00:00 2001 From: jansupol Date: Fri, 1 Apr 2022 16:11:20 +0200 Subject: [PATCH] Spring 6 module introduction Signed-off-by: jansupol --- bom/pom.xml | 15 +- ext/pom.xml | 5 +- ext/spring4/pom.xml | 225 ----------- .../spring/AutowiredInjectResolver.java | 119 ------ .../spring/scope/JaxrsRequestAttributes.java | 94 ----- .../scope/JaxrsServletRequestAttributes.java | 55 --- .../server/spring/localization.properties | 26 -- .../jersey/server/spring/NoComponent.java | 21 - .../spring/SpringTestConfiguration.java | 25 -- .../jersey/server/spring/TestComponent2.java | 21 - .../server/spring/TestComponent2Impl2.java | 27 -- .../spring/aspect4j/Aspect4jJerseyConfig.java | 29 -- .../spring/aspect4j/ComponentResource.java | 49 --- .../spring/aspect4j/NoComponentResource.java | 38 -- .../SpringFieldInjectionTest.java | 61 --- .../SpringFieldInjectionTestResource.java | 72 ---- .../jersey/server/spring/filter/Counter.java | 34 -- ...SpringMethodInjectionJerseyTestConfig.java | 27 -- .../SpringMethodInjectionTest.java | 55 --- .../SpringMethodInjectionTestResource.java | 83 ---- .../SpringParameterInjectionTestResource.java | 65 ---- .../spring/profiles/DefaultTestService.java | 28 -- .../spring/profiles/DevTestService.java | 32 -- .../SpringDefaultProfileResourceTest.java | 49 --- .../SpringDevProfileResourceTest.java | 49 --- .../profiles/SpringRequestResource.java | 43 --- ext/spring5/pom.xml | 206 ---------- .../spring/SpringComponentProvider.java | 177 --------- .../SpringWebApplicationInitializer.java | 49 --- .../jersey/server/spring/package-info.java | 21 - .../spring/scope/RequestContextFilter.java | 116 ------ .../server/spring/scope/package-info.java | 21 - ...ssfish.jersey.server.spi.ComponentProvider | 1 - .../jersey-spring-applicationContext.xml | 34 -- .../jersey/server/spring/TestComponent1.java | 27 -- .../server/spring/TestComponent2Impl1.java | 27 -- .../server/spring/aspect4j/Aspect4JTest.java | 64 ---- .../server/spring/aspect4j/TestAspect.java | 43 --- .../SpringFieldInjectionJerseyTestConfig.java | 27 -- .../server/spring/filter/FilterTest.java | 46 --- .../spring/filter/JerseyTestConfig.java | 29 -- .../server/spring/filter/TestResource.java | 30 -- ...ingParameterInjectionJerseyTestConfig.java | 27 -- .../SpringParameterInjectionTest.java | 55 --- .../spring/profiles/SpringProfilesTest.java | 40 -- .../server/spring/profiles/TestService.java | 22 -- ...sey-spring-aspect4j-applicationContext.xml | 33 -- ext/spring6/pom.xml | 361 ++++++++++++++++++ .../jersey/server/spring/package-info.java | 6 +- .../server/spring/scope/package-info.java | 6 +- .../spring/AutowiredInjectResolver.java | 2 +- .../spring/SpringComponentProvider.java | 4 +- .../spring/SpringLifecycleListener.java | 4 +- .../SpringWebApplicationInitializer.java | 2 +- .../spring/scope/JaxrsRequestAttributes.java | 2 +- .../scope/JaxrsServletRequestAttributes.java | 2 +- .../spring/scope/RequestContextFilter.java | 2 +- .../spring/AutowiredInjectResolver.java} | 35 +- .../spring/SpringComponentProvider.java | 50 +++ .../spring/SpringLifecycleListener.java | 26 +- .../spring/scope/RequestContextFilter.java | 54 +++ ...ssfish.jersey.server.spi.ComponentProvider | 0 .../jersey-spring-applicationContext.xml | 2 +- .../server/spring/localization.properties | 3 +- .../jersey/server/spring/NoComponent.java | 2 +- .../spring/SpringTestConfiguration.java | 2 +- .../jersey/server/spring/TestComponent1.java | 2 +- .../jersey/server/spring/TestComponent2.java | 2 +- .../server/spring/TestComponent2Impl1.java | 2 +- .../server/spring/TestComponent2Impl2.java | 2 +- .../server/spring/aspect4j/Aspect4JTest.java | 2 +- .../spring/aspect4j/Aspect4jJerseyConfig.java | 2 +- .../spring/aspect4j/ComponentResource.java | 2 +- .../spring/aspect4j/NoComponentResource.java | 2 +- .../server/spring/aspect4j/TestAspect.java | 2 +- .../SpringFieldInjectionJerseyTestConfig.java | 2 +- .../SpringFieldInjectionTest.java | 2 +- .../SpringFieldInjectionTestResource.java | 2 +- .../jersey/server/spring/filter/Counter.java | 2 +- .../server/spring/filter/FilterTest.java | 2 +- .../spring/filter/JerseyTestConfig.java | 2 +- .../server/spring/filter/TestFilter.java | 2 +- .../server/spring/filter/TestResource.java | 2 +- ...SpringMethodInjectionJerseyTestConfig.java | 2 +- .../SpringMethodInjectionTest.java | 2 +- .../SpringMethodInjectionTestResource.java | 2 +- ...ingParameterInjectionJerseyTestConfig.java | 2 +- .../SpringParameterInjectionTest.java | 2 +- .../SpringParameterInjectionTestResource.java | 2 +- .../spring/profiles/DefaultTestService.java | 2 +- .../spring/profiles/DevTestService.java | 2 +- .../SpringDefaultProfileResourceTest.java | 2 +- .../SpringDevProfileResourceTest.java | 2 +- .../spring/profiles/SpringProfilesTest.java | 2 +- .../profiles/SpringRequestResource.java | 2 +- .../server/spring/profiles/TestService.java | 2 +- ...sey-spring-aspect4j-applicationContext.xml | 2 +- pom.xml | 5 +- tests/integration/pom.xml | 11 +- tests/integration/spring4/pom.xml | 166 -------- .../spring/test/AccountJerseyResource.java | 164 -------- .../server/spring/test/AccountService.java | 33 -- .../spring/test/AccountServiceImpl.java | 63 --- .../spring/test/AccountSpringResource.java | 167 -------- .../server/spring/test/EndpointResource.java | 47 --- .../spring/test/HK2ServicePerLookup.java | 25 -- .../spring/test/HK2ServiceRequestScoped.java | 25 -- .../server/spring/test/MyApplication.java | 50 --- .../spring/test/RepositoryResource.java | 49 --- .../server/spring/test/ServiceResource.java | 49 --- .../src/main/resources/applicationContext.xml | 69 ---- .../test/SpringManagedEndpointITCase.java | 54 --- tests/integration/spring5/README.txt | 30 -- .../spring/test/ControllerResource.java | 49 --- .../jersey/server/spring/test/Endpoint.java | 34 -- .../spring/test/HK2ServiceSingleton.java | 25 -- .../spring5/src/main/webapp/WEB-INF/web.xml | 50 --- .../spring/test/AccountResourceITCase.java | 47 --- .../spring/test/AccountResourceTestBase.java | 83 ---- .../spring/test/JerseyManagedITCase.java | 54 --- .../server/spring/test/ResourceTestBase.java | 67 ---- .../test/SpringManagedControllerITCase.java | 53 --- .../spring/test/SpringManagedITCase.java | 54 --- .../test/SpringManagedRepositoryITCase.java | 53 --- .../test/SpringManagedServiceITCase.java | 53 --- .../jersey/server/spring/test/TestUtil.java | 52 --- .../{spring4 => spring6}/README.txt | 0 .../integration/{spring5 => spring6}/pom.xml | 57 ++- .../spring/test/AccountJerseyResource.java | 2 +- .../server/spring/test/AccountService.java | 2 +- .../spring/test/AccountServiceImpl.java | 2 +- .../spring/test/AccountSpringResource.java | 2 +- .../spring/test/ControllerResource.java | 2 +- .../jersey/server/spring/test/Endpoint.java | 2 +- .../server/spring/test/EndpointResource.java | 2 +- .../spring/test/HK2ServicePerLookup.java | 2 +- .../spring/test/HK2ServiceRequestScoped.java | 2 +- .../spring/test/HK2ServiceSingleton.java | 2 +- .../server/spring/test/MyApplication.java | 2 +- .../spring/test/RepositoryResource.java | 2 +- .../server/spring/test/ServiceResource.java | 2 +- .../src/main/resources/applicationContext.xml | 2 +- .../src/main/webapp/WEB-INF/web.xml | 2 +- .../spring/test/AccountResourceITCase.java | 2 +- .../spring/test/AccountResourceTestBase.java | 2 +- .../spring/test/JerseyManagedITCase.java | 2 +- .../server/spring/test/ResourceTestBase.java | 2 +- .../test/SpringManagedControllerITCase.java | 2 +- .../test/SpringManagedEndpointITCase.java | 2 +- .../spring/test/SpringManagedITCase.java | 2 +- .../test/SpringManagedRepositoryITCase.java | 2 +- .../test/SpringManagedServiceITCase.java | 2 +- .../jersey/server/spring/test/TestUtil.java | 2 +- 153 files changed, 628 insertions(+), 4229 deletions(-) delete mode 100644 ext/spring4/pom.xml delete mode 100644 ext/spring4/src/main/java/org/glassfish/jersey/server/spring/AutowiredInjectResolver.java delete mode 100644 ext/spring4/src/main/java/org/glassfish/jersey/server/spring/scope/JaxrsRequestAttributes.java delete mode 100644 ext/spring4/src/main/java/org/glassfish/jersey/server/spring/scope/JaxrsServletRequestAttributes.java delete mode 100644 ext/spring4/src/main/resources/org/glassfish/jersey/server/spring/localization.properties delete mode 100644 ext/spring4/src/test/java/org/glassfish/jersey/server/spring/NoComponent.java delete mode 100644 ext/spring4/src/test/java/org/glassfish/jersey/server/spring/SpringTestConfiguration.java delete mode 100644 ext/spring4/src/test/java/org/glassfish/jersey/server/spring/TestComponent2.java delete mode 100644 ext/spring4/src/test/java/org/glassfish/jersey/server/spring/TestComponent2Impl2.java delete mode 100644 ext/spring4/src/test/java/org/glassfish/jersey/server/spring/aspect4j/Aspect4jJerseyConfig.java delete mode 100644 ext/spring4/src/test/java/org/glassfish/jersey/server/spring/aspect4j/ComponentResource.java delete mode 100644 ext/spring4/src/test/java/org/glassfish/jersey/server/spring/aspect4j/NoComponentResource.java delete mode 100644 ext/spring4/src/test/java/org/glassfish/jersey/server/spring/fieldinjection/SpringFieldInjectionTest.java delete mode 100644 ext/spring4/src/test/java/org/glassfish/jersey/server/spring/fieldinjection/SpringFieldInjectionTestResource.java delete mode 100644 ext/spring4/src/test/java/org/glassfish/jersey/server/spring/filter/Counter.java delete mode 100644 ext/spring4/src/test/java/org/glassfish/jersey/server/spring/methodinjection/SpringMethodInjectionJerseyTestConfig.java delete mode 100644 ext/spring4/src/test/java/org/glassfish/jersey/server/spring/methodinjection/SpringMethodInjectionTest.java delete mode 100644 ext/spring4/src/test/java/org/glassfish/jersey/server/spring/methodinjection/SpringMethodInjectionTestResource.java delete mode 100644 ext/spring4/src/test/java/org/glassfish/jersey/server/spring/parameterinjection/SpringParameterInjectionTestResource.java delete mode 100644 ext/spring4/src/test/java/org/glassfish/jersey/server/spring/profiles/DefaultTestService.java delete mode 100644 ext/spring4/src/test/java/org/glassfish/jersey/server/spring/profiles/DevTestService.java delete mode 100644 ext/spring4/src/test/java/org/glassfish/jersey/server/spring/profiles/SpringDefaultProfileResourceTest.java delete mode 100644 ext/spring4/src/test/java/org/glassfish/jersey/server/spring/profiles/SpringDevProfileResourceTest.java delete mode 100644 ext/spring4/src/test/java/org/glassfish/jersey/server/spring/profiles/SpringRequestResource.java delete mode 100644 ext/spring5/pom.xml delete mode 100644 ext/spring5/src/main/java/org/glassfish/jersey/server/spring/SpringComponentProvider.java delete mode 100644 ext/spring5/src/main/java/org/glassfish/jersey/server/spring/SpringWebApplicationInitializer.java delete mode 100644 ext/spring5/src/main/java/org/glassfish/jersey/server/spring/package-info.java delete mode 100644 ext/spring5/src/main/java/org/glassfish/jersey/server/spring/scope/RequestContextFilter.java delete mode 100644 ext/spring5/src/main/java/org/glassfish/jersey/server/spring/scope/package-info.java delete mode 100644 ext/spring5/src/main/resources/META-INF/services/org.glassfish.jersey.server.spi.ComponentProvider delete mode 100644 ext/spring5/src/main/resources/jersey-spring-applicationContext.xml delete mode 100644 ext/spring5/src/test/java/org/glassfish/jersey/server/spring/TestComponent1.java delete mode 100644 ext/spring5/src/test/java/org/glassfish/jersey/server/spring/TestComponent2Impl1.java delete mode 100644 ext/spring5/src/test/java/org/glassfish/jersey/server/spring/aspect4j/Aspect4JTest.java delete mode 100644 ext/spring5/src/test/java/org/glassfish/jersey/server/spring/aspect4j/TestAspect.java delete mode 100644 ext/spring5/src/test/java/org/glassfish/jersey/server/spring/fieldinjection/SpringFieldInjectionJerseyTestConfig.java delete mode 100644 ext/spring5/src/test/java/org/glassfish/jersey/server/spring/filter/FilterTest.java delete mode 100644 ext/spring5/src/test/java/org/glassfish/jersey/server/spring/filter/JerseyTestConfig.java delete mode 100644 ext/spring5/src/test/java/org/glassfish/jersey/server/spring/filter/TestResource.java delete mode 100644 ext/spring5/src/test/java/org/glassfish/jersey/server/spring/parameterinjection/SpringParameterInjectionJerseyTestConfig.java delete mode 100644 ext/spring5/src/test/java/org/glassfish/jersey/server/spring/parameterinjection/SpringParameterInjectionTest.java delete mode 100644 ext/spring5/src/test/java/org/glassfish/jersey/server/spring/profiles/SpringProfilesTest.java delete mode 100644 ext/spring5/src/test/java/org/glassfish/jersey/server/spring/profiles/TestService.java delete mode 100644 ext/spring5/src/test/resources/jersey-spring-aspect4j-applicationContext.xml create mode 100644 ext/spring6/pom.xml rename ext/{spring4 => spring6}/src/main/java/org/glassfish/jersey/server/spring/package-info.java (84%) rename ext/{spring4 => spring6}/src/main/java/org/glassfish/jersey/server/spring/scope/package-info.java (83%) rename ext/{spring5/src/main/java => spring6/src/main/java17}/org/glassfish/jersey/server/spring/AutowiredInjectResolver.java (98%) rename ext/{spring4/src/main/java => spring6/src/main/java17}/org/glassfish/jersey/server/spring/SpringComponentProvider.java (98%) rename ext/{spring5/src/main/java => spring6/src/main/java17}/org/glassfish/jersey/server/spring/SpringLifecycleListener.java (93%) rename ext/{spring4/src/main/java => spring6/src/main/java17}/org/glassfish/jersey/server/spring/SpringWebApplicationInitializer.java (96%) rename ext/{spring5/src/main/java => spring6/src/main/java17}/org/glassfish/jersey/server/spring/scope/JaxrsRequestAttributes.java (97%) rename ext/{spring5/src/main/java => spring6/src/main/java17}/org/glassfish/jersey/server/spring/scope/JaxrsServletRequestAttributes.java (96%) rename ext/{spring4/src/main/java => spring6/src/main/java17}/org/glassfish/jersey/server/spring/scope/RequestContextFilter.java (98%) rename ext/{spring5/src/test/java/org/glassfish/jersey/server/spring/filter/TestFilter.java => spring6/src/main/javaPre17/org/glassfish/jersey/server/spring/AutowiredInjectResolver.java} (53%) create mode 100644 ext/spring6/src/main/javaPre17/org/glassfish/jersey/server/spring/SpringComponentProvider.java rename ext/{spring4/src/main/java => spring6/src/main/javaPre17}/org/glassfish/jersey/server/spring/SpringLifecycleListener.java (62%) create mode 100644 ext/spring6/src/main/javaPre17/org/glassfish/jersey/server/spring/scope/RequestContextFilter.java rename ext/{spring4 => spring6}/src/main/resources/META-INF/services/org.glassfish.jersey.server.spi.ComponentProvider (100%) rename ext/{spring4 => spring6}/src/main/resources/jersey-spring-applicationContext.xml (95%) rename ext/{spring5 => spring6}/src/main/resources/org/glassfish/jersey/server/spring/localization.properties (91%) rename ext/{spring5 => spring6}/src/test/java/org/glassfish/jersey/server/spring/NoComponent.java (91%) rename ext/{spring5 => spring6}/src/test/java/org/glassfish/jersey/server/spring/SpringTestConfiguration.java (93%) rename ext/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/TestComponent1.java (92%) rename ext/{spring5 => spring6}/src/test/java/org/glassfish/jersey/server/spring/TestComponent2.java (92%) rename ext/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/TestComponent2Impl1.java (93%) rename ext/{spring5 => spring6}/src/test/java/org/glassfish/jersey/server/spring/TestComponent2Impl2.java (93%) rename ext/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/aspect4j/Aspect4JTest.java (97%) rename ext/{spring5 => spring6}/src/test/java/org/glassfish/jersey/server/spring/aspect4j/Aspect4jJerseyConfig.java (94%) rename ext/{spring5 => spring6}/src/test/java/org/glassfish/jersey/server/spring/aspect4j/ComponentResource.java (95%) rename ext/{spring5 => spring6}/src/test/java/org/glassfish/jersey/server/spring/aspect4j/NoComponentResource.java (94%) rename ext/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/aspect4j/TestAspect.java (95%) rename ext/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/fieldinjection/SpringFieldInjectionJerseyTestConfig.java (94%) rename ext/{spring5 => spring6}/src/test/java/org/glassfish/jersey/server/spring/fieldinjection/SpringFieldInjectionTest.java (97%) rename ext/{spring5 => spring6}/src/test/java/org/glassfish/jersey/server/spring/fieldinjection/SpringFieldInjectionTestResource.java (97%) rename ext/{spring5 => spring6}/src/test/java/org/glassfish/jersey/server/spring/filter/Counter.java (93%) rename ext/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/filter/FilterTest.java (96%) rename ext/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/filter/JerseyTestConfig.java (94%) rename ext/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/filter/TestFilter.java (94%) rename ext/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/filter/TestResource.java (93%) rename ext/{spring5 => spring6}/src/test/java/org/glassfish/jersey/server/spring/methodinjection/SpringMethodInjectionJerseyTestConfig.java (94%) rename ext/{spring5 => spring6}/src/test/java/org/glassfish/jersey/server/spring/methodinjection/SpringMethodInjectionTest.java (96%) rename ext/{spring5 => spring6}/src/test/java/org/glassfish/jersey/server/spring/methodinjection/SpringMethodInjectionTestResource.java (97%) rename ext/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/parameterinjection/SpringParameterInjectionJerseyTestConfig.java (94%) rename ext/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/parameterinjection/SpringParameterInjectionTest.java (96%) rename ext/{spring5 => spring6}/src/test/java/org/glassfish/jersey/server/spring/parameterinjection/SpringParameterInjectionTestResource.java (97%) rename ext/{spring5 => spring6}/src/test/java/org/glassfish/jersey/server/spring/profiles/DefaultTestService.java (93%) rename ext/{spring5 => spring6}/src/test/java/org/glassfish/jersey/server/spring/profiles/DevTestService.java (94%) rename ext/{spring5 => spring6}/src/test/java/org/glassfish/jersey/server/spring/profiles/SpringDefaultProfileResourceTest.java (96%) rename ext/{spring5 => spring6}/src/test/java/org/glassfish/jersey/server/spring/profiles/SpringDevProfileResourceTest.java (96%) rename ext/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/profiles/SpringProfilesTest.java (96%) rename ext/{spring5 => spring6}/src/test/java/org/glassfish/jersey/server/spring/profiles/SpringRequestResource.java (95%) rename ext/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/profiles/TestService.java (92%) rename ext/{spring4 => spring6}/src/test/resources/jersey-spring-aspect4j-applicationContext.xml (95%) delete mode 100644 tests/integration/spring4/pom.xml delete mode 100644 tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountJerseyResource.java delete mode 100644 tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountService.java delete mode 100644 tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountServiceImpl.java delete mode 100644 tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountSpringResource.java delete mode 100644 tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/EndpointResource.java delete mode 100644 tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServicePerLookup.java delete mode 100644 tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceRequestScoped.java delete mode 100644 tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/MyApplication.java delete mode 100644 tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/RepositoryResource.java delete mode 100644 tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/ServiceResource.java delete mode 100644 tests/integration/spring4/src/main/resources/applicationContext.xml delete mode 100644 tests/integration/spring4/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedEndpointITCase.java delete mode 100644 tests/integration/spring5/README.txt delete mode 100644 tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/ControllerResource.java delete mode 100644 tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/Endpoint.java delete mode 100644 tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceSingleton.java delete mode 100644 tests/integration/spring5/src/main/webapp/WEB-INF/web.xml delete mode 100644 tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/AccountResourceITCase.java delete mode 100644 tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/AccountResourceTestBase.java delete mode 100644 tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/JerseyManagedITCase.java delete mode 100644 tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/ResourceTestBase.java delete mode 100644 tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedControllerITCase.java delete mode 100644 tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedITCase.java delete mode 100644 tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedRepositoryITCase.java delete mode 100644 tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedServiceITCase.java delete mode 100644 tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/TestUtil.java rename tests/integration/{spring4 => spring6}/README.txt (100%) rename tests/integration/{spring5 => spring6}/pom.xml (73%) rename tests/integration/{spring5 => spring6}/src/main/java/org/glassfish/jersey/server/spring/test/AccountJerseyResource.java (98%) rename tests/integration/{spring5 => spring6}/src/main/java/org/glassfish/jersey/server/spring/test/AccountService.java (94%) rename tests/integration/{spring5 => spring6}/src/main/java/org/glassfish/jersey/server/spring/test/AccountServiceImpl.java (96%) rename tests/integration/{spring5 => spring6}/src/main/java/org/glassfish/jersey/server/spring/test/AccountSpringResource.java (98%) rename tests/integration/{spring4 => spring6}/src/main/java/org/glassfish/jersey/server/spring/test/ControllerResource.java (95%) rename tests/integration/{spring4 => spring6}/src/main/java/org/glassfish/jersey/server/spring/test/Endpoint.java (94%) rename tests/integration/{spring5 => spring6}/src/main/java/org/glassfish/jersey/server/spring/test/EndpointResource.java (95%) rename tests/integration/{spring5 => spring6}/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServicePerLookup.java (92%) rename tests/integration/{spring5 => spring6}/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceRequestScoped.java (92%) rename tests/integration/{spring4 => spring6}/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceSingleton.java (92%) rename tests/integration/{spring5 => spring6}/src/main/java/org/glassfish/jersey/server/spring/test/MyApplication.java (96%) rename tests/integration/{spring5 => spring6}/src/main/java/org/glassfish/jersey/server/spring/test/RepositoryResource.java (95%) rename tests/integration/{spring5 => spring6}/src/main/java/org/glassfish/jersey/server/spring/test/ServiceResource.java (95%) rename tests/integration/{spring5 => spring6}/src/main/resources/applicationContext.xml (98%) rename tests/integration/{spring4 => spring6}/src/main/webapp/WEB-INF/web.xml (96%) rename tests/integration/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/test/AccountResourceITCase.java (96%) rename tests/integration/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/test/AccountResourceTestBase.java (98%) rename tests/integration/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/test/JerseyManagedITCase.java (96%) rename tests/integration/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/test/ResourceTestBase.java (97%) rename tests/integration/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedControllerITCase.java (96%) rename tests/integration/{spring5 => spring6}/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedEndpointITCase.java (96%) rename tests/integration/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedITCase.java (96%) rename tests/integration/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedRepositoryITCase.java (96%) rename tests/integration/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedServiceITCase.java (96%) rename tests/integration/{spring4 => spring6}/src/test/java/org/glassfish/jersey/server/spring/test/TestUtil.java (96%) diff --git a/bom/pom.xml b/bom/pom.xml index 2746bf6d0b..345928f845 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -188,16 +188,11 @@ jersey-proxy-client ${project.version} - - - - - - - - - - + + org.glassfish.jersey.ext + jersey-spring6 + ${project.version} + org.glassfish.jersey.ext jersey-declarative-linking diff --git a/ext/pom.xml b/ext/pom.xml index 2c6e1500d4..fa7003a00b 100644 --- a/ext/pom.xml +++ b/ext/pom.xml @@ -51,10 +51,7 @@ mvc-mustache proxy-client rx - + spring6 wadl-doclet microprofile diff --git a/ext/spring4/pom.xml b/ext/spring4/pom.xml deleted file mode 100644 index e436f3da1b..0000000000 --- a/ext/spring4/pom.xml +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - 4.0.0 - - - org.glassfish.jersey.ext - project - 3.0.0-SNAPSHOT - - - jersey-spring4 - jersey-spring4 - - jar - - - Jersey extension module providing support for Spring 4 integration. - - - - - org.glassfish.jersey.core - jersey-server - ${project.version} - - - - org.glassfish.jersey.inject - jersey-hk2 - ${project.version} - - - - org.glassfish.jersey.containers - jersey-container-servlet-core - ${project.version} - - - - org.glassfish.jersey.test-framework.providers - jersey-test-framework-provider-grizzly2 - ${project.version} - test - - - - commons-logging - commons-logging - 1.2 - test - - - - org.glassfish.hk2 - hk2 - ${hk2.version} - - - - org.glassfish.hk2 - spring-bridge - ${hk2.version} - - - jakarta.inject - jakarta.inject-api - - - org.glassfish.hk2 - hk2-api - - - - - - org.springframework - spring-beans - ${spring4.version} - - - - org.springframework - spring-core - ${spring4.version} - - - commons-logging - commons-logging - - - - - - org.springframework - spring-web - ${spring4.version} - - - - org.springframework - spring-aop - ${spring4.version} - - - - jakarta.servlet - jakarta.servlet-api - ${servlet4.version} - provided - - - - org.glassfish.jersey.test-framework - jersey-test-framework-core - ${project.version} - test - - - - org.aspectj - aspectjrt - 1.6.11 - test - - - org.aspectj - aspectjweaver - 1.6.11 - test - - - - - - - - com.sun.istack - istack-commons-maven-plugin - true - - - org.codehaus.mojo - build-helper-maven-plugin - true - - - - - - - jakartification_exclude_tests - - [1.8,) - - - - - org.apache.maven.plugins - maven-surefire-plugin - - true - - - - - - - delayed-strategy-skip-test - - - org.glassfish.jersey.injection.manager.strategy - delayed - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - true - - - - - - - ignore.on.jdk16 - - - [16,) - - - - - org.apache.maven.plugins - maven-surefire-plugin - - true - - - - - - - diff --git a/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/AutowiredInjectResolver.java b/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/AutowiredInjectResolver.java deleted file mode 100644 index 1158fc60ca..0000000000 --- a/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/AutowiredInjectResolver.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring; - -import java.lang.reflect.AnnotatedElement; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.HashSet; -import java.util.Set; -import java.util.logging.Logger; - -import jakarta.inject.Singleton; - -import org.glassfish.jersey.internal.inject.Injectee; -import org.glassfish.jersey.internal.inject.InjectionResolver; - -import org.springframework.beans.factory.NoSuchBeanDefinitionException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.config.DependencyDescriptor; -import org.springframework.context.ApplicationContext; -import org.springframework.core.MethodParameter; - -/** - * HK2 injection resolver for Spring framework {@link Autowired} annotation injection. - * - * @author Marko Asplund (marko.asplund at yahoo.com) - * @author Vetle Leinonen-Roeim (vetle at roeim.net) - */ -@Singleton -public class AutowiredInjectResolver implements InjectionResolver { - - private static final Logger LOGGER = Logger.getLogger(AutowiredInjectResolver.class.getName()); - - private volatile ApplicationContext ctx; - - /** - * Create a new instance. - * - * @param ctx Spring application context. - */ - public AutowiredInjectResolver(ApplicationContext ctx) { - this.ctx = ctx; - } - - @Override - public Object resolve(Injectee injectee) { - AnnotatedElement parent = injectee.getParent(); - String beanName = null; - if (parent != null) { - Qualifier an = parent.getAnnotation(Qualifier.class); - if (an != null) { - beanName = an.value(); - } - } - boolean required = parent != null ? parent.getAnnotation(Autowired.class).required() : false; - return getBeanFromSpringContext(beanName, injectee, required); - } - - private Object getBeanFromSpringContext(String beanName, Injectee injectee, final boolean required) { - try { - DependencyDescriptor dependencyDescriptor = createSpringDependencyDescriptor(injectee); - Set autowiredBeanNames = new HashSet<>(1); - autowiredBeanNames.add(beanName); - return ctx.getAutowireCapableBeanFactory().resolveDependency(dependencyDescriptor, null, - autowiredBeanNames, null); - } catch (NoSuchBeanDefinitionException e) { - if (required) { - LOGGER.warning(e.getMessage()); - throw e; - } - return null; - } - } - - private DependencyDescriptor createSpringDependencyDescriptor(final Injectee injectee) { - AnnotatedElement annotatedElement = injectee.getParent(); - - if (annotatedElement.getClass().isAssignableFrom(Field.class)) { - return new DependencyDescriptor((Field) annotatedElement, !injectee.isOptional()); - } else if (annotatedElement.getClass().isAssignableFrom(Method.class)) { - return new DependencyDescriptor( - new MethodParameter((Method) annotatedElement, injectee.getPosition()), !injectee.isOptional()); - } else { - return new DependencyDescriptor( - new MethodParameter((Constructor) annotatedElement, injectee.getPosition()), !injectee.isOptional()); - } - } - - @Override - public boolean isConstructorParameterIndicator() { - return false; - } - - @Override - public boolean isMethodParameterIndicator() { - return false; - } - - @Override - public Class getAnnotation() { - return Autowired.class; - } -} diff --git a/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/scope/JaxrsRequestAttributes.java b/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/scope/JaxrsRequestAttributes.java deleted file mode 100644 index ec22efaeb6..0000000000 --- a/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/scope/JaxrsRequestAttributes.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.scope; - -import jakarta.ws.rs.container.ContainerRequestContext; - -import org.glassfish.jersey.server.spring.LocalizationMessages; -import org.springframework.util.StringUtils; -import org.springframework.web.context.request.AbstractRequestAttributes; - -/** - * JAX-RS based Spring RequestAttributes implementation. - * - * @author Marko Asplund (marko.asplund at yahoo.com) - * @author Marek Potociar - */ -class JaxrsRequestAttributes extends AbstractRequestAttributes { - - private final ContainerRequestContext requestContext; - - /** - * Create a new instance. - * - * @param requestContext JAX-RS container request context - */ - public JaxrsRequestAttributes(ContainerRequestContext requestContext) { - this.requestContext = requestContext; - } - - @Override - protected void updateAccessedSessionAttributes() { - // sessions not supported - } - - @Override - public Object getAttribute(String name, int scope) { - return requestContext.getProperty(name); - } - - @Override - public void setAttribute(String name, Object value, int scope) { - requestContext.setProperty(name, value); - } - - @Override - public void removeAttribute(String name, int scope) { - requestContext.removeProperty(name); - } - - @Override - public String[] getAttributeNames(int scope) { - if (!isRequestActive()) { - throw new IllegalStateException(LocalizationMessages.NOT_IN_REQUEST_SCOPE()); - } - return StringUtils.toStringArray(requestContext.getPropertyNames()); - } - - @Override - public void registerDestructionCallback(String name, Runnable callback, int scope) { - registerRequestDestructionCallback(name, callback); - } - - @Override - public Object resolveReference(String key) { - if (REFERENCE_REQUEST.equals(key)) { - return requestContext; - } - return null; - } - - @Override - public String getSessionId() { - return null; - } - - @Override - public Object getSessionMutex() { - return null; - } -} diff --git a/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/scope/JaxrsServletRequestAttributes.java b/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/scope/JaxrsServletRequestAttributes.java deleted file mode 100644 index a3ac9d1235..0000000000 --- a/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/scope/JaxrsServletRequestAttributes.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.scope; - -import jakarta.ws.rs.container.ContainerRequestContext; - -import jakarta.servlet.http.HttpServletRequest; - -import org.springframework.web.context.request.ServletRequestAttributes; - -/** - * JAX-RS based Spring RequestAttributes implementation for Servlet-based applications. - * - * @author Marek Potociar - */ -class JaxrsServletRequestAttributes extends ServletRequestAttributes { - - private final ContainerRequestContext requestContext; - - /** - * Create a new JAX-RS ServletRequestAttributes instance for the given request. - * - * @param request current HTTP request - * @param requestContext JAX-RS request context - */ - public JaxrsServletRequestAttributes(final HttpServletRequest request, final ContainerRequestContext requestContext) { - super(request); - this.requestContext = requestContext; - } - - @Override - public Object resolveReference(String key) { - if (REFERENCE_REQUEST.equals(key)) { - return this.requestContext; - } else if (REFERENCE_SESSION.equals(key)) { - return super.getSession(true); - } else { - return null; - } - } -} diff --git a/ext/spring4/src/main/resources/org/glassfish/jersey/server/spring/localization.properties b/ext/spring4/src/main/resources/org/glassfish/jersey/server/spring/localization.properties deleted file mode 100644 index 6fd0a06270..0000000000 --- a/ext/spring4/src/main/resources/org/glassfish/jersey/server/spring/localization.properties +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. -# -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v. 2.0, which is available at -# http://www.eclipse.org/legal/epl-2.0. -# -# This Source Code may also be made available under the following Secondary -# Licenses when the conditions for such availability set forth in the -# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, -# version 2 with the GNU Classpath Exception, which is available at -# https://www.gnu.org/software/classpath/license.html. -# -# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 -# - -no.beans.found.for.type=No beans found. Resolution failed for type {0}. -ctx.lookup.started=Spring context lookup started. -ctx.lookup.failed=Spring context lookup failed, skipping spring component provider initialization. -ctx.lookup.sucessful=Spring context lookup done. -spring.component.provider.initialized=Spring component provider initialized. -none.or.multiple.beans.available=None or multiple beans found in Spring context for type {0}, skipping the type. -bean.registered=Spring managed bean, {0}, registered with HK2. -registering.ctx.loader.listener=Registering Spring ContextLoaderListener -skipping.ctx.lodaer.listener.registration=Presuming Spring ContextLoaderListener was manually registered. Skipping context loader registration. -not.in.request.scope=Cannot ask for request attributes - request is not active anymore! diff --git a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/NoComponent.java b/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/NoComponent.java deleted file mode 100644 index 111361c378..0000000000 --- a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/NoComponent.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring; - -public class NoComponent { - -} diff --git a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/SpringTestConfiguration.java b/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/SpringTestConfiguration.java deleted file mode 100644 index 5a8123cc42..0000000000 --- a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/SpringTestConfiguration.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring; - -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ComponentScan(basePackages = "org.glassfish.jersey.server.spring") -public class SpringTestConfiguration { -} diff --git a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/TestComponent2.java b/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/TestComponent2.java deleted file mode 100644 index 792d9b85e8..0000000000 --- a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/TestComponent2.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring; - -public interface TestComponent2 { - String result(); -} diff --git a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/TestComponent2Impl2.java b/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/TestComponent2Impl2.java deleted file mode 100644 index 9900cd476d..0000000000 --- a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/TestComponent2Impl2.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring; - -import org.springframework.stereotype.Component; - -@Component -public class TestComponent2Impl2 implements TestComponent2 { - @Override - public String result() { - return "test ok"; - } -} diff --git a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/aspect4j/Aspect4jJerseyConfig.java b/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/aspect4j/Aspect4jJerseyConfig.java deleted file mode 100644 index 4506c7ecaf..0000000000 --- a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/aspect4j/Aspect4jJerseyConfig.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.aspect4j; - -import org.glassfish.jersey.server.ResourceConfig; -import org.glassfish.jersey.server.spring.scope.RequestContextFilter; - -public class Aspect4jJerseyConfig extends ResourceConfig { - - public Aspect4jJerseyConfig() { - register(RequestContextFilter.class); - register(NoComponentResource.class); - register(ComponentResource.class); - } -} diff --git a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/aspect4j/ComponentResource.java b/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/aspect4j/ComponentResource.java deleted file mode 100644 index 9b96e32de1..0000000000 --- a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/aspect4j/ComponentResource.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.aspect4j; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.core.Context; -import jakarta.ws.rs.core.UriInfo; - -import org.glassfish.jersey.server.spring.TestComponent1; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Path("/") -@Component -public class ComponentResource { - - @Autowired - private TestComponent1 testComponent1; - @Context - private UriInfo uriInfo; - - @Path("test2") - @GET - public String test2() { - return testComponent1.result(); - } - - @Path("JERSEY-3126") - @GET - public String JERSEY_3126() { - return uriInfo == null ? "test failed" : "test ok"; - } - -} diff --git a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/aspect4j/NoComponentResource.java b/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/aspect4j/NoComponentResource.java deleted file mode 100644 index bb5bf8aee7..0000000000 --- a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/aspect4j/NoComponentResource.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.aspect4j; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; - -import org.glassfish.jersey.server.spring.TestComponent1; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Path("/") -public class NoComponentResource { - - @Autowired - private TestComponent1 testComponent1; - - @Path("test1") - @GET - public String test1() { - return testComponent1.result(); - } - -} diff --git a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/fieldinjection/SpringFieldInjectionTest.java b/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/fieldinjection/SpringFieldInjectionTest.java deleted file mode 100644 index 141d16e789..0000000000 --- a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/fieldinjection/SpringFieldInjectionTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.fieldinjection; - -import jakarta.ws.rs.core.Application; - -import org.glassfish.jersey.server.spring.SpringTestConfiguration; -import org.glassfish.jersey.test.JerseyTest; -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -import static org.junit.Assert.assertEquals; - -public class SpringFieldInjectionTest extends JerseyTest { - - @Override - protected Application configure() { - ApplicationContext context = new AnnotationConfigApplicationContext(SpringTestConfiguration.class); - return new SpringFieldInjectionJerseyTestConfig() - .property("contextConfig", context); - } - - @Test - public void testInjectionOfSingleBean() { - String result = target("test1").request().get(String.class); - assertEquals("test ok", result); - } - - @Test - public void testInjectionOfListOfBeans() { - String result = target("test2").request().get(String.class); - assertEquals("test ok", result); - } - - @Test - public void testInjectionOfSetOfBeans() { - String result = target("test3").request().get(String.class); - assertEquals("test ok", result); - } - - @Test - public void JERSEY_2643() { - String result = target("JERSEY-2643").request().get(String.class); - assertEquals("test ok", result); - } -} diff --git a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/fieldinjection/SpringFieldInjectionTestResource.java b/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/fieldinjection/SpringFieldInjectionTestResource.java deleted file mode 100644 index 941e311089..0000000000 --- a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/fieldinjection/SpringFieldInjectionTestResource.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.fieldinjection; - -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; - -import org.glassfish.jersey.server.spring.NoComponent; -import org.glassfish.jersey.server.spring.TestComponent1; -import org.glassfish.jersey.server.spring.TestComponent2; -import org.springframework.beans.factory.annotation.Autowired; - -@Path("/") -public class SpringFieldInjectionTestResource { - - @Autowired - private TestComponent1 testComponent1; - - @Autowired - private List testComponent2List; - - @Autowired - Set testComponent2Set; - - @Autowired(required = false) - private NoComponent noComponent; - - @Path("test1") - @GET - public String test1() { - return testComponent1.result(); - } - - @Path("test2") - @GET - public String test2() { - return (testComponent2List.size() == 2 && "test ok".equals(testComponent2List.get(0).result()) - && "test ok".equals(testComponent2List.get(1).result())) ? "test ok" : "test failed"; - } - - @Path("test3") - @GET - public String test3() { - Iterator iterator = testComponent2Set.iterator(); - return (testComponent2Set.size() == 2 && "test ok".equals(iterator.next().result()) - && "test ok".equals(iterator.next().result())) ? "test ok" : "test failed"; - } - - @Path("JERSEY-2643") - @GET - public String JERSEY_2643() { - return noComponent == null ? "test ok" : "test failed"; - } - -} diff --git a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/filter/Counter.java b/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/filter/Counter.java deleted file mode 100644 index 28de237b30..0000000000 --- a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/filter/Counter.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.filter; - -import org.springframework.stereotype.Component; - -@Component -public class Counter { - - private int count = 0; - - public void inc() { - count++; - } - - public int getCount() { - return count; - } - -} diff --git a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/methodinjection/SpringMethodInjectionJerseyTestConfig.java b/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/methodinjection/SpringMethodInjectionJerseyTestConfig.java deleted file mode 100644 index 5a9d3b75f7..0000000000 --- a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/methodinjection/SpringMethodInjectionJerseyTestConfig.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.methodinjection; - -import org.glassfish.jersey.server.spring.scope.RequestContextFilter; -import org.glassfish.jersey.server.ResourceConfig; - -public class SpringMethodInjectionJerseyTestConfig extends ResourceConfig { - public SpringMethodInjectionJerseyTestConfig() { - register(RequestContextFilter.class); - register(SpringMethodInjectionTestResource.class); - } -} diff --git a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/methodinjection/SpringMethodInjectionTest.java b/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/methodinjection/SpringMethodInjectionTest.java deleted file mode 100644 index 3f66478a95..0000000000 --- a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/methodinjection/SpringMethodInjectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.methodinjection; - -import static org.junit.Assert.assertEquals; - -import org.glassfish.jersey.test.JerseyTest; -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.glassfish.jersey.server.spring.SpringTestConfiguration; - -import jakarta.ws.rs.core.Application; - -public class SpringMethodInjectionTest extends JerseyTest { - - @Override - protected Application configure() { - ApplicationContext context = new AnnotationConfigApplicationContext(SpringTestConfiguration.class); - return new SpringMethodInjectionJerseyTestConfig() - .property("contextConfig", context); - } - - @Test - public void testInjectionOfSingleBean() { - String result = target("test1").request().get(String.class); - assertEquals("test ok", result); - } - - @Test - public void testInjectionOfListOfBeans() { - String result = target("test2").request().get(String.class); - assertEquals("test ok", result); - } - - @Test - public void testInjectionOfSetOfBeans() { - String result = target("test3").request().get(String.class); - assertEquals("test ok", result); - } -} diff --git a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/methodinjection/SpringMethodInjectionTestResource.java b/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/methodinjection/SpringMethodInjectionTestResource.java deleted file mode 100644 index 8a16bbef63..0000000000 --- a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/methodinjection/SpringMethodInjectionTestResource.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.methodinjection; - -import org.glassfish.jersey.server.spring.NoComponent; -import org.glassfish.jersey.server.spring.TestComponent1; -import org.springframework.beans.factory.annotation.Autowired; - -import java.util.List; -import java.util.Set; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; - -@Path("/") -public class SpringMethodInjectionTestResource { - - private TestComponent1 testComponent1; - private List testComponent2List; - private Set testComponent2Set; - private NoComponent noComponent; - - @Autowired - public void setTestComponent1(TestComponent1 testComponent1) { - this.testComponent1 = testComponent1; - } - - @Autowired - public void setTestComponent2List(List testComponent2List) { - this.testComponent2List = testComponent2List; - } - - @Autowired - public void setTestComponent2Set(Set testComponent2Set) { - this.testComponent2Set = testComponent2Set; - } - - @Autowired(required = false) - public void setNoComponent(NoComponent noComponent) { - this.noComponent = noComponent; - } - - @Path("test1") - @GET - public String test1() { - return testComponent1.result(); - } - - @Path("test2") - @GET - public String test2() { - return (testComponent2List.size() == 2 && "test ok".equals(testComponent2List.get(0).result()) - && "test ok".equals(testComponent2List.get(1).result())) ? "test ok" : "test failed"; - } - - @Path("test3") - @GET - public String test3() { - java.util.Iterator iterator = testComponent2Set.iterator(); - return (testComponent2Set.size() == 2 && "test ok".equals(iterator.next().result()) - && "test ok".equals(iterator.next().result())) ? "test ok" : "test failed"; - } - - @Path("JERSEY-2643") - @GET - public String JERSEY_2643() { - return noComponent == null ? "test ok" : "test failed"; - } - -} diff --git a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/parameterinjection/SpringParameterInjectionTestResource.java b/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/parameterinjection/SpringParameterInjectionTestResource.java deleted file mode 100644 index b7c56c964b..0000000000 --- a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/parameterinjection/SpringParameterInjectionTestResource.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.parameterinjection; - -import org.glassfish.jersey.server.spring.TestComponent1; -import org.glassfish.jersey.server.spring.TestComponent2; -import org.springframework.beans.factory.annotation.Autowired; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -@Path("/") -public class SpringParameterInjectionTestResource { - - private final TestComponent1 testComponent1; - private final List testComponent2List; - private final Set testComponent2Set; - - @Autowired - public SpringParameterInjectionTestResource(final TestComponent1 testComponent1, - final List testComponent2List, - final Set testComponent2Set) { - this.testComponent1 = testComponent1; - this.testComponent2List = testComponent2List; - this.testComponent2Set = testComponent2Set; - } - - @Path("test1") - @GET - public String test1() { - return testComponent1.result(); - } - - @Path("test2") - @GET - public String test2() { - return (testComponent2List.size() == 2 && "test ok".equals(testComponent2List.get(0).result()) - && "test ok".equals(testComponent2List.get(1).result())) ? "test ok" : "test failed"; - } - - @Path("test3") - @GET - public String test3() { - Iterator iterator = testComponent2Set.iterator(); - return (testComponent2Set.size() == 2 && "test ok".equals(iterator.next().result()) - && "test ok".equals(iterator.next().result())) ? "test ok" : "test failed"; - } -} diff --git a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/profiles/DefaultTestService.java b/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/profiles/DefaultTestService.java deleted file mode 100644 index 040d05309a..0000000000 --- a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/profiles/DefaultTestService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.profiles; - -import org.springframework.stereotype.Component; - -@Component -public class DefaultTestService implements TestService { - - @Override - public String test() { - return "default"; - } -} diff --git a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/profiles/DevTestService.java b/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/profiles/DevTestService.java deleted file mode 100644 index dc3c99543e..0000000000 --- a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/profiles/DevTestService.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2014, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.profiles; - -import org.springframework.context.annotation.Primary; -import org.springframework.context.annotation.Profile; -import org.springframework.stereotype.Component; - -@Component -@Primary -@Profile("dev") -public class DevTestService implements TestService { - - @Override - public String test() { - return "dev"; - } -} diff --git a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/profiles/SpringDefaultProfileResourceTest.java b/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/profiles/SpringDefaultProfileResourceTest.java deleted file mode 100644 index 3b1f6a8b69..0000000000 --- a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/profiles/SpringDefaultProfileResourceTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.profiles; - -import jakarta.ws.rs.core.Application; - -import org.glassfish.jersey.logging.LoggingFeature; -import org.glassfish.jersey.server.ResourceConfig; -import org.glassfish.jersey.server.spring.scope.RequestContextFilter; -import org.glassfish.jersey.test.JerseyTest; - -import org.junit.Assert; -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -public class SpringDefaultProfileResourceTest extends JerseyTest { - - @Override - protected Application configure() { - System.setProperty("spring.profiles.active", ""); - ApplicationContext context = new AnnotationConfigApplicationContext("org.glassfish.jersey.server.spring.profiles"); - return new ResourceConfig() - .register(RequestContextFilter.class) - .register(LoggingFeature.class) - .packages("org.glassfish.jersey.server.spring.profiles") - .property("contextConfig", context); - } - - @Test - public void shouldUseDefaultComponent() { - final String result = target("spring-resource").request().get(String.class); - Assert.assertEquals("default", result); - } -} diff --git a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/profiles/SpringDevProfileResourceTest.java b/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/profiles/SpringDevProfileResourceTest.java deleted file mode 100644 index 2d7c5a184e..0000000000 --- a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/profiles/SpringDevProfileResourceTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.profiles; - -import jakarta.ws.rs.core.Application; - -import org.glassfish.jersey.logging.LoggingFeature; -import org.glassfish.jersey.server.ResourceConfig; -import org.glassfish.jersey.server.spring.scope.RequestContextFilter; -import org.glassfish.jersey.test.JerseyTest; - -import org.junit.Assert; -import org.junit.Test; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -public class SpringDevProfileResourceTest extends JerseyTest { - - @Override - protected Application configure() { - System.setProperty("spring.profiles.active", "dev"); - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( - "org.glassfish.jersey.server.spring.profiles"); - return new ResourceConfig() - .register(RequestContextFilter.class) - .register(LoggingFeature.class) - .packages("org.glassfish.jersey.server.spring.profiles") - .property("contextConfig", context); - } - - @Test - public void shouldUseDevProfileBean() { - final String result = target("spring-resource").request().get(String.class); - Assert.assertEquals("dev", result); - } -} diff --git a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/profiles/SpringRequestResource.java b/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/profiles/SpringRequestResource.java deleted file mode 100644 index e05de3da6c..0000000000 --- a/ext/spring4/src/test/java/org/glassfish/jersey/server/spring/profiles/SpringRequestResource.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.profiles; - -import jakarta.inject.Singleton; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - - -@Singleton -@Path("spring-resource") -@Service -public class SpringRequestResource { - - @Autowired - private TestService testService; - - @GET - @Produces(MediaType.TEXT_PLAIN) - public String getGoodbye() { - return testService.test(); - } - -} diff --git a/ext/spring5/pom.xml b/ext/spring5/pom.xml deleted file mode 100644 index 4647434fdd..0000000000 --- a/ext/spring5/pom.xml +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - 4.0.0 - - - org.glassfish.jersey.ext - project - 3.0.0-SNAPSHOT - - - jersey-spring5 - jersey-spring5 - - jar - - - Jersey extension module providing support for Spring 5 integration. - - - - - org.glassfish.jersey.core - jersey-server - ${project.version} - - - - org.glassfish.jersey.inject - jersey-hk2 - ${project.version} - - - - org.glassfish.jersey.containers - jersey-container-servlet-core - ${project.version} - - - - org.glassfish.jersey.test-framework.providers - jersey-test-framework-provider-grizzly2 - ${project.version} - test - - - - commons-logging - commons-logging - 1.2 - test - - - - org.glassfish.hk2 - hk2 - ${hk2.version} - - - - org.glassfish.hk2 - spring-bridge - ${hk2.version} - - - jakarta.inject - jakarta.inject - - - org.glassfish.hk2 - hk2-api - - - org.springframework - spring-context - - - - - - org.springframework - spring-beans - ${spring5.version} - - - - org.springframework - spring-core - ${spring5.version} - - - commons-logging - commons-logging - - - - - - org.springframework - spring-context - ${spring5.version} - - - commons-logging - commons-logging - - - - - - org.springframework - spring-web - ${spring5.version} - - - - org.springframework - spring-aop - ${spring5.version} - - - - jakarta.servlet - jakarta.servlet-api - ${servlet4.version} - provided - - - - org.glassfish.jersey.test-framework - jersey-test-framework-core - ${project.version} - test - - - - org.aspectj - aspectjrt - 1.6.11 - test - - - org.aspectj - aspectjweaver - 1.6.11 - test - - - - - - - - com.sun.istack - istack-commons-maven-plugin - true - - - org.codehaus.mojo - build-helper-maven-plugin - true - - - - - - - delayed-strategy-skip-test - - - org.glassfish.jersey.injection.manager.strategy - delayed - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - true - - - - - - - diff --git a/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/SpringComponentProvider.java b/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/SpringComponentProvider.java deleted file mode 100644 index e8df9402ad..0000000000 --- a/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/SpringComponentProvider.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring; - -import java.util.Set; -import java.util.function.Supplier; -import java.util.logging.Level; -import java.util.logging.Logger; - -import jakarta.servlet.ServletContext; - -import org.glassfish.jersey.inject.hk2.ImmediateHk2InjectionManager; -import org.glassfish.jersey.internal.inject.Binding; -import org.glassfish.jersey.internal.inject.Bindings; -import org.glassfish.jersey.internal.inject.InjectionManager; -import org.glassfish.jersey.server.ApplicationHandler; -import org.glassfish.jersey.server.spi.ComponentProvider; - -import org.jvnet.hk2.spring.bridge.api.SpringBridge; -import org.jvnet.hk2.spring.bridge.api.SpringIntoHK2Bridge; - -import org.springframework.aop.framework.Advised; -import org.springframework.beans.factory.BeanFactoryUtils; -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; -import org.springframework.core.annotation.AnnotationUtils; -import org.springframework.stereotype.Component; -import org.springframework.web.context.support.WebApplicationContextUtils; - -/** - * Custom ComponentProvider class. - * Responsible for 1) bootstrapping Jersey 2 Spring integration and - * 2) making Jersey skip JAX-RS Spring component life-cycle management and leave it to us. - * - * @author Marko Asplund (marko.asplund at yahoo.com) - */ -public class SpringComponentProvider implements ComponentProvider { - - private static final Logger LOGGER = Logger.getLogger(SpringComponentProvider.class.getName()); - private static final String DEFAULT_CONTEXT_CONFIG_LOCATION = "applicationContext.xml"; - private static final String PARAM_CONTEXT_CONFIG_LOCATION = "contextConfigLocation"; - private static final String PARAM_SPRING_CONTEXT = "contextConfig"; - - private volatile InjectionManager injectionManager; - private volatile ApplicationContext ctx; - - @Override - public void initialize(InjectionManager injectionManager) { - this.injectionManager = injectionManager; - - if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.fine(LocalizationMessages.CTX_LOOKUP_STARTED()); - } - - ServletContext sc = injectionManager.getInstance(ServletContext.class); - - if (sc != null) { - // servlet container - ctx = WebApplicationContextUtils.getWebApplicationContext(sc); - } else { - // non-servlet container - ctx = createSpringContext(); - } - if (ctx == null) { - LOGGER.severe(LocalizationMessages.CTX_LOOKUP_FAILED()); - return; - } - LOGGER.config(LocalizationMessages.CTX_LOOKUP_SUCESSFUL()); - - // initialize HK2 spring-bridge - - ImmediateHk2InjectionManager hk2InjectionManager = (ImmediateHk2InjectionManager) injectionManager; - SpringBridge.getSpringBridge().initializeSpringBridge(hk2InjectionManager.getServiceLocator()); - SpringIntoHK2Bridge springBridge = injectionManager.getInstance(SpringIntoHK2Bridge.class); - springBridge.bridgeSpringBeanFactory(ctx); - - injectionManager.register(Bindings.injectionResolver(new AutowiredInjectResolver(ctx))); - injectionManager.register(Bindings.service(ctx).to(ApplicationContext.class).named("SpringContext")); - LOGGER.config(LocalizationMessages.SPRING_COMPONENT_PROVIDER_INITIALIZED()); - } - - // detect JAX-RS classes that are also Spring @Components. - // register these with HK2 ServiceLocator to manage their lifecycle using Spring. - @Override - public boolean bind(Class component, Set> providerContracts) { - - if (ctx == null) { - return false; - } - - if (AnnotationUtils.findAnnotation(component, Component.class) != null) { - String[] beanNames = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(ctx, component); - if (beanNames == null || beanNames.length != 1) { - LOGGER.severe(LocalizationMessages.NONE_OR_MULTIPLE_BEANS_AVAILABLE(component)); - return false; - } - String beanName = beanNames[0]; - - Binding binding = Bindings.supplier(new SpringManagedBeanFactory(ctx, injectionManager, beanName)) - .to(component) - .to(providerContracts); - injectionManager.register(binding); - - LOGGER.config(LocalizationMessages.BEAN_REGISTERED(beanNames[0])); - return true; - } - return false; - } - - @Override - public void done() { - } - - private ApplicationContext createSpringContext() { - ApplicationHandler applicationHandler = injectionManager.getInstance(ApplicationHandler.class); - ApplicationContext springContext = (ApplicationContext) applicationHandler.getConfiguration() - .getProperty(PARAM_SPRING_CONTEXT); - if (springContext == null) { - String contextConfigLocation = (String) applicationHandler.getConfiguration() - .getProperty(PARAM_CONTEXT_CONFIG_LOCATION); - springContext = createXmlSpringConfiguration(contextConfigLocation); - } - return springContext; - } - - private ApplicationContext createXmlSpringConfiguration(String contextConfigLocation) { - if (contextConfigLocation == null) { - contextConfigLocation = DEFAULT_CONTEXT_CONFIG_LOCATION; - } - return ctx = new ClassPathXmlApplicationContext(contextConfigLocation, "jersey-spring-applicationContext.xml"); - } - - private static class SpringManagedBeanFactory implements Supplier { - - private final ApplicationContext ctx; - private final InjectionManager injectionManager; - private final String beanName; - - private SpringManagedBeanFactory(ApplicationContext ctx, InjectionManager injectionManager, String beanName) { - this.ctx = ctx; - this.injectionManager = injectionManager; - this.beanName = beanName; - } - - @Override - public Object get() { - Object bean = ctx.getBean(beanName); - if (bean instanceof Advised) { - try { - // Unwrap the bean and inject the values inside of it - Object localBean = ((Advised) bean).getTargetSource().getTarget(); - injectionManager.inject(localBean); - } catch (Exception e) { - // Ignore and let the injection happen as it normally would. - injectionManager.inject(bean); - } - } else { - injectionManager.inject(bean); - } - return bean; - } - } -} diff --git a/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/SpringWebApplicationInitializer.java b/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/SpringWebApplicationInitializer.java deleted file mode 100644 index c3bac70aef..0000000000 --- a/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/SpringWebApplicationInitializer.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring; - -import java.util.logging.Logger; - -import jakarta.servlet.ServletContext; -import jakarta.servlet.ServletException; - -import org.springframework.web.WebApplicationInitializer; - -/** - * Spring WebApplicationInitializer implementation initializes Spring context by - * adding a Spring ContextLoaderListener to the ServletContext. - * - * @author Marko Asplund (marko.asplund at yahoo.com) - */ -public class SpringWebApplicationInitializer implements WebApplicationInitializer { - - private static final Logger LOGGER = Logger.getLogger(SpringWebApplicationInitializer.class.getName()); - - private static final String PAR_NAME_CTX_CONFIG_LOCATION = "contextConfigLocation"; - - @Override - public void onStartup(ServletContext sc) throws ServletException { - if (sc.getInitParameter(PAR_NAME_CTX_CONFIG_LOCATION) == null) { - LOGGER.config(LocalizationMessages.REGISTERING_CTX_LOADER_LISTENER()); - sc.setInitParameter(PAR_NAME_CTX_CONFIG_LOCATION, "classpath:applicationContext.xml"); - sc.addListener("org.springframework.web.context.ContextLoaderListener"); - sc.addListener("org.springframework.web.context.request.RequestContextListener"); - } else { - LOGGER.config(LocalizationMessages.SKIPPING_CTX_LODAER_LISTENER_REGISTRATION()); - } - } -} diff --git a/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/package-info.java b/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/package-info.java deleted file mode 100644 index 6e7b71a767..0000000000 --- a/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -/** - * Jersey server-side Spring 5 integration classes. - * @since 2.29 - */ -package org.glassfish.jersey.server.spring; diff --git a/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/scope/RequestContextFilter.java b/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/scope/RequestContextFilter.java deleted file mode 100644 index de87d7e91d..0000000000 --- a/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/scope/RequestContextFilter.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.scope; - -import java.io.IOException; - -import jakarta.ws.rs.container.ContainerRequestContext; -import jakarta.ws.rs.container.ContainerRequestFilter; -import jakarta.ws.rs.container.ContainerResponseContext; -import jakarta.ws.rs.container.ContainerResponseFilter; -import jakarta.ws.rs.container.PreMatching; -import jakarta.ws.rs.ext.Provider; - -import jakarta.inject.Inject; -import jakarta.servlet.http.HttpServletRequest; - -import org.glassfish.jersey.internal.inject.InjectionManager; - -import org.springframework.context.ApplicationContext; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.request.AbstractRequestAttributes; -import org.springframework.web.context.request.RequestAttributes; -import org.springframework.web.context.request.RequestContextHolder; - -/** - * Spring filter to provide a bridge between JAX-RS and Spring request attributes. - * - * @author Marko Asplund (marko.asplund at yahoo.com) - * @author Jakub Podlesak - * @author Marek Potociar - */ -@Provider -@PreMatching -public final class RequestContextFilter implements ContainerRequestFilter, ContainerResponseFilter { - - private static final String REQUEST_ATTRIBUTES_PROPERTY = RequestContextFilter.class.getName() + ".REQUEST_ATTRIBUTES"; - - private final SpringAttributeController attributeController; - - private static final SpringAttributeController EMPTY_ATTRIBUTE_CONTROLLER = new SpringAttributeController() { - @Override - public void setAttributes(final ContainerRequestContext requestContext) { - } - - @Override - public void resetAttributes(final ContainerRequestContext requestContext) { - } - }; - - private interface SpringAttributeController { - - void setAttributes(final ContainerRequestContext requestContext); - - void resetAttributes(final ContainerRequestContext requestContext); - } - - /** - * Create a new request context filter instance. - * - * @param injectionManager injection manager. - */ - @Inject - public RequestContextFilter(final InjectionManager injectionManager) { - final ApplicationContext appCtx = injectionManager.getInstance(ApplicationContext.class); - final boolean isWebApp = appCtx instanceof WebApplicationContext; - - attributeController = appCtx != null ? new SpringAttributeController() { - - @Override - public void setAttributes(final ContainerRequestContext requestContext) { - final RequestAttributes attributes; - if (isWebApp) { - final HttpServletRequest httpRequest = injectionManager.getInstance(HttpServletRequest.class); - attributes = new JaxrsServletRequestAttributes(httpRequest, requestContext); - } else { - attributes = new JaxrsRequestAttributes(requestContext); - } - requestContext.setProperty(REQUEST_ATTRIBUTES_PROPERTY, attributes); - RequestContextHolder.setRequestAttributes(attributes); - } - - @Override - public void resetAttributes(final ContainerRequestContext requestContext) { - final AbstractRequestAttributes attributes = - (AbstractRequestAttributes) requestContext.getProperty(REQUEST_ATTRIBUTES_PROPERTY); - RequestContextHolder.resetRequestAttributes(); - attributes.requestCompleted(); - } - } : EMPTY_ATTRIBUTE_CONTROLLER; - } - - @Override - public void filter(final ContainerRequestContext requestContext) throws IOException { - attributeController.setAttributes(requestContext); - } - - @Override - public void filter(final ContainerRequestContext requestContext, final ContainerResponseContext responseContext) - throws IOException { - attributeController.resetAttributes(requestContext); - } -} diff --git a/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/scope/package-info.java b/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/scope/package-info.java deleted file mode 100644 index 49985aab7d..0000000000 --- a/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/scope/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -/** - * Jersey server-side Spring 5 integration injection scopes related classes. - * @since 2.29 - */ -package org.glassfish.jersey.server.spring.scope; diff --git a/ext/spring5/src/main/resources/META-INF/services/org.glassfish.jersey.server.spi.ComponentProvider b/ext/spring5/src/main/resources/META-INF/services/org.glassfish.jersey.server.spi.ComponentProvider deleted file mode 100644 index 5aec207d97..0000000000 --- a/ext/spring5/src/main/resources/META-INF/services/org.glassfish.jersey.server.spi.ComponentProvider +++ /dev/null @@ -1 +0,0 @@ -org.glassfish.jersey.server.spring.SpringComponentProvider diff --git a/ext/spring5/src/main/resources/jersey-spring-applicationContext.xml b/ext/spring5/src/main/resources/jersey-spring-applicationContext.xml deleted file mode 100644 index fd6f52829a..0000000000 --- a/ext/spring5/src/main/resources/jersey-spring-applicationContext.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/TestComponent1.java b/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/TestComponent1.java deleted file mode 100644 index d8d29a3c0b..0000000000 --- a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/TestComponent1.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2014, 2019 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring; - -import org.springframework.stereotype.Component; - -@Component -public class TestComponent1 { - - public String result() { - return "test ok"; - } -} diff --git a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/TestComponent2Impl1.java b/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/TestComponent2Impl1.java deleted file mode 100644 index 25078b67e0..0000000000 --- a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/TestComponent2Impl1.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2014, 2019 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring; - -import org.springframework.stereotype.Component; - -@Component -public class TestComponent2Impl1 implements TestComponent2 { - @Override - public String result() { - return "test ok"; - } -} diff --git a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/aspect4j/Aspect4JTest.java b/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/aspect4j/Aspect4JTest.java deleted file mode 100644 index 52fd0e3e11..0000000000 --- a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/aspect4j/Aspect4JTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.aspect4j; - -import jakarta.ws.rs.core.Application; - -import org.glassfish.jersey.test.JerseyTest; -import org.junit.Before; -import org.junit.Test; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -import static org.junit.Assert.assertEquals; - -public class Aspect4JTest extends JerseyTest { - - private ClassPathXmlApplicationContext applicationContext; - - private TestAspect testAspect; - - @Before - public void before() { - testAspect.reset(); - } - - @Override - protected Application configure() { - applicationContext = new ClassPathXmlApplicationContext("jersey-spring-aspect4j-applicationContext.xml"); - testAspect = applicationContext.getBean(TestAspect.class); - return new Aspect4jJerseyConfig() - .property("contextConfig", applicationContext); - } - - @Test - public void methodCallShouldNotBeIntercepted() { - target("test1").request().get(String.class); - assertEquals(0, testAspect.getInterceptions()); - } - - @Test - public void methodCallShouldBeIntercepted() { - target("test2").request().get(String.class); - assertEquals(1, applicationContext.getBean(TestAspect.class).getInterceptions()); - } - - @Test - public void JERSEY_3126() { - final String result = target("JERSEY-3126").request().get(String.class); - assertEquals("test ok", result); - } -} diff --git a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/aspect4j/TestAspect.java b/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/aspect4j/TestAspect.java deleted file mode 100644 index 458019992e..0000000000 --- a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/aspect4j/TestAspect.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.aspect4j; - -import jakarta.inject.Singleton; - -import org.aspectj.lang.JoinPoint; -import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Before; - -@Aspect -@Singleton -public class TestAspect { - - private int interceptions = 0; - - @Before("execution(* org.glassfish.jersey.server.spring.aspect4j.*.*())") - public void intercept(JoinPoint joinPoint) { - interceptions++; - } - - public int getInterceptions() { - return interceptions; - } - - public void reset() { - interceptions = 0; - } -} diff --git a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/fieldinjection/SpringFieldInjectionJerseyTestConfig.java b/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/fieldinjection/SpringFieldInjectionJerseyTestConfig.java deleted file mode 100644 index 0eb367b5c3..0000000000 --- a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/fieldinjection/SpringFieldInjectionJerseyTestConfig.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2014, 2019 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.fieldinjection; - -import org.glassfish.jersey.server.ResourceConfig; -import org.glassfish.jersey.server.spring.scope.RequestContextFilter; - -public class SpringFieldInjectionJerseyTestConfig extends ResourceConfig { - public SpringFieldInjectionJerseyTestConfig() { - register(RequestContextFilter.class); - register(SpringFieldInjectionTestResource.class); - } -} diff --git a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/filter/FilterTest.java b/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/filter/FilterTest.java deleted file mode 100644 index 3c33392daa..0000000000 --- a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/filter/FilterTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.filter; - -import jakarta.ws.rs.core.Application; - -import org.glassfish.jersey.server.spring.SpringTestConfiguration; -import org.glassfish.jersey.test.JerseyTest; -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -import static org.junit.Assert.assertEquals; - -public class FilterTest extends JerseyTest { - - private ApplicationContext context; - - @Override - protected Application configure() { - context = new AnnotationConfigApplicationContext(SpringTestConfiguration.class); - return new JerseyTestConfig() - .property("contextConfig", context); - } - - @Test - public void testInjectionOfSingleBean() { - target("test1").request().get(String.class); - assertEquals(1, context.getBean(Counter.class).getCount()); - } - -} diff --git a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/filter/JerseyTestConfig.java b/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/filter/JerseyTestConfig.java deleted file mode 100644 index c8df018a81..0000000000 --- a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/filter/JerseyTestConfig.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.filter; - -import org.glassfish.jersey.server.ResourceConfig; -import org.glassfish.jersey.server.spring.scope.RequestContextFilter; - -public class JerseyTestConfig extends ResourceConfig { - - public JerseyTestConfig() { - register(RequestContextFilter.class); - register(TestResource.class); - register(TestFilter.class); - } -} diff --git a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/filter/TestResource.java b/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/filter/TestResource.java deleted file mode 100644 index 7e624ef398..0000000000 --- a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/filter/TestResource.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.filter; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; - -@Path("/") -public class TestResource { - - @Path("test1") - @GET - public String test1() { - return "Hello, Test!"; - } -} diff --git a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/parameterinjection/SpringParameterInjectionJerseyTestConfig.java b/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/parameterinjection/SpringParameterInjectionJerseyTestConfig.java deleted file mode 100644 index 598618f6f9..0000000000 --- a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/parameterinjection/SpringParameterInjectionJerseyTestConfig.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2014, 2019 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.parameterinjection; - -import org.glassfish.jersey.server.ResourceConfig; -import org.glassfish.jersey.server.spring.scope.RequestContextFilter; - -public class SpringParameterInjectionJerseyTestConfig extends ResourceConfig { - public SpringParameterInjectionJerseyTestConfig() { - register(RequestContextFilter.class); - register(SpringParameterInjectionTestResource.class); - } -} diff --git a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/parameterinjection/SpringParameterInjectionTest.java b/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/parameterinjection/SpringParameterInjectionTest.java deleted file mode 100644 index e6b720e470..0000000000 --- a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/parameterinjection/SpringParameterInjectionTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.parameterinjection; - -import org.glassfish.jersey.server.spring.SpringTestConfiguration; -import org.glassfish.jersey.server.spring.fieldinjection.SpringFieldInjectionJerseyTestConfig; -import org.glassfish.jersey.test.JerseyTest; -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; - -import jakarta.ws.rs.core.Application; - -import static org.junit.Assert.assertEquals; - -public class SpringParameterInjectionTest extends JerseyTest { - @Override - protected Application configure() { - ApplicationContext context = new AnnotationConfigApplicationContext(SpringTestConfiguration.class); - return new SpringParameterInjectionJerseyTestConfig() - .property("contextConfig", context); - } - - @Test - public void testInjectionOfSingleBean() { - String result = target("test1").request().get(String.class); - assertEquals("test ok", result); - } - - @Test - public void testInjectionOfListOfBeans() { - String result = target("test2").request().get(String.class); - assertEquals("test ok", result); - } - - @Test - public void testInjectionOfSetOfBeans() { - String result = target("test3").request().get(String.class); - assertEquals("test ok", result); - } -} diff --git a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/profiles/SpringProfilesTest.java b/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/profiles/SpringProfilesTest.java deleted file mode 100644 index be0ac479ae..0000000000 --- a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/profiles/SpringProfilesTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2014, 2019 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.profiles; - -import org.junit.Test; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import static org.junit.Assert.assertEquals; - -public class SpringProfilesTest { - - @Test - public void shouldGetDefaultBean() { - System.setProperty("spring.profiles.active", ""); - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( - "org.glassfish.jersey.server.spring.profiles"); - assertEquals("default", context.getBean(TestService.class).test()); - } - - @Test - public void shouldGetDevProfileBean() { - System.setProperty("spring.profiles.active", "dev"); - AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext( - "org.glassfish.jersey.server.spring.profiles"); - assertEquals("dev", context.getBean(TestService.class).test()); - } -} diff --git a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/profiles/TestService.java b/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/profiles/TestService.java deleted file mode 100644 index d5635b52d4..0000000000 --- a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/profiles/TestService.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (c) 2014, 2019 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.profiles; - -public interface TestService { - - String test(); -} diff --git a/ext/spring5/src/test/resources/jersey-spring-aspect4j-applicationContext.xml b/ext/spring5/src/test/resources/jersey-spring-aspect4j-applicationContext.xml deleted file mode 100644 index 7abafe382c..0000000000 --- a/ext/spring5/src/test/resources/jersey-spring-aspect4j-applicationContext.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - diff --git a/ext/spring6/pom.xml b/ext/spring6/pom.xml new file mode 100644 index 0000000000..c7817c6b71 --- /dev/null +++ b/ext/spring6/pom.xml @@ -0,0 +1,361 @@ + + + + + + 4.0.0 + + + org.glassfish.jersey.ext + project + 3.1.0-SNAPSHOT + + + jersey-spring6 + jersey-spring6 + + jar + + + Jersey extension module providing support for Spring 6 integration. + + + + UTF-8 + ${project.basedir}/target + ${project.basedir}/src/main/javaPre17 + ${project.basedir}/target17 + ${project.basedir}/src/main/java17 + + + + + Spring Repository + spring-repository + https://repo.spring.io/milestone + + + + + + org.glassfish.jersey.core + jersey-server + ${project.version} + + + + org.glassfish.jersey.inject + jersey-hk2 + ${project.version} + + + + org.glassfish.jersey.containers + jersey-container-servlet-core + ${project.version} + + + + org.glassfish.jersey.test-framework.providers + jersey-test-framework-provider-grizzly2 + ${project.version} + test + + + + commons-logging + commons-logging + 1.2 + test + + + + org.glassfish.hk2 + hk2 + ${hk2.version} + + + + org.glassfish.hk2 + spring-bridge + ${hk2.version} + + + jakarta.inject + jakarta.inject + + + org.glassfish.hk2 + hk2-api + + + org.springframework + spring-context + + + + + + org.springframework + spring-beans + ${spring6.version} + provided + + + + org.springframework + spring-core + ${spring6.version} + + + commons-logging + commons-logging + + + provided + + + + org.springframework + spring-context + ${spring6.version} + + + commons-logging + commons-logging + + + provided + + + + org.springframework + spring-web + ${spring6.version} + provided + + + + org.springframework + spring-aop + ${spring6.version} + provided + + + + jakarta.servlet + jakarta.servlet-api + ${servlet5.version} + provided + + + + org.glassfish.jersey.test-framework + jersey-test-framework-core + ${project.version} + test + + + + org.aspectj + aspectjrt + 1.6.11 + test + + + org.aspectj + aspectjweaver + 1.6.11 + test + + + + + + + + com.sun.istack + istack-commons-maven-plugin + true + + + org.codehaus.mojo + build-helper-maven-plugin + true + + + + + + + SpringExclude + + [1.8,17) + + + ${java.build.outputDirectory} + + + org.codehaus.mojo + build-helper-maven-plugin + + + generate-sources + + add-source + + + + ${javaPre17.sourceDirectory} + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + org/glassfish/jersey/server/spring/**/*.java + + + + + + + + SpringInclude + + [17,) + + + ${java17.build.outputDirectory} + + + org.codehaus.mojo + build-helper-maven-plugin + + + generate-sources + + add-source + + + + ${java17.sourceDirectory} + + + + + + + + + + copyJDK17FilesToMultiReleaseJar + + + + target17/classes/org/glassfish/jersey/server/spring/SpringWebApplicationInitializer.class + + [1.8,17) + + + + + org.apache.felix + maven-bundle-plugin + true + true + + + true + + + + + org.apache.maven.plugins + maven-resources-plugin + true + + + copy-jdk17-classes + prepare-package + + copy-resources + + + ${java.build.outputDirectory}/classes/META-INF/versions/17 + + + ${java17.build.outputDirectory}/classes + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + + + copy-jdk17-sources + package + + + + sources-jar: ${sources-jar} + + + + + + + run + + + + + + + + + delayed-strategy-skip-test + + + org.glassfish.jersey.injection.manager.strategy + delayed + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + + + diff --git a/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/package-info.java b/ext/spring6/src/main/java/org/glassfish/jersey/server/spring/package-info.java similarity index 84% rename from ext/spring4/src/main/java/org/glassfish/jersey/server/spring/package-info.java rename to ext/spring6/src/main/java/org/glassfish/jersey/server/spring/package-info.java index 0176470fce..229c054ed1 100644 --- a/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/package-info.java +++ b/ext/spring6/src/main/java/org/glassfish/jersey/server/spring/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -15,7 +15,7 @@ */ /** - * Jersey server-side Spring 4 integration classes. - * + * Jersey server-side Spring 6 integration classes. + * @since 3.0.5 */ package org.glassfish.jersey.server.spring; diff --git a/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/scope/package-info.java b/ext/spring6/src/main/java/org/glassfish/jersey/server/spring/scope/package-info.java similarity index 83% rename from ext/spring4/src/main/java/org/glassfish/jersey/server/spring/scope/package-info.java rename to ext/spring6/src/main/java/org/glassfish/jersey/server/spring/scope/package-info.java index e15b2c5022..d4e3c8e864 100644 --- a/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/scope/package-info.java +++ b/ext/spring6/src/main/java/org/glassfish/jersey/server/spring/scope/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -15,7 +15,7 @@ */ /** - * Jersey server-side Spring 4 integration injection scopes related classes. - * + * Jersey server-side Spring 6 integration injection scopes related classes. + * @since 3.0.5 */ package org.glassfish.jersey.server.spring.scope; diff --git a/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/AutowiredInjectResolver.java b/ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/AutowiredInjectResolver.java similarity index 98% rename from ext/spring5/src/main/java/org/glassfish/jersey/server/spring/AutowiredInjectResolver.java rename to ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/AutowiredInjectResolver.java index 61fc9b17a0..aca66c9652 100644 --- a/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/AutowiredInjectResolver.java +++ b/ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/AutowiredInjectResolver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/SpringComponentProvider.java b/ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/SpringComponentProvider.java similarity index 98% rename from ext/spring4/src/main/java/org/glassfish/jersey/server/spring/SpringComponentProvider.java rename to ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/SpringComponentProvider.java index 07208f5dc7..358f488577 100644 --- a/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/SpringComponentProvider.java +++ b/ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/SpringComponentProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -43,7 +43,7 @@ /** * Custom ComponentProvider class. - * Responsible for 1) bootstrapping Jersey 2 Spring integration and + * Responsible for 1) bootstrapping Jersey 3 Spring integration and * 2) making Jersey skip JAX-RS Spring component life-cycle management and leave it to us. * * @author Marko Asplund (marko.asplund at yahoo.com) diff --git a/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/SpringLifecycleListener.java b/ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/SpringLifecycleListener.java similarity index 93% rename from ext/spring5/src/main/java/org/glassfish/jersey/server/spring/SpringLifecycleListener.java rename to ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/SpringLifecycleListener.java index 5a06926b94..b47ba09836 100644 --- a/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/SpringLifecycleListener.java +++ b/ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/SpringLifecycleListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -27,7 +27,7 @@ import org.springframework.context.ConfigurableApplicationContext; /** - * JAX-RS Provider class for processing Jersey 2 Spring integration container life-cycle events. + * JAX-RS Provider class for processing Jersey 3 Spring integration container life-cycle events. * * @author Marko Asplund (marko.asplund at yahoo.com) */ diff --git a/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/SpringWebApplicationInitializer.java b/ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/SpringWebApplicationInitializer.java similarity index 96% rename from ext/spring4/src/main/java/org/glassfish/jersey/server/spring/SpringWebApplicationInitializer.java rename to ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/SpringWebApplicationInitializer.java index b33a69d9a2..8e21bdade2 100644 --- a/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/SpringWebApplicationInitializer.java +++ b/ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/SpringWebApplicationInitializer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/scope/JaxrsRequestAttributes.java b/ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/scope/JaxrsRequestAttributes.java similarity index 97% rename from ext/spring5/src/main/java/org/glassfish/jersey/server/spring/scope/JaxrsRequestAttributes.java rename to ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/scope/JaxrsRequestAttributes.java index ec22efaeb6..35a9e261a1 100644 --- a/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/scope/JaxrsRequestAttributes.java +++ b/ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/scope/JaxrsRequestAttributes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/scope/JaxrsServletRequestAttributes.java b/ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/scope/JaxrsServletRequestAttributes.java similarity index 96% rename from ext/spring5/src/main/java/org/glassfish/jersey/server/spring/scope/JaxrsServletRequestAttributes.java rename to ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/scope/JaxrsServletRequestAttributes.java index c32ddbc22f..4c2d0c2792 100644 --- a/ext/spring5/src/main/java/org/glassfish/jersey/server/spring/scope/JaxrsServletRequestAttributes.java +++ b/ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/scope/JaxrsServletRequestAttributes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/scope/RequestContextFilter.java b/ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/scope/RequestContextFilter.java similarity index 98% rename from ext/spring4/src/main/java/org/glassfish/jersey/server/spring/scope/RequestContextFilter.java rename to ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/scope/RequestContextFilter.java index de87d7e91d..a489695202 100644 --- a/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/scope/RequestContextFilter.java +++ b/ext/spring6/src/main/java17/org/glassfish/jersey/server/spring/scope/RequestContextFilter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/filter/TestFilter.java b/ext/spring6/src/main/javaPre17/org/glassfish/jersey/server/spring/AutowiredInjectResolver.java similarity index 53% rename from ext/spring5/src/test/java/org/glassfish/jersey/server/spring/filter/TestFilter.java rename to ext/spring6/src/main/javaPre17/org/glassfish/jersey/server/spring/AutowiredInjectResolver.java index 16cfd51e9b..747c6072b7 100644 --- a/ext/spring5/src/test/java/org/glassfish/jersey/server/spring/filter/TestFilter.java +++ b/ext/spring6/src/main/javaPre17/org/glassfish/jersey/server/spring/AutowiredInjectResolver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -13,27 +13,32 @@ * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 */ +package org.glassfish.jersey.server.spring; -package org.glassfish.jersey.server.spring.filter; - -import java.io.IOException; -import jakarta.inject.Inject; import jakarta.inject.Singleton; -import jakarta.ws.rs.container.ContainerRequestContext; -import jakarta.ws.rs.container.ContainerRequestFilter; - -import org.springframework.stereotype.Component; +import org.glassfish.jersey.internal.inject.Injectee; +import org.glassfish.jersey.internal.inject.InjectionResolver; -@Component @Singleton -public class TestFilter implements ContainerRequestFilter { +public class AutowiredInjectResolver implements InjectionResolver { - @Inject - private Counter counter; + @Override + public Object resolve(Injectee injectee) { + return null; + } @Override - public void filter(final ContainerRequestContext requestContext) throws IOException { - counter.inc(); + public boolean isConstructorParameterIndicator() { + return false; } + @Override + public boolean isMethodParameterIndicator() { + return false; + } + + @Override + public Class getAnnotation() { + return null; + } } diff --git a/ext/spring6/src/main/javaPre17/org/glassfish/jersey/server/spring/SpringComponentProvider.java b/ext/spring6/src/main/javaPre17/org/glassfish/jersey/server/spring/SpringComponentProvider.java new file mode 100644 index 0000000000..5f85ffb28a --- /dev/null +++ b/ext/spring6/src/main/javaPre17/org/glassfish/jersey/server/spring/SpringComponentProvider.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package org.glassfish.jersey.server.spring; + +import org.glassfish.jersey.internal.inject.InjectionManager; +import org.glassfish.jersey.internal.util.JdkVersion; +import org.glassfish.jersey.server.spi.ComponentProvider; + +import java.util.Set; + +/** + * Custom ComponentProvider class. + * Responsible for 1) bootstrapping Jersey 3 Spring integration and + * 2) making Jersey skip JAX-RS Spring component life-cycle management and leave it to us. + * + * @author Marko Asplund (marko.asplund at yahoo.com) + */ +public class SpringComponentProvider implements ComponentProvider { + + @Override + public void initialize(InjectionManager injectionManager) { + if (JdkVersion.getJdkVersion().getMajor() < 17) { + throw new IllegalStateException(LocalizationMessages.NOT_SUPPORTED()); + } + } + + @Override + public boolean bind(Class component, Set> providerContracts) { + return false; + } + + @Override + public void done() { + + } +} diff --git a/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/SpringLifecycleListener.java b/ext/spring6/src/main/javaPre17/org/glassfish/jersey/server/spring/SpringLifecycleListener.java similarity index 62% rename from ext/spring4/src/main/java/org/glassfish/jersey/server/spring/SpringLifecycleListener.java rename to ext/spring6/src/main/javaPre17/org/glassfish/jersey/server/spring/SpringLifecycleListener.java index 5a06926b94..15dd493a92 100644 --- a/ext/spring4/src/main/java/org/glassfish/jersey/server/spring/SpringLifecycleListener.java +++ b/ext/spring6/src/main/javaPre17/org/glassfish/jersey/server/spring/SpringLifecycleListener.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at @@ -17,41 +17,25 @@ package org.glassfish.jersey.server.spring; import jakarta.ws.rs.ext.Provider; - -import jakarta.inject.Inject; - +import org.glassfish.jersey.internal.util.JdkVersion; import org.glassfish.jersey.server.spi.Container; import org.glassfish.jersey.server.spi.ContainerLifecycleListener; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ConfigurableApplicationContext; - -/** - * JAX-RS Provider class for processing Jersey 2 Spring integration container life-cycle events. - * - * @author Marko Asplund (marko.asplund at yahoo.com) - */ @Provider public class SpringLifecycleListener implements ContainerLifecycleListener { - @Inject - private ApplicationContext ctx; - @Override public void onStartup(Container container) { + if (JdkVersion.getJdkVersion().getMajor() < 17) { + throw new IllegalStateException(LocalizationMessages.NOT_SUPPORTED()); + } } @Override public void onReload(Container container) { - if (ctx instanceof ConfigurableApplicationContext) { - ((ConfigurableApplicationContext) ctx).refresh(); - } } @Override public void onShutdown(Container container) { - if (ctx instanceof ConfigurableApplicationContext) { - ((ConfigurableApplicationContext) ctx).close(); - } } } diff --git a/ext/spring6/src/main/javaPre17/org/glassfish/jersey/server/spring/scope/RequestContextFilter.java b/ext/spring6/src/main/javaPre17/org/glassfish/jersey/server/spring/scope/RequestContextFilter.java new file mode 100644 index 0000000000..9a41f804f8 --- /dev/null +++ b/ext/spring6/src/main/javaPre17/org/glassfish/jersey/server/spring/scope/RequestContextFilter.java @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v. 2.0, which is available at + * http://www.eclipse.org/legal/epl-2.0. + * + * This Source Code may also be made available under the following Secondary + * Licenses when the conditions for such availability set forth in the + * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, + * version 2 with the GNU Classpath Exception, which is available at + * https://www.gnu.org/software/classpath/license.html. + * + * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 + */ + +package org.glassfish.jersey.server.spring.scope; + +import jakarta.ws.rs.container.ContainerRequestContext; +import jakarta.ws.rs.container.ContainerRequestFilter; +import jakarta.ws.rs.container.ContainerResponseContext; +import jakarta.ws.rs.container.ContainerResponseFilter; +import jakarta.ws.rs.container.PreMatching; +import jakarta.ws.rs.ext.Provider; +import org.glassfish.jersey.internal.util.JdkVersion; +import org.glassfish.jersey.server.spring.LocalizationMessages; + +import java.io.IOException; + +/** + * Spring filter to provide a bridge between JAX-RS and Spring request attributes. + * + * @author Marko Asplund (marko.asplund at yahoo.com) + * @author Jakub Podlesak + * @author Marek Potociar + */ +@Provider +@PreMatching +public final class RequestContextFilter implements ContainerRequestFilter, ContainerResponseFilter { + + @Override + public void filter(ContainerRequestContext requestContext) throws IOException { + if (JdkVersion.getJdkVersion().getMajor() < 17) { + throw new IllegalStateException(LocalizationMessages.NOT_SUPPORTED()); + } + } + + @Override + public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { + if (JdkVersion.getJdkVersion().getMajor() < 17) { + throw new IllegalStateException(LocalizationMessages.NOT_SUPPORTED()); + } + } +} diff --git a/ext/spring4/src/main/resources/META-INF/services/org.glassfish.jersey.server.spi.ComponentProvider b/ext/spring6/src/main/resources/META-INF/services/org.glassfish.jersey.server.spi.ComponentProvider similarity index 100% rename from ext/spring4/src/main/resources/META-INF/services/org.glassfish.jersey.server.spi.ComponentProvider rename to ext/spring6/src/main/resources/META-INF/services/org.glassfish.jersey.server.spi.ComponentProvider diff --git a/ext/spring4/src/main/resources/jersey-spring-applicationContext.xml b/ext/spring6/src/main/resources/jersey-spring-applicationContext.xml similarity index 95% rename from ext/spring4/src/main/resources/jersey-spring-applicationContext.xml rename to ext/spring6/src/main/resources/jersey-spring-applicationContext.xml index 00e4dda7f6..b563fd32eb 100644 --- a/ext/spring4/src/main/resources/jersey-spring-applicationContext.xml +++ b/ext/spring6/src/main/resources/jersey-spring-applicationContext.xml @@ -1,7 +1,7 @@ 4.0.2.Final diff --git a/tests/integration/pom.xml b/tests/integration/pom.xml index 19aa781494..6406f8de65 100644 --- a/tests/integration/pom.xml +++ b/tests/integration/pom.xml @@ -58,8 +58,6 @@ jersey-4697 jersey-4722 microprofile - - reactive-streams @@ -206,6 +204,15 @@ tracing-support + + spring6-jdk17 + + [17,) + + + spring6 + + diff --git a/tests/integration/spring4/pom.xml b/tests/integration/spring4/pom.xml deleted file mode 100644 index 66764b8783..0000000000 --- a/tests/integration/spring4/pom.xml +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - 4.0.0 - - - org.glassfish.jersey.tests.integration - project - 3.0.0-SNAPSHOT - - - spring4 - - war - jersey-tests-integration-spring4 - - - Jersey tests for Spring 4 integration - - - - - - jakarta.servlet - jakarta.servlet-api - ${servlet4.version} - provided - - - - jakarta.ws.rs - jakarta.ws.rs-api - compile - - - - org.glassfish.jersey.ext - jersey-spring4 - ${project.version} - compile - - - - org.glassfish.jersey.test-framework - jersey-test-framework-core - test - - - - org.glassfish.jersey.containers - jersey-container-servlet - runtime - - - - org.glassfish.jersey.test-framework.providers - jersey-test-framework-provider-external - test - - - - commons-logging - commons-logging - runtime - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - org.apache.maven.plugins - maven-failsafe-plugin - - - org.eclipse.jetty - jetty-maven-plugin - - - / - .*$ - - - - - - - - - delayed-strategy-skip-test - - - org.glassfish.jersey.injection.manager.strategy - delayed - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - true - - - - - - - jakartification_exclude_tests - - [1.8,) - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - true - - - - - - - ignore.on.jdk16 - - - [16,) - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - true - - - - - - - diff --git a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountJerseyResource.java b/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountJerseyResource.java deleted file mode 100644 index bd10b50320..0000000000 --- a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountJerseyResource.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -import java.math.BigDecimal; - -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.PUT; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.core.MediaType; - -import jakarta.inject.Inject; -import jakarta.inject.Named; -import jakarta.servlet.http.HttpServletRequest; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -/** - * Jersey managed JAX-RS resource for testing jersey-spring. - * - * @author Marko Asplund (marko.asplund at yahoo.com) - */ -@Path("/jersey/account") -public class AccountJerseyResource { - - @Inject - @Named("AccountService-singleton") - private AccountService accountServiceInject; - - @Autowired - @Qualifier("AccountService-singleton") - private AccountService accountServiceAutowired; - - @Inject - @Named("AccountService-request-1") - private AccountService accountServiceRequest1; - - @Autowired - @Qualifier("AccountService-request-1") - private AccountService accountServiceRequest2; - - @Autowired - @Qualifier("AccountService-prototype-1") - private AccountService accountServicePrototype1; - - @Autowired - @Qualifier("AccountService-prototype-1") - private AccountService accountServicePrototype2; - - @Autowired - private HttpServletRequest httpServletRequest; - - @Inject - private HK2ServiceSingleton hk2Singleton; - - @Inject - private HK2ServiceRequestScoped hk2RequestScoped; - - @Inject - private HK2ServicePerLookup hk2PerLookup; - - private String message = "n/a"; - - // resource methods for testing resource class scope - @GET - @Path("message") - public String getMessage() { - return message; - } - - @PUT - @Path("message") - @Consumes(MediaType.TEXT_PLAIN) - public String setMessage(final String message) { - this.message = message; - return message; - } - - // JERSEY-2506 FIX VERIFICATION - @GET - @Path("server") - public String verifyServletRequestInjection() { - return "PASSED: " + httpServletRequest.getServerName(); - } - - @GET - @Path("singleton/server") - public String verifyServletRequestInjectionIntoSingleton() { - return accountServiceInject.verifyServletRequestInjection(); - } - - @GET - @Path("singleton/autowired/server") - public String verifyServletRequestInjectionIntoAutowiredSingleton() { - return accountServiceAutowired.verifyServletRequestInjection(); - } - - @GET - @Path("request/server") - public String verifyServletRequestInjectionIntoRequestScopedBean() { - return accountServiceRequest1.verifyServletRequestInjection(); - } - - @GET - @Path("prototype/server") - public String verifyServletRequestInjectionIntoPrototypeScopedBean() { - return accountServicePrototype1.verifyServletRequestInjection(); - } - - // resource methods for testing singleton scoped beans - @GET - @Path("singleton/inject/{accountId}") - public BigDecimal getAccountBalanceSingletonInject(@PathParam("accountId") final String accountId) { - return accountServiceInject.getAccountBalance(accountId); - } - - @GET - @Path("singleton/autowired/{accountId}") - public BigDecimal getAccountBalanceSingletonAutowired(@PathParam("accountId") final String accountId) { - return accountServiceAutowired.getAccountBalance(accountId); - } - - @PUT - @Path("singleton/{accountId}") - @Consumes(MediaType.TEXT_PLAIN) - public void setAccountBalanceSingleton(@PathParam("accountId") final String accountId, final String balance) { - accountServiceInject.setAccountBalance(accountId, new BigDecimal(balance)); - } - - // resource methods for testing request scoped beans - @PUT - @Path("request/{accountId}") - @Consumes(MediaType.TEXT_PLAIN) - public BigDecimal setAccountBalanceRequest(@PathParam("accountId") final String accountId, final String balance) { - accountServiceRequest1.setAccountBalance(accountId, new BigDecimal(balance)); - return accountServiceRequest2.getAccountBalance(accountId); - } - - // resource methods for testing prototype scoped beans - @PUT - @Path("prototype/{accountId}") - @Consumes(MediaType.TEXT_PLAIN) - public BigDecimal setAccountBalancePrototype(@PathParam("accountId") final String accountId, final String balance) { - accountServicePrototype1.setAccountBalance(accountId, new BigDecimal(balance)); - return accountServicePrototype2.getAccountBalance(accountId); - } -} diff --git a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountService.java b/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountService.java deleted file mode 100644 index 851e21501c..0000000000 --- a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountService.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -import java.math.BigDecimal; - -/** - * Simple account service to testify injection into different scopes. - * - * @author Marko Asplund (marko.asplund at yahoo.com) - */ -public interface AccountService { - - void setAccountBalance(String accountId, BigDecimal balance); - - BigDecimal getAccountBalance(String accountId); - - String verifyServletRequestInjection(); -} diff --git a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountServiceImpl.java b/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountServiceImpl.java deleted file mode 100644 index e79d9bdfb5..0000000000 --- a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountServiceImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -import java.math.BigDecimal; -import java.util.HashMap; -import java.util.Map; - -import jakarta.servlet.http.HttpServletRequest; - -import org.springframework.beans.factory.annotation.Autowired; - -/** - * AccountService implementation. - * - * @author Marko Asplund (marko.asplund at yahoo.com) - */ -public class AccountServiceImpl implements AccountService { - - private Map accounts = new HashMap<>(); - private BigDecimal defaultAccountBalance; - - // JERSEY-2506 FIX VERIFICATION - @Autowired - private HttpServletRequest httpServletRequest; - - @Override - public void setAccountBalance(String accountId, BigDecimal balance) { - accounts.put(accountId, balance); - } - - @Override - public BigDecimal getAccountBalance(String accountId) { - BigDecimal balance = accounts.get(accountId); - if (balance == null) { - return defaultAccountBalance; - } - return balance; - } - - public void setDefaultAccountBalance(String defaultAccountBalance) { - this.defaultAccountBalance = new BigDecimal(defaultAccountBalance); - } - - public String verifyServletRequestInjection() { - return "PASSED: " + httpServletRequest.getServerName(); - } - -} diff --git a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountSpringResource.java b/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountSpringResource.java deleted file mode 100644 index 0e5d2cfb85..0000000000 --- a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/AccountSpringResource.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -import java.math.BigDecimal; - -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.PUT; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.core.MediaType; - -import jakarta.inject.Inject; -import jakarta.inject.Named; -import jakarta.servlet.http.HttpServletRequest; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.stereotype.Component; - -/** - * Spring managed JAX-RS resource for testing jersey-spring. - * - * @author Marko Asplund (marko.asplund at yahoo.com) - */ -@Path("/spring/account") -@Component -public class AccountSpringResource { - - @Inject - @Named("AccountService-singleton") - private AccountService accountServiceInject; - - @Autowired - @Qualifier("AccountService-singleton") - private AccountService accountServiceAutowired; - - @Inject - @Named("AccountService-request-1") - private AccountService accountServiceRequest1; - - @Autowired - @Qualifier("AccountService-request-1") - private AccountService accountServiceRequest2; - - @Autowired - @Qualifier("AccountService-prototype-1") - private AccountService accountServicePrototype1; - - @Autowired - @Qualifier("AccountService-prototype-1") - private AccountService accountServicePrototype2; - - @Autowired - private HttpServletRequest httpServletRequest; - - @Inject - private HK2ServiceSingleton hk2Singleton; - - @Inject - private HK2ServiceRequestScoped hk2RequestScoped; - - @Inject - private HK2ServicePerLookup hk2PerLookup; - - private String message = "n/a"; - - // resource methods for testing resource class scope - @GET - @Path("message") - public String getMessage() { - return message; - } - - @PUT - @Path("message") - @Consumes(MediaType.TEXT_PLAIN) - public String setMessage(String message) { - this.message = message; - return message; - } - - // JERSEY-2506 FIX VERIFICATION - @GET - @Path("server") - public String verifyServletRequestInjection() { - return "PASSED: " + httpServletRequest.getServerName(); - } - - @GET - @Path("singleton/server") - public String verifyServletRequestInjectionIntoSingleton() { - return accountServiceInject.verifyServletRequestInjection(); - } - - @GET - @Path("singleton/autowired/server") - public String verifyServletRequestInjectionIntoAutowiredSingleton() { - return accountServiceAutowired.verifyServletRequestInjection(); - } - - @GET - @Path("request/server") - public String verifyServletRequestInjectionIntoRequestScopedBean() { - return accountServiceRequest1.verifyServletRequestInjection(); - } - - @GET - @Path("prototype/server") - public String verifyServletRequestInjectionIntoPrototypeScopedBean() { - return accountServicePrototype1.verifyServletRequestInjection(); - } - - // resource methods for testing singleton scoped beans - @GET - @Path("singleton/inject/{accountId}") - public BigDecimal getAccountBalanceSingletonInject(@PathParam("accountId") String accountId) { - return accountServiceInject.getAccountBalance(accountId); - } - - @GET - @Path("singleton/autowired/{accountId}") - public BigDecimal getAccountBalanceSingletonAutowired(@PathParam("accountId") String accountId) { - return accountServiceAutowired.getAccountBalance(accountId); - } - - @PUT - @Path("singleton/{accountId}") - @Consumes(MediaType.TEXT_PLAIN) - public void setAccountBalanceSingleton(@PathParam("accountId") String accountId, String balance) { - accountServiceInject.setAccountBalance(accountId, new BigDecimal(balance)); - } - - // resource methods for testing request scoped beans - @PUT - @Path("request/{accountId}") - @Consumes(MediaType.TEXT_PLAIN) - public BigDecimal setAccountBalanceRequest(@PathParam("accountId") String accountId, String balance) { - accountServiceRequest1.setAccountBalance(accountId, new BigDecimal(balance)); - return accountServiceRequest2.getAccountBalance(accountId); - } - - // resource methods for testing prototype scoped beans - @PUT - @Path("prototype/{accountId}") - @Consumes(MediaType.TEXT_PLAIN) - public BigDecimal setAccountBalancePrototype(@PathParam("accountId") String accountId, String balance) { - accountServicePrototype1.setAccountBalance(accountId, new BigDecimal(balance)); - return accountServicePrototype2.getAccountBalance(accountId); - } - -} diff --git a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/EndpointResource.java b/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/EndpointResource.java deleted file mode 100644 index d61ef3b479..0000000000 --- a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/EndpointResource.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.PUT; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.core.MediaType; - -/** - * @author Konrad Garus (konrad.garus at gmail.com) - */ -@Endpoint -@Path("/spring/endpoint") -public class EndpointResource { - - private String message; - - @PUT - @Path("message") - @Consumes(MediaType.TEXT_PLAIN) - public String setMessage(final String message) { - this.message = message; - return message; - } - - @GET - @Path("message") - public String getMessage() { - return message; - } -} diff --git a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServicePerLookup.java b/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServicePerLookup.java deleted file mode 100644 index ff689c6e4f..0000000000 --- a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServicePerLookup.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -/** - * Type to be handled as HK2 per-lookup bean. - * - * @author Marko Asplund (marko.asplund at yahoo.com) - */ -public class HK2ServicePerLookup { -} diff --git a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceRequestScoped.java b/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceRequestScoped.java deleted file mode 100644 index da45aeafab..0000000000 --- a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceRequestScoped.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -/** - * Type to be handled as HK2 request scoped bean. - * - * @author Marko Asplund (marko.asplund at yahoo.com) - */ -public class HK2ServiceRequestScoped { -} diff --git a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/MyApplication.java b/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/MyApplication.java deleted file mode 100644 index b0f82c7d52..0000000000 --- a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/MyApplication.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -import jakarta.ws.rs.core.Application; - -import jakarta.inject.Inject; -import jakarta.inject.Singleton; - -import org.glassfish.jersey.internal.inject.AbstractBinder; -import org.glassfish.jersey.internal.inject.Binder; -import org.glassfish.jersey.internal.inject.InjectionManager; -import org.glassfish.jersey.internal.inject.PerLookup; -import org.glassfish.jersey.process.internal.RequestScoped; - -/** - * JAX-RS application class for configuring injectable services in HK2 registry for testing purposes. - * - * @author Marko Asplund (marko.asplund at yahoo.com) - */ -public class MyApplication extends Application { - - @Inject - public MyApplication(final InjectionManager injectionManager) { - Binder binder = new AbstractBinder() { - @Override - protected void configure() { - bindAsContract(HK2ServiceSingleton.class).in(Singleton.class); - bindAsContract(HK2ServiceRequestScoped.class).in(RequestScoped.class); - bindAsContract(HK2ServicePerLookup.class).in(PerLookup.class); - } - }; - - injectionManager.register(binder); - } -} diff --git a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/RepositoryResource.java b/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/RepositoryResource.java deleted file mode 100644 index b815fe02f4..0000000000 --- a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/RepositoryResource.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.PUT; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.core.MediaType; - -import org.springframework.stereotype.Repository; - -/** - * @author Konrad Garus (konrad.garus at gmail.com) - */ -@Repository -@Path("/spring/repository") -public class RepositoryResource { - - private String message; - - @PUT - @Path("message") - @Consumes(MediaType.TEXT_PLAIN) - public String setMessage(final String message) { - this.message = message; - return message; - } - - @GET - @Path("message") - public String getMessage() { - return message; - } -} diff --git a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/ServiceResource.java b/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/ServiceResource.java deleted file mode 100644 index d50e5a6cc4..0000000000 --- a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/ServiceResource.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.PUT; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.core.MediaType; - -import org.springframework.stereotype.Service; - -/** - * @author Konrad Garus (konrad.garus at gmail.com) - */ -@Service -@Path("/spring/service") -public class ServiceResource { - - private String message; - - @PUT - @Path("message") - @Consumes(MediaType.TEXT_PLAIN) - public String setMessage(final String message) { - this.message = message; - return message; - } - - @GET - @Path("message") - public String getMessage() { - return message; - } -} diff --git a/tests/integration/spring4/src/main/resources/applicationContext.xml b/tests/integration/spring4/src/main/resources/applicationContext.xml deleted file mode 100644 index c7e421eaa3..0000000000 --- a/tests/integration/spring4/src/main/resources/applicationContext.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - org.springframework.beans.factory.annotation.Autowired - org.springframework.beans.factory.annotation.Value - - - - - - - - - org.springframework.beans.factory.annotation.Qualifier - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/integration/spring4/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedEndpointITCase.java b/tests/integration/spring4/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedEndpointITCase.java deleted file mode 100644 index 79ade92c60..0000000000 --- a/tests/integration/spring4/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedEndpointITCase.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -import jakarta.ws.rs.client.Entity; -import jakarta.ws.rs.client.WebTarget; - -import org.glassfish.jersey.server.ResourceConfig; - -import org.junit.Test; -import static org.junit.Assert.assertEquals; - -/** - * Tests for Spring managed JAX-RS resources with custom composite - * annotation that derives from @Component. - * - * @author Konrad Garus (konrad.garus at gmail.com) - */ -public class SpringManagedEndpointITCase extends ResourceTestBase { - - @Override - protected ResourceConfig configure(final ResourceConfig rc) { - return rc.register(EndpointResource.class); - } - - @Override - protected String getResourcePath() { - return "/spring/endpoint"; - } - - @Test - public void testResourceScope() { - final WebTarget t = target(getResourceFullPath()); - final String message = "hello, world"; - final String echo = t.path("message").request().put(Entity.text(message), String.class); - assertEquals(message, echo); - final String msg = t.path("message").request().get(String.class); - assertEquals(message, msg); - } -} diff --git a/tests/integration/spring5/README.txt b/tests/integration/spring5/README.txt deleted file mode 100644 index 9a105f7bac..0000000000 --- a/tests/integration/spring5/README.txt +++ /dev/null @@ -1,30 +0,0 @@ - -tests -===== - -Tests are located in jersey-spring-test module. -The module contains a test webapp and test code. -The tests can be run in Jersey test container or an external container. - -- Running tests in Jersey test container - mvn clean test - -- Running tests in an external container - build the test app - deploy to an external container - configure container connection info in jersey-spring-test/pom.xml, if needed - run tests in integration test mode: - mvn -Pit verify - -- Running tests in embedded Jetty instance - build the test app - deploy to Jetty: - mvn -Pjetty jetty:run - run tests in integration test mode in another console session: - mvn -Pit verify - -test class naming conventions -- *ITTest.java: run in unit and IT test mode -- *Test.java: run as unit tests -- *IT.java: run as IT tests - diff --git a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/ControllerResource.java b/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/ControllerResource.java deleted file mode 100644 index 39dd5aa41c..0000000000 --- a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/ControllerResource.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.PUT; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.core.MediaType; - -import org.springframework.stereotype.Controller; - -/** - * @author Konrad Garus (konrad.garus at gmail.com) - */ -@Controller -@Path("/spring/controller") -public class ControllerResource { - - private String message; - - @PUT - @Path("message") - @Consumes(MediaType.TEXT_PLAIN) - public String setMessage(final String message) { - this.message = message; - return message; - } - - @GET - @Path("message") - public String getMessage() { - return message; - } -} diff --git a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/Endpoint.java b/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/Endpoint.java deleted file mode 100644 index 80f5d8c1ae..0000000000 --- a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/Endpoint.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.springframework.stereotype.Component; - -/** - * @author Konrad Garus (konrad.garus at gmail.com) - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.TYPE) -@Component -public @interface Endpoint { - -} diff --git a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceSingleton.java b/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceSingleton.java deleted file mode 100644 index 424f1866e8..0000000000 --- a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceSingleton.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -/** - * Type to be handled as HK2 singleton. - * - * @author Marko Asplund (marko.asplund at yahoo.com) - */ -public class HK2ServiceSingleton { -} diff --git a/tests/integration/spring5/src/main/webapp/WEB-INF/web.xml b/tests/integration/spring5/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 4004dd3c3c..0000000000 --- a/tests/integration/spring5/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - jersey-spring-test - - - - - - org.glassfish.jersey.server.spring.test.MyApplication - - - org.glassfish.jersey.server.spring.test.MyApplication - /* - - - - - diff --git a/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/AccountResourceITCase.java b/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/AccountResourceITCase.java deleted file mode 100644 index 77f2984d6c..0000000000 --- a/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/AccountResourceITCase.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -import jakarta.ws.rs.core.Application; - -import org.glassfish.jersey.test.external.ExternalTestContainerFactory; -import org.glassfish.jersey.test.spi.TestContainerException; -import org.glassfish.jersey.test.spi.TestContainerFactory; -import org.glassfish.jersey.test.JerseyTest; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -public class AccountResourceITCase extends JerseyTest { - - @Override - protected Application configure() { - return new Application(); - } - - @Override - protected TestContainerFactory getTestContainerFactory() throws TestContainerException { - return new ExternalTestContainerFactory(); - } - - @Test - public void testGet() throws Exception { - final String r = target().path("/jersey/account/message").request().get(String.class); - assertEquals(r, "n/a"); - } -} diff --git a/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/AccountResourceTestBase.java b/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/AccountResourceTestBase.java deleted file mode 100644 index 5cc9fc750f..0000000000 --- a/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/AccountResourceTestBase.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -import java.math.BigDecimal; - -import jakarta.ws.rs.client.Entity; -import jakarta.ws.rs.client.WebTarget; -import jakarta.ws.rs.core.MediaType; - -import org.junit.Test; -import static org.hamcrest.CoreMatchers.startsWith; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; - -/** - * Base class for JAX-RS resource tests. - * - * @author Marko Asplund (marko.asplund at yahoo.com) - */ -public abstract class AccountResourceTestBase extends ResourceTestBase { - - // test singleton scoped Spring bean injection using @Inject + @Autowired - @Test - public void testSingletonScopedSpringService() { - final BigDecimal newBalance = new BigDecimal(Math.random()); - final WebTarget t = target(getResourceFullPath()); - - t.path("/singleton/xyz123").request().put(Entity.entity(newBalance.toString(), MediaType.TEXT_PLAIN_TYPE)); - final BigDecimal balance = t.path("/singleton/autowired/xyz123").request().get(BigDecimal.class); - assertEquals(newBalance, balance); - } - - @Test - public void testRequestScopedSpringService() { - final BigDecimal newBalance = new BigDecimal(Math.random()); - final WebTarget t = target(getResourceFullPath()); - final BigDecimal balance = t.path("request/abc456").request().put(Entity.text(newBalance), BigDecimal.class); - assertEquals(newBalance, balance); - } - - @Test - public void testPrototypeScopedSpringService() { - final BigDecimal newBalance = new BigDecimal(Math.random()); - final WebTarget t = target(getResourceFullPath()); - final BigDecimal balance = t.path("prototype/abc456").request().put(Entity.text(newBalance), BigDecimal.class); - assertEquals(new BigDecimal("987.65"), balance); - } - - @Test - public void testServletInjection() { - final WebTarget t = target(getResourceFullPath()); - - String server = t.path("server").request().get(String.class); - assertThat(server, startsWith("PASSED: ")); - - server = t.path("singleton/server").request().get(String.class); - assertThat(server, startsWith("PASSED: ")); - - server = t.path("singleton/autowired/server").request().get(String.class); - assertThat(server, startsWith("PASSED: ")); - - server = t.path("request/server").request().get(String.class); - assertThat(server, startsWith("PASSED: ")); - - server = t.path("prototype/server").request().get(String.class); - assertThat(server, startsWith("PASSED: ")); - } -} diff --git a/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/JerseyManagedITCase.java b/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/JerseyManagedITCase.java deleted file mode 100644 index fa3d1a2ff4..0000000000 --- a/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/JerseyManagedITCase.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -import jakarta.ws.rs.client.Entity; -import jakarta.ws.rs.client.WebTarget; - -import org.glassfish.jersey.server.ResourceConfig; - -import org.junit.Test; -import static org.junit.Assert.assertEquals; - -/** - * Tests for Jersey managed JAX-RS resources. - * - * @author Marko Asplund (marko.asplund at yahoo.com) - */ -public class JerseyManagedITCase extends AccountResourceTestBase { - - @Override - protected ResourceConfig configure(final ResourceConfig rc) { - return rc.register(AccountJerseyResource.class); - } - - @Override - protected String getResourcePath() { - return "/jersey/account"; - } - - @Test - public void testResourceScope() { - final WebTarget t = target(getResourceFullPath()); - final String message = "hello, world"; - final String echo = t.path("message").request().put(Entity.text(message), String.class); - assertEquals(message, echo); - final String msg = t.path("message").request().get(String.class); - assertEquals("n/a", msg); - } - -} diff --git a/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/ResourceTestBase.java b/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/ResourceTestBase.java deleted file mode 100644 index 08c4902e43..0000000000 --- a/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/ResourceTestBase.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -import jakarta.ws.rs.core.Application; - -import org.glassfish.jersey.server.ResourceConfig; -import org.glassfish.jersey.server.spring.SpringLifecycleListener; -import org.glassfish.jersey.server.spring.scope.RequestContextFilter; -import org.glassfish.jersey.test.JerseyTest; -import org.glassfish.jersey.test.TestProperties; -import org.glassfish.jersey.test.external.ExternalTestContainerFactory; -import org.glassfish.jersey.test.spi.TestContainerException; -import org.glassfish.jersey.test.spi.TestContainerFactory; - -/** - * Base class for JAX-RS resource tests. - * - * @author Marko Asplund (marko.asplund at yahoo.com) - */ -public abstract class ResourceTestBase extends JerseyTest { - - private static final String TEST_WEBAPP_CONTEXT_PATH = "jersey.spring.test.contextPath"; - private static final String TEST_CONTAINER_FACTORY_EXTERNAL = "org.glassfish.jersey.test.external" - + ".ExternalTestContainerFactory"; - - @Override - protected TestContainerFactory getTestContainerFactory() throws TestContainerException { - return new ExternalTestContainerFactory(); - } - - @Override - protected Application configure() { - final ResourceConfig rc = new ResourceConfig() - .register(SpringLifecycleListener.class) - .register(RequestContextFilter.class); - TestUtil.registerHK2Services(rc); - rc.property("contextConfigLocation", "classpath:applicationContext.xml"); - return configure(rc); - } - - protected abstract ResourceConfig configure(ResourceConfig rc); - - protected abstract String getResourcePath(); - - protected String getResourceFullPath() { - final String containerFactory = System.getProperty(TestProperties.CONTAINER_FACTORY); - if (TEST_CONTAINER_FACTORY_EXTERNAL.equals(containerFactory)) { - return System.getProperty(TEST_WEBAPP_CONTEXT_PATH) + getResourcePath(); - } - return getResourcePath(); - } -} diff --git a/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedControllerITCase.java b/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedControllerITCase.java deleted file mode 100644 index 9b24994681..0000000000 --- a/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedControllerITCase.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -import jakarta.ws.rs.client.Entity; -import jakarta.ws.rs.client.WebTarget; - -import org.glassfish.jersey.server.ResourceConfig; - -import org.junit.Test; -import static org.junit.Assert.assertEquals; - -/** - * Tests for Spring managed JAX-RS resources with @Controller archetype. - * - * @author Konrad Garus (konrad.garus at gmail.com) - */ -public class SpringManagedControllerITCase extends ResourceTestBase { - - @Override - protected ResourceConfig configure(final ResourceConfig rc) { - return rc.register(ControllerResource.class); - } - - @Override - protected String getResourcePath() { - return "/spring/controller"; - } - - @Test - public void testResourceScope() { - final WebTarget t = target(getResourceFullPath()); - final String message = "hello, world"; - final String echo = t.path("message").request().put(Entity.text(message), String.class); - assertEquals(message, echo); - final String msg = t.path("message").request().get(String.class); - assertEquals(message, msg); - } -} diff --git a/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedITCase.java b/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedITCase.java deleted file mode 100644 index 2b351f09de..0000000000 --- a/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedITCase.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -import jakarta.ws.rs.client.Entity; -import jakarta.ws.rs.client.WebTarget; - -import org.glassfish.jersey.server.ResourceConfig; - -import org.junit.Test; -import static org.junit.Assert.assertEquals; - -/** - * Tests for Spring managed JAX-RS resources. - * - * @author Marko Asplund (marko.asplund at yahoo.com) - */ -public class SpringManagedITCase extends AccountResourceTestBase { - - @Override - protected ResourceConfig configure(final ResourceConfig rc) { - return rc.register(AccountSpringResource.class); - } - - @Override - protected String getResourcePath() { - return "/spring/account"; - } - - @Test - public void testResourceScope() { - final WebTarget t = target(getResourceFullPath()); - final String message = "hello, world"; - final String echo = t.path("message").request().put(Entity.text(message), String.class); - assertEquals(message, echo); - final String msg = t.path("message").request().get(String.class); - assertEquals(message, msg); - } - -} diff --git a/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedRepositoryITCase.java b/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedRepositoryITCase.java deleted file mode 100644 index 0bfcd04b4e..0000000000 --- a/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedRepositoryITCase.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -import jakarta.ws.rs.client.Entity; -import jakarta.ws.rs.client.WebTarget; - -import org.glassfish.jersey.server.ResourceConfig; - -import org.junit.Test; -import static org.junit.Assert.assertEquals; - -/** - * Tests for Spring managed JAX-RS resources with @Repository archetype. - * - * @author Konrad Garus (konrad.garus at gmail.com) - */ -public class SpringManagedRepositoryITCase extends ResourceTestBase { - - @Override - protected ResourceConfig configure(final ResourceConfig rc) { - return rc.register(RepositoryResource.class); - } - - @Override - protected String getResourcePath() { - return "/spring/repository"; - } - - @Test - public void testResourceScope() { - final WebTarget t = target(getResourceFullPath()); - final String message = "hello, world"; - final String echo = t.path("message").request().put(Entity.text(message), String.class); - assertEquals(message, echo); - final String msg = t.path("message").request().get(String.class); - assertEquals(message, msg); - } -} diff --git a/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedServiceITCase.java b/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedServiceITCase.java deleted file mode 100644 index fd31b990b1..0000000000 --- a/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/SpringManagedServiceITCase.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -import jakarta.ws.rs.client.Entity; -import jakarta.ws.rs.client.WebTarget; - -import org.glassfish.jersey.server.ResourceConfig; - -import org.junit.Test; -import static org.junit.Assert.assertEquals; - -/** - * Tests for Spring managed JAX-RS resources with @Service archetype. - * - * @author Konrad Garus (konrad.garus at gmail.com) - */ -public class SpringManagedServiceITCase extends ResourceTestBase { - - @Override - protected ResourceConfig configure(final ResourceConfig rc) { - return rc.register(ServiceResource.class); - } - - @Override - protected String getResourcePath() { - return "/spring/service"; - } - - @Test - public void testResourceScope() { - final WebTarget t = target(getResourceFullPath()); - final String message = "hello, world"; - final String echo = t.path("message").request().put(Entity.text(message), String.class); - assertEquals(message, echo); - final String msg = t.path("message").request().get(String.class); - assertEquals(message, msg); - } -} diff --git a/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/TestUtil.java b/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/TestUtil.java deleted file mode 100644 index 8c837c8ac5..0000000000 --- a/tests/integration/spring5/src/test/java/org/glassfish/jersey/server/spring/test/TestUtil.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v. 2.0, which is available at - * http://www.eclipse.org/legal/epl-2.0. - * - * This Source Code may also be made available under the following Secondary - * Licenses when the conditions for such availability set forth in the - * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, - * version 2 with the GNU Classpath Exception, which is available at - * https://www.gnu.org/software/classpath/license.html. - * - * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 - */ - -package org.glassfish.jersey.server.spring.test; - -import jakarta.inject.Singleton; - -import org.glassfish.jersey.internal.inject.PerLookup; -import org.glassfish.jersey.process.internal.RequestScoped; -import org.glassfish.jersey.server.ResourceConfig; - -import org.glassfish.hk2.utilities.BuilderHelper; -import org.glassfish.hk2.utilities.binding.AbstractBinder; - -class TestUtil { - - public static ResourceConfig registerHK2Services(final ResourceConfig rc) { - rc - .register(new AbstractBinder() { - @Override - protected void configure() { - bind(BuilderHelper.link(HK2ServiceSingleton.class).in(Singleton.class).build()); - } - }) - .register(new AbstractBinder() { - @Override - protected void configure() { - bind(BuilderHelper.link(HK2ServiceRequestScoped.class).in(RequestScoped.class).build()); - } - }) - .register(new AbstractBinder() { - @Override - protected void configure() { - bind(BuilderHelper.link(HK2ServicePerLookup.class).in(PerLookup.class).build()); - } - }); - return rc; - } -} diff --git a/tests/integration/spring4/README.txt b/tests/integration/spring6/README.txt similarity index 100% rename from tests/integration/spring4/README.txt rename to tests/integration/spring6/README.txt diff --git a/tests/integration/spring5/pom.xml b/tests/integration/spring6/pom.xml similarity index 73% rename from tests/integration/spring5/pom.xml rename to tests/integration/spring6/pom.xml index 7a0712027f..e7df36c1d9 100644 --- a/tests/integration/spring5/pom.xml +++ b/tests/integration/spring6/pom.xml @@ -25,24 +25,32 @@ org.glassfish.jersey.tests.integration project - 3.0.0-SNAPSHOT + 3.1.0-SNAPSHOT - spring5 + spring6 war - jersey-tests-integration-spring5 + jersey-tests-integration-spring6 - Jersey tests for Spring 5 integration + Jersey tests for Spring 6 integration + + + Spring Repository + spring-repository + https://repo.spring.io/milestone + + + jakarta.servlet jakarta.servlet-api - ${servlet4.version} + ${servlet5.version} provided @@ -54,11 +62,41 @@ org.glassfish.jersey.ext - jersey-spring5 + jersey-spring6 ${project.version} compile + + org.springframework + spring-beans + ${spring6.version} + + + + org.springframework + spring-core + ${spring6.version} + + + + org.springframework + spring-context + ${spring6.version} + + + + org.springframework + spring-web + ${spring6.version} + + + + org.springframework + spring-aop + ${spring6.version} + + org.glassfish.jersey.test-framework jersey-test-framework-core @@ -93,16 +131,11 @@ org.apache.maven.plugins maven-failsafe-plugin - - - - **/**/*.java - - org.eclipse.jetty jetty-maven-plugin + 11.0.7 / diff --git a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountJerseyResource.java b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/AccountJerseyResource.java similarity index 98% rename from tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountJerseyResource.java rename to tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/AccountJerseyResource.java index bd10b50320..ab54e71067 100644 --- a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountJerseyResource.java +++ b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/AccountJerseyResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountService.java b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/AccountService.java similarity index 94% rename from tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountService.java rename to tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/AccountService.java index 70d90b05d5..2a764dcaa4 100644 --- a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountService.java +++ b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/AccountService.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountServiceImpl.java b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/AccountServiceImpl.java similarity index 96% rename from tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountServiceImpl.java rename to tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/AccountServiceImpl.java index b7fb876d15..58919af734 100644 --- a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountServiceImpl.java +++ b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/AccountServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountSpringResource.java b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/AccountSpringResource.java similarity index 98% rename from tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountSpringResource.java rename to tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/AccountSpringResource.java index 0e5d2cfb85..e6e8e437e4 100644 --- a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/AccountSpringResource.java +++ b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/AccountSpringResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/ControllerResource.java b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/ControllerResource.java similarity index 95% rename from tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/ControllerResource.java rename to tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/ControllerResource.java index 39dd5aa41c..8cf0a7e6a3 100644 --- a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/ControllerResource.java +++ b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/ControllerResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/Endpoint.java b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/Endpoint.java similarity index 94% rename from tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/Endpoint.java rename to tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/Endpoint.java index da9f1707b7..53a9ef14e0 100644 --- a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/Endpoint.java +++ b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/Endpoint.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/EndpointResource.java b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/EndpointResource.java similarity index 95% rename from tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/EndpointResource.java rename to tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/EndpointResource.java index d61ef3b479..a1d8682e01 100644 --- a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/EndpointResource.java +++ b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/EndpointResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServicePerLookup.java b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServicePerLookup.java similarity index 92% rename from tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServicePerLookup.java rename to tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServicePerLookup.java index 4b6bbf57ae..0fb4f768a4 100644 --- a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServicePerLookup.java +++ b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServicePerLookup.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceRequestScoped.java b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceRequestScoped.java similarity index 92% rename from tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceRequestScoped.java rename to tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceRequestScoped.java index 3bde89d214..f55662ada9 100644 --- a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceRequestScoped.java +++ b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceRequestScoped.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceSingleton.java b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceSingleton.java similarity index 92% rename from tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceSingleton.java rename to tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceSingleton.java index a7b8fa8837..64ea0ba6d4 100644 --- a/tests/integration/spring4/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceSingleton.java +++ b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/HK2ServiceSingleton.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/MyApplication.java b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/MyApplication.java similarity index 96% rename from tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/MyApplication.java rename to tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/MyApplication.java index b0f82c7d52..e0f0c99317 100644 --- a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/MyApplication.java +++ b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/MyApplication.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/RepositoryResource.java b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/RepositoryResource.java similarity index 95% rename from tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/RepositoryResource.java rename to tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/RepositoryResource.java index b815fe02f4..52a8b6444d 100644 --- a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/RepositoryResource.java +++ b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/RepositoryResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/ServiceResource.java b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/ServiceResource.java similarity index 95% rename from tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/ServiceResource.java rename to tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/ServiceResource.java index d50e5a6cc4..75cf5afc5e 100644 --- a/tests/integration/spring5/src/main/java/org/glassfish/jersey/server/spring/test/ServiceResource.java +++ b/tests/integration/spring6/src/main/java/org/glassfish/jersey/server/spring/test/ServiceResource.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2022 Oracle and/or its affiliates. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0, which is available at diff --git a/tests/integration/spring5/src/main/resources/applicationContext.xml b/tests/integration/spring6/src/main/resources/applicationContext.xml similarity index 98% rename from tests/integration/spring5/src/main/resources/applicationContext.xml rename to tests/integration/spring6/src/main/resources/applicationContext.xml index c7e421eaa3..c36223ca48 100644 --- a/tests/integration/spring5/src/main/resources/applicationContext.xml +++ b/tests/integration/spring6/src/main/resources/applicationContext.xml @@ -1,7 +1,7 @@