Skip to content

Commit d11a733

Browse files
jansupolsenivam
authored andcommitted
Fixed HK2 AbstractActiveDescriptor Test
Signed-off-by: jansupol <[email protected]>
1 parent 7918fe4 commit d11a733

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

core-server/src/test/java/org/glassfish/jersey/server/internal/inject/ActiveBindingBindingTest.java

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
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.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
@@ -31,23 +31,21 @@
3131
import javax.inject.Singleton;
3232

3333
import org.glassfish.jersey.internal.inject.InjectionManager;
34-
import org.glassfish.jersey.internal.inject.PerLookup;
35-
import org.glassfish.jersey.internal.util.collection.Ref;
3634
import org.glassfish.jersey.process.internal.RequestScoped;
35+
import org.glassfish.jersey.server.internal.process.RequestProcessingContextReference;
3736
import org.glassfish.jersey.server.ContainerResponse;
3837
import org.glassfish.jersey.server.RequestContextBuilder;
3938
import org.glassfish.jersey.server.ResourceConfig;
40-
import org.glassfish.jersey.server.internal.process.RequestProcessingContext;
4139

4240
import org.glassfish.hk2.api.DescriptorType;
4341
import org.glassfish.hk2.api.DescriptorVisibility;
42+
import org.glassfish.hk2.api.PerLookup;
4443
import org.glassfish.hk2.api.ServiceHandle;
4544
import org.glassfish.hk2.utilities.AbstractActiveDescriptor;
4645
import org.glassfish.hk2.utilities.binding.AbstractBinder;
4746

4847
import org.jvnet.hk2.internal.ServiceHandleImpl;
4948

50-
import org.junit.Ignore;
5149
import org.junit.Test;
5250
import static org.hamcrest.CoreMatchers.containsString;
5351
import static org.hamcrest.CoreMatchers.not;
@@ -139,7 +137,6 @@ public String getParam(@Context MyRequestData param) {
139137
}
140138

141139
@Test
142-
@Ignore("At the time of ignoring this test, ResourceConfig does not support HK2 Binder registering.")
143140
public void testReq() throws Exception {
144141

145142
// bootstrap the test application
@@ -250,16 +247,16 @@ public MyRequestData create(ServiceHandle<?> serviceHandle) {
250247

251248
boolean direct = false;
252249

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>>() {
255252
}.getType());
256253

257254
if (serviceHandle instanceof ServiceHandleImpl) {
258255
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();
261258

262-
if (scopeAnnotation == RequestScoped.class || scopeAnnotation == null) {
259+
if (RequestScoped.class.getName().equals(scopeAnnotation) || scopeAnnotation == null) {
263260
direct = true;
264261
}
265262
}

0 commit comments

Comments
 (0)