Examples of ManagerImpl


Examples of org.apache.webbeans.container.ManagerImpl

   
    private ManagerImpl rootManager = null;

    public WebBeansLifeCycle()
    {
        this.rootManager = new ManagerImpl();
        this.xmlDeployer = new WebBeansXMLConfigurator();
        this.deployer = new WebBeansContainerDeployer(xmlDeployer);
        this.jndiService = ServiceLoader.getService(JNDIService.class);
       
        rootManager.setXMLConfigurator(this.xmlDeployer);
View Full Code Here

Examples of org.apache.webbeans.container.ManagerImpl

   
    private void validateInjectionPoints()
    {
        logger.info("Validation of injection points are started");

        ManagerImpl manager = ManagerImpl.getManager();       
        Set<Bean<?>> beans = new HashSet<Bean<?>>();
       
        //Adding decorators to validate
        Set<Decorator> decorators = manager.getDecorators();
        for(Decorator decorator : decorators)
        {
            WebBeansDecorator wbDec = (WebBeansDecorator)decorator;
            beans.add(wbDec.getDelegateComponent());
        }
       
       
        logger.info("Validation of the decorator's injection points are started");
       
        //Validate Decorators
        validate(beans);
       
        beans.clear();
       
        //Adding interceptors to validate
        Set<javax.inject.manager.Interceptor> interceptors = manager.getInterceptors();
        for(javax.inject.manager.Interceptor interceptor : interceptors)
        {
            WebBeansInterceptor wbInt = (WebBeansInterceptor)interceptor;
            beans.add(wbInt.getDelegate());
        }
View Full Code Here

Examples of org.apache.webbeans.container.ManagerImpl

     * @return the newly created Simple WebBean Component
     * @throws WebBeansConfigurationException if any configuration exception occurs
     */
    public static <T> ComponentImpl<T> define(Class<T> clazz, WebBeansType type) throws WebBeansConfigurationException
    {
        ManagerImpl manager = ManagerImpl.getManager();

        checkSimpleWebBeanCondition(clazz);

        ComponentImpl<T> component = new ComponentImpl<T>(clazz, type);

        DefinitionUtil.defineSerializable(component);
        DefinitionUtil.defineStereoTypes(component, clazz.getDeclaredAnnotations());

        Class<? extends Annotation> deploymentType = DefinitionUtil.defineDeploymentType(component, clazz.getDeclaredAnnotations(), "There are more than one @DeploymentType annotation in Simple WebBean Component implementation class : " + component.getReturnType().getName());

        // Check if the deployment type is enabled.
        if (!WebBeansUtil.isDeploymentTypeEnabled(deploymentType))
        {
            return null;
        }

        Annotation[] clazzAnns = clazz.getDeclaredAnnotations();

        DefinitionUtil.defineApiTypes(component, clazz);
        DefinitionUtil.defineScopeType(component, clazzAnns, "Simple WebBean Component implementation class : " + clazz.getName() + " stereotypes must declare same @ScopeType annotations");
        WebBeansUtil.checkPassivationScope(component, component.getScopeType().getAnnotation(ScopeType.class));
        DefinitionUtil.defineBindingTypes(component, clazzAnns);
        DefinitionUtil.defineName(component, clazzAnns, WebBeansUtil.getSimpleWebBeanDefaultName(clazz.getSimpleName()));

        Constructor<T> constructor = WebBeansUtil.defineConstructor(clazz);
        component.setConstructor(constructor);
        DefinitionUtil.addConstructorInjectionPointMetaData(component, constructor);

        WebBeansUtil.checkSteroTypeRequirements(component, clazz.getDeclaredAnnotations(), "Simple WebBean Component implementation class : " + clazz.getName());

        Set<ProducerComponentImpl<?>> producerComponents = DefinitionUtil.defineProducerMethods(component);
        manager.getBeans().addAll(producerComponents);

        Set<ProducerFieldComponent<?>> producerFields = DefinitionUtil.defineProduerFields(component);
        manager.getBeans().addAll(producerFields);

        DefinitionUtil.defineDisposalMethods(component);
        DefinitionUtil.defineInjectedFields(component);
        DefinitionUtil.defineInjectedMethods(component);
        DefinitionUtil.defineObserverMethods(component, clazz);
View Full Code Here

Examples of org.jboss.arquillian.impl.core.ManagerImpl

{

   @Test
   public void shouldBeAbleToDoStaticInjection() throws Exception
   {
      ManagerImpl manager = ManagerBuilder.from()
         .extension(TestObserver.class).create();
     
      manager.getContext(ApplicationContextImpl.class).getObjectStore()
         .add(Object.class, new Object());
     
      manager.fire("test event");
     
      Assert.assertTrue(manager.getExtension(TestObserver.class).wasCalled);
   }
View Full Code Here

Examples of org.jboss.arquillian.impl.core.ManagerImpl

public class ManagerImplTestCase
{
   @Test
   public void shouldBeAbleToRegisterContextAndExtensions() throws Exception
   {
      ManagerImpl manager = ManagerBuilder.from()
         .context(SuiteContextImpl.class)
         .extension(TestExtension.class).create();

      SuiteContext context = manager.getContext(SuiteContext.class);
      try
      {
         context.activate();
         // bind something to the context so our Instance<Object> is resolved
         context.getObjectStore().add(Object.class, new Object());
        
         manager.fire("some string");
        
         Assert.assertTrue(manager.getExtension(TestExtension.class).wasCalled);
        
      }
      finally
      {
         context.deactivate();
View Full Code Here

Examples of org.jboss.arquillian.impl.core.ManagerImpl

   }

   @Test
   public void shouldBindToTheScopedContext() throws Exception
   {
      ManagerImpl manager = ManagerBuilder.from()
         .context(SuiteContextImpl.class)
         .context(ClassContextImpl.class).create();

      SuiteContext suiteContext = manager.getContext(SuiteContext.class);
      ClassContext classContext = manager.getContext(ClassContext.class);

      try
      {
         suiteContext.activate();
         classContext.activate(this.getClass());
        
         Object testObject = new Object();
        
         manager.bind(SuiteScoped.class, Object.class, testObject);
        
         Assert.assertEquals(
               "Verify value was bound to the correct context",
               testObject,
               suiteContext.getObjectStore().get(Object.class));
View Full Code Here

Examples of org.jboss.arquillian.impl.core.ManagerImpl

   }
  
   @Test
   public void shouldResolveToNullIfNoActiveContexts() throws Exception
   {
      ManagerImpl manager = ManagerBuilder.from().create();
      Assert.assertNull(manager.resolve(Object.class));
   }
View Full Code Here

Examples of org.jboss.arquillian.impl.core.ManagerImpl

   }
  
   @Test
   public void shouldResolveToNullContextIfNotFound() throws Exception
   {
      ManagerImpl manager = ManagerBuilder.from().create();
      Assert.assertNull(manager.getContext(SuiteContextImpl.class));
   }
View Full Code Here

Examples of org.jboss.arquillian.impl.core.ManagerImpl

   }

   @Test
   public void shouldResolveToNullExtensionIfNotFound() throws Exception
   {
      ManagerImpl manager = ManagerBuilder.from().create();
      Assert.assertNull(manager.getExtension(SuiteContextImpl.class));
   }
View Full Code Here

Examples of org.jboss.arquillian.impl.core.ManagerImpl

   {
      final String testEvent = "test";
     
      TestNonManagedObserver observer = new TestNonManagedObserver();
     
      ManagerImpl manager = ManagerBuilder.from().create();
      manager.fire(testEvent, observer);
     
      Assert.assertNotNull(
            "NonManagedObserver should have been called",
            TestNonManagedObserver.firedEvent);
      Assert.assertEquals(
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.