Package org.glassfish.jersey.internal.inject

Examples of org.glassfish.jersey.internal.inject.ProviderBinder


        initProviders(locator, Collections.<Class<?>>emptySet(), Collections.<Object>emptySet());
    }

    public static void initProviders(final ServiceLocator locator, final Iterable<Class<?>> providerClasses,
                                     final Iterable<Object> providerInstances) {
        final ProviderBinder providerBinder = new ProviderBinder(locator);
        providerBinder.bindClasses(providerClasses);
        providerBinder.bindInstances(providerInstances);
    }
View Full Code Here


    }

    @Before
    public void setUp() {
        final ServiceLocator locator = Injections.createLocator(new ContextResolverFactory.Binder(), new Binder());
        final ProviderBinder providerBinder = new ProviderBinder(locator);
        providerBinder.bindClasses(Sets.<Class<?>>newHashSet(CustomIntegerResolverC.class));

        crf = locator.getService(ContextResolverFactory.class);
    }
View Full Code Here

    }

    @Test
    public void testProvidersMbr() {
        ServiceLocator locator = Injections.createLocator(initBinders());
        ProviderBinder providerBinder = new ProviderBinder(locator);
        providerBinder.bindClasses(Sets.<Class<?>>newHashSet(MyProvider.class));
        Set<MessageBodyReader> providers = Providers.getCustomProviders(locator, MessageBodyReader.class);
        assertEquals(1, instancesOfType(MyProvider.class, providers).size());
    }
View Full Code Here

    }

    @Test
    public void testProvidersMbw() {
        ServiceLocator locator = Injections.createLocator(initBinders());
        ProviderBinder providerBinder = new ProviderBinder(locator);
        providerBinder.bindClasses(Sets.<Class<?>>newHashSet(MyProvider.class));

        Set<MessageBodyWriter> providers = Providers.getCustomProviders(locator, MessageBodyWriter.class);
        final Collection<MyProvider> myProviders = instancesOfType(MyProvider.class, providers);
        assertEquals(1, myProviders.size());
    }
View Full Code Here

    }

    @Test
    public void testProvidersMbrInstance() {
        ServiceLocator locator = Injections.createLocator(initBinders());
        ProviderBinder providerBinder = new ProviderBinder(locator);
        providerBinder.bindInstances(Sets.<Object>newHashSet(new MyProvider()));
        Set<MessageBodyReader> providers = Providers.getCustomProviders(locator, MessageBodyReader.class);
        assertEquals(1, instancesOfType(MyProvider.class, providers).size());
    }
View Full Code Here

    }

    @Test
    public void testProvidersMbwInstance() {
        ServiceLocator locator = Injections.createLocator(initBinders());
        ProviderBinder providerBinder = new ProviderBinder(locator);
        providerBinder.bindInstances(Sets.newHashSet((Object) new MyProvider()));

        Set<MessageBodyWriter> providers = Providers.getCustomProviders(locator, MessageBodyWriter.class);
        assertEquals(instancesOfType(MyProvider.class, providers).size(), 1);
    }
View Full Code Here

    @Test
    public void testCustomRegistration() {
        ServiceLocator locator = Injections.createLocator();

        ProviderBinder providerBinder = new ProviderBinder(locator);
        providerBinder.bindClasses(Child.class);
        providerBinder.bindClasses(NotFilterChild.class);

        ContainerRequestFilter requestFilter = getRequestFilter(locator);
        ContainerRequestFilter requestFilter2 = getRequestFilter(locator);
        assertEquals(requestFilter, requestFilter2);
View Full Code Here

TOP

Related Classes of org.glassfish.jersey.internal.inject.ProviderBinder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.