Package org.jboss.weld.resources

Examples of org.jboss.weld.resources.SharedObjectCache


    class CustomInjectionPoint implements InjectionPoint {
        private final EnhancedAnnotatedField<CustomWindowFrame, ?> windowField;

        public CustomInjectionPoint() {
            TypeStore ts = new TypeStore();
            ClassTransformer transformer = new ClassTransformer(ts, new SharedObjectCache(), ReflectionCacheFactory.newInstance(ts), RegistrySingletonProvider.STATIC_INSTANCE);
            EnhancedAnnotatedType<?> targetClass = transformer.getEnhancedAnnotatedType(CustomWindowFrame.class, AnnotatedTypeIdentifier.NULL_BDA_ID);
            windowField = targetClass.getDeclaredEnhancedField("window");
        }
View Full Code Here


    @Test
    public void testInterceptorModel() {
        TypeStore typeStore = new TypeStore();
        InterceptorBindingModel<SecondaryInterceptionBinding> interceptorBindingModel
                = new InterceptorBindingModel<SecondaryInterceptionBinding>(new ClassTransformer(typeStore, new SharedObjectCache(), ReflectionCacheFactory.newInstance(typeStore), RegistrySingletonProvider.STATIC_INSTANCE).getEnhancedAnnotation(SecondaryInterceptionBinding.class));
        Set<Annotation> annotations = interceptorBindingModel.getInheritedInterceptionBindingTypes();
        assert annotations.size() != 0;
    }
View Full Code Here

    * description = "WELD-568"
    */
    @Test
    public void testWeldClassForGenericSuperclass() {
        TypeStore ts = new TypeStore();
        EnhancedAnnotatedType<StringProcessor> weldClass = new ClassTransformer(ts, new SharedObjectCache(), ReflectionCacheFactory.newInstance(ts), RegistrySingletonProvider.STATIC_INSTANCE).getEnhancedAnnotatedType(StringProcessor.class, AnnotatedTypeIdentifier.NULL_BDA_ID);
        Collection<EnhancedAnnotatedMethod<?, ? super StringProcessor>> methods = weldClass.getEnhancedMethods();
        //assert methods.size() == 2;
        List<EnhancedAnnotatedMethod<?, ?>> interceptableMethods = Beans.getInterceptableMethods(weldClass);
        Assert.assertEquals(3, interceptableMethods.size());
    }
View Full Code Here

    @BeforeMethod
    public void beforeMethod() {
        BeanIdentifierIndex beanIdentifierIndex = new BeanIdentifierIndex();
        beanIdentifierIndex.build(Collections.<Bean<?>>emptySet());
        this.typeStore = new TypeStore();
        this.classTransformer = new ClassTransformer(typeStore, new SharedObjectCache(), ReflectionCacheFactory.newInstance(typeStore), RegistrySingletonProvider.STATIC_INSTANCE);
        this.services = new SimpleServiceRegistry();
        this.services.add(MetaAnnotationStore.class, new MetaAnnotationStore(classTransformer));
        this.services.add(ContextualStore.class, new ContextualStoreImpl(STATIC_INSTANCE, beanIdentifierIndex));
        this.services.add(ClassTransformer.class, classTransformer);
        this.services.add(SharedObjectCache.class, new SharedObjectCache());
        this.services.add(GlobalObserverNotifierService.class, new GlobalObserverNotifierService(services, RegistrySingletonProvider.STATIC_INSTANCE));
        this.services.add(InjectionTargetService.class, new InjectionTargetService(BeanManagerImpl.newRootManager(STATIC_INSTANCE, "foo", services)));
        this.services.add(SpecializationAndEnablementRegistry.class, new SpecializationAndEnablementRegistry());
        this.services.add(InterceptorsApiAbstraction.class, new InterceptorsApiAbstraction(DefaultResourceLoader.INSTANCE));
    }
View Full Code Here

     */
    @Test
    public void testComparison() throws SecurityException, NoSuchFieldException, NoSuchMethodException {
        //check that two weld classes on the same underlying are equal
        TypeStore ts = new TypeStore();
        ClassTransformer ct = new ClassTransformer(ts, new SharedObjectCache(), ReflectionCacheFactory.newInstance(ts), RegistrySingletonProvider.STATIC_INSTANCE);
        EnhancedAnnotatedType<Chair> chair1 = EnhancedAnnotatedTypeImpl.of(BackedAnnotatedType.of(Chair.class, ct.getSharedObjectCache(), ct.getReflectionCache(), RegistrySingletonProvider.STATIC_INSTANCE, AnnotatedTypeIdentifier.NULL_BDA_ID), ct);
        EnhancedAnnotatedType<Chair> chair2 = EnhancedAnnotatedTypeImpl.of(BackedAnnotatedType.of(Chair.class, ct.getSharedObjectCache(), ct.getReflectionCache(), RegistrySingletonProvider.STATIC_INSTANCE, AnnotatedTypeIdentifier.NULL_BDA_ID), ct);
        Assert.assertTrue(AnnotatedTypes.compareAnnotatedTypes(chair1, chair2));

        //check that a different implementation of annotated type is equal to the weld implementation
View Full Code Here

    */
    @Category(Broken.class)
    @Test
    public void testWeldClassForCovariantReturnType() {
        TypeStore typeStore = new TypeStore();
        EnhancedAnnotatedType<Attacker> weldClass = new ClassTransformer(typeStore, new SharedObjectCache(), ReflectionCacheFactory.newInstance(typeStore), RegistrySingletonProvider.STATIC_INSTANCE).getEnhancedAnnotatedType(Attacker.class, AnnotatedTypeIdentifier.NULL_BDA_ID);
        Collection<EnhancedAnnotatedMethod<?, ? super Attacker>> methods = weldClass.getEnhancedMethods();
        Assert.assertEquals(4, methods.size());
        List<EnhancedAnnotatedMethod<?, ?>> interceptableMethods = Beans.getInterceptableMethods(weldClass);
        Assert.assertEquals(4, interceptableMethods.size());
    }
View Full Code Here

        if (initialServices.contains(TypeStore.class)) {
            return;
        }
        // instantiate initial services which we need for this phase
        TypeStore store = new TypeStore();
        SharedObjectCache cache = new SharedObjectCache();
        ReflectionCache reflectionCache = ReflectionCacheFactory.newInstance(store);
        ClassTransformer classTransformer = new ClassTransformer(store, cache, reflectionCache, contextId);
        initialServices.add(TypeStore.class, store);
        initialServices.add(SharedObjectCache.class, cache);
        initialServices.add(ReflectionCache.class, reflectionCache);
View Full Code Here

TOP

Related Classes of org.jboss.weld.resources.SharedObjectCache

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.