use of org.glassfish.jersey.internal.inject.InjectionManager in project jersey by jersey.
the class ProviderBinderTest method testProvidersMbr.
@Test
public void testProvidersMbr() {
InjectionManager injectionManager = Injections.createInjectionManager(initBinders());
ProviderBinder providerBinder = new ProviderBinder(injectionManager);
providerBinder.bindClasses(Collections.singleton(MyProvider.class));
Set<MessageBodyReader> providers = Providers.getCustomProviders(injectionManager, MessageBodyReader.class);
assertEquals(1, instancesOfType(MyProvider.class, providers).size());
}
use of org.glassfish.jersey.internal.inject.InjectionManager in project jersey by jersey.
the class ProviderBinderTest method testProvidersMbrInstance.
@Test
public void testProvidersMbrInstance() {
InjectionManager injectionManager = Injections.createInjectionManager(initBinders());
ProviderBinder providerBinder = new ProviderBinder(injectionManager);
providerBinder.bindInstances(Collections.singleton(new MyProvider()));
Set<MessageBodyReader> providers = Providers.getCustomProviders(injectionManager, MessageBodyReader.class);
assertEquals(1, instancesOfType(MyProvider.class, providers).size());
}
use of org.glassfish.jersey.internal.inject.InjectionManager in project jersey by jersey.
the class InjectionManagerTest method testRegisterUnknownProvider.
@Test(expected = IllegalArgumentException.class)
public void testRegisterUnknownProvider() {
InjectionManager injectionManager = new HK2InjectionManager();
injectionManager.initialize();
injectionManager.register(new Object());
}
use of org.glassfish.jersey.internal.inject.InjectionManager in project jersey by jersey.
the class InjectionManagerTest method testInjectionManagerParent.
@Test
public void testInjectionManagerParent() {
ClassBinding<EnglishGreeting> greetingBinding = Bindings.serviceAsContract(EnglishGreeting.class);
InjectionManager parentInjectionManager = new HK2InjectionManager();
parentInjectionManager.initialize();
parentInjectionManager.register(greetingBinding);
InjectionManager injectionManager = new HK2InjectionManager();
injectionManager.initialize(parentInjectionManager);
assertNotNull(injectionManager.getInstance(EnglishGreeting.class));
}
use of org.glassfish.jersey.internal.inject.InjectionManager in project jersey by jersey.
the class InjectionManagerTest method testUnknownParent.
@Test(expected = IllegalArgumentException.class)
public void testUnknownParent() {
InjectionManager parentInjectionManager = new HK2InjectionManager();
parentInjectionManager.initialize(new Object());
Injections.createInjectionManager(parentInjectionManager);
}
Aggregations