|
1 | 1 | /* |
2 | | - * Copyright (c) 2015, 2019 Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2015, 2020 Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * |
4 | 4 | * This program and the accompanying materials are made available under the |
5 | 5 | * terms of the Eclipse Public License v. 2.0, which is available at |
|
31 | 31 | import javax.inject.Singleton; |
32 | 32 |
|
33 | 33 | import org.glassfish.jersey.internal.inject.InjectionManager; |
34 | | -import org.glassfish.jersey.internal.inject.PerLookup; |
35 | | -import org.glassfish.jersey.internal.util.collection.Ref; |
36 | 34 | import org.glassfish.jersey.process.internal.RequestScoped; |
| 35 | +import org.glassfish.jersey.server.internal.process.RequestProcessingContextReference; |
37 | 36 | import org.glassfish.jersey.server.ContainerResponse; |
38 | 37 | import org.glassfish.jersey.server.RequestContextBuilder; |
39 | 38 | import org.glassfish.jersey.server.ResourceConfig; |
40 | | -import org.glassfish.jersey.server.internal.process.RequestProcessingContext; |
41 | 39 |
|
42 | 40 | import org.glassfish.hk2.api.DescriptorType; |
43 | 41 | import org.glassfish.hk2.api.DescriptorVisibility; |
| 42 | +import org.glassfish.hk2.api.PerLookup; |
44 | 43 | import org.glassfish.hk2.api.ServiceHandle; |
45 | 44 | import org.glassfish.hk2.utilities.AbstractActiveDescriptor; |
46 | 45 | import org.glassfish.hk2.utilities.binding.AbstractBinder; |
47 | 46 |
|
48 | 47 | import org.jvnet.hk2.internal.ServiceHandleImpl; |
49 | 48 |
|
50 | | -import org.junit.Ignore; |
51 | 49 | import org.junit.Test; |
52 | 50 | import static org.hamcrest.CoreMatchers.containsString; |
53 | 51 | import static org.hamcrest.CoreMatchers.not; |
@@ -139,7 +137,6 @@ public String getParam(@Context MyRequestData param) { |
139 | 137 | } |
140 | 138 |
|
141 | 139 | @Test |
142 | | - @Ignore("At the time of ignoring this test, ResourceConfig does not support HK2 Binder registering.") |
143 | 140 | public void testReq() throws Exception { |
144 | 141 |
|
145 | 142 | // bootstrap the test application |
@@ -250,16 +247,16 @@ public MyRequestData create(ServiceHandle<?> serviceHandle) { |
250 | 247 |
|
251 | 248 | boolean direct = false; |
252 | 249 |
|
253 | | - final javax.inject.Provider<Ref<RequestProcessingContext>> ctxRef = |
254 | | - injectionManager.getInstance(new GenericType<Provider<Ref<RequestProcessingContext>>>() { |
| 250 | + final Provider<RequestProcessingContextReference> ctxRef = |
| 251 | + injectionManager.getInstance(new GenericType<Provider<RequestProcessingContextReference>>() { |
255 | 252 | }.getType()); |
256 | 253 |
|
257 | 254 | if (serviceHandle instanceof ServiceHandleImpl) { |
258 | 255 | final ServiceHandleImpl serviceHandleImpl = (ServiceHandleImpl) serviceHandle; |
259 | | - final Class<? extends Annotation> scopeAnnotation = |
260 | | - serviceHandleImpl.getOriginalRequest().getInjecteeDescriptor().getScopeAnnotation(); |
| 256 | + final String scopeAnnotation = |
| 257 | + serviceHandleImpl.getOriginalRequest().getInjecteeDescriptor().getScope(); |
261 | 258 |
|
262 | | - if (scopeAnnotation == RequestScoped.class || scopeAnnotation == null) { |
| 259 | + if (RequestScoped.class.getName().equals(scopeAnnotation) || scopeAnnotation == null) { |
263 | 260 | direct = true; |
264 | 261 | } |
265 | 262 | } |
|
0 commit comments