Package org.jboss.test.microcontainer.support

Examples of org.jboss.test.microcontainer.support.SimpleBean


   public void testInterceptorWithDependencyCorrectOrder() throws Exception
   {
      deploy("InterceptorWithDependencyTestCaseNotAutomatic0.xml");
      try
      {
         SimpleBean dependency = (SimpleBean) getBean("Dependency");
         assertNotNull(dependency);
         deploy("InterceptorWithDependencyTestCaseNotAutomatic1.xml");
         try
         {
            validate();
            SimpleBean bean = (SimpleBean) getBean("Intercepted");
            assertNotNull(bean);
            bean.someMethod();
            assertTrue(dependency == InterceptorWithDependency.intercepted);
         }
         finally
         {
            undeploy("InterceptorWithDependencyTestCaseNotAutomatic1.xml");
View Full Code Here


   public void testInterceptorWithDependencyWrongOrder() throws Exception
   {
      deploy("InterceptorWithDependencyTestCaseNotAutomatic1.xml");
      try
      {
         SimpleBean bean;
         try
         {
            bean = (SimpleBean) getBean("Intercepted");
            fail("'Interceped' should not be installed yet");
         }
         catch (IllegalStateException expected)
         {
         }
        
         bean = (SimpleBean) getBean("Intercepted", ControllerState.DESCRIBED);
         assertNull("This should not be deployed until the interceptor is", bean);
        
         deploy("InterceptorWithDependencyTestCaseNotAutomatic0.xml");
         try
         {
            validate();
            SimpleBean dependency = (SimpleBean) getBean("Dependency");
            assertNotNull(dependency);
            bean = (SimpleBean) getBean("Intercepted");
            assertNotNull(bean);
            bean.someMethod();
            assertTrue(dependency == InterceptorWithDependency.intercepted);
View Full Code Here

   public void testInterceptorWithDependencyRedeploy() throws Exception
   {
      deploy("InterceptorWithDependencyTestCaseNotAutomatic1.xml");
      try
      {
         SimpleBean bean;
         try
         {
            bean = (SimpleBean) getBean("Intercepted");
            fail("Bean should not be installed until the dependency is");
         }
         catch (IllegalStateException expected)
         {
            KernelControllerContext context = getControllerContext("Intercepted", ControllerState.DESCRIBED);
            assertNotNull(context);
         }

         deploy("InterceptorWithDependencyTestCaseNotAutomatic0.xml");
         try
         {
            validate();
            SimpleBean dependency = (SimpleBean) getBean("Dependency");
            assertNotNull(dependency);
            bean = (SimpleBean) getBean("Intercepted");
            assertNotNull(bean);
            bean.someMethod();
            assertTrue(dependency == InterceptorWithDependency.intercepted);
         }
         finally
         {
            undeploy("InterceptorWithDependencyTestCaseNotAutomatic0.xml");
         }
        
         try
         {
            bean = (SimpleBean) getBean("Intercepted");
            fail("Bean should not be installed after the dependency is undeployed");
         }
         catch (IllegalStateException expected)
         {
            KernelControllerContext context = getControllerContext("Intercepted", ControllerState.DESCRIBED);
            assertNotNull(context);
         }

        
         deploy("InterceptorWithDependencyTestCaseNotAutomatic0.xml");
         try
         {
            validate();
            SimpleBean dependency = (SimpleBean) getBean("Dependency");
            assertNotNull(dependency);
            bean = (SimpleBean) getBean("Intercepted");
            assertNotNull(bean);
            bean.someMethod();
            assertTrue("Should not be caching the interceptor/dependency across rebinding", dependency == InterceptorWithDependency.intercepted);
View Full Code Here

   public void testInterceptorWithDependencyRedeploy2() throws Exception
   {
      deploy("InterceptorWithDependencyTestCaseNotAutomatic0.xml");
      try
      {
         SimpleBean dependency = (SimpleBean) getBean("Dependency");
         assertNotNull(dependency);
         deploy("InterceptorWithDependencyTestCaseNotAutomatic1.xml");
         try
         {
            validate();
            SimpleBean bean = (SimpleBean) getBean("Intercepted");
            assertNotNull(bean);
            bean.someMethod();
            assertTrue(dependency == InterceptorWithDependency.intercepted);
         }
         finally
         {
            undeploy("InterceptorWithDependencyTestCaseNotAutomatic1.xml");
         }

         dependency = (SimpleBean) getBean("Dependency");
         assertNotNull(dependency);
         deploy("InterceptorWithDependencyTestCaseNotAutomatic1.xml");
         try
         {
            SimpleBean bean = (SimpleBean) getBean("Intercepted");
            assertNotNull(bean);
            bean.someMethod();
            assertTrue(dependency == InterceptorWithDependency.intercepted);
         }
         finally
         {
            undeploy("InterceptorWithDependencyTestCaseNotAutomatic1.xml");
View Full Code Here

      InterceptorWithDependency.intercepted = null;
      deploy("ConstructorInterceptorWithDependencyTestCaseNotAutomatic0.xml");
      try
      {
         assertNull(InterceptorWithDependency.intercepted);
         SimpleBean dependency = (SimpleBean) getBean("Dependency");
         assertNotNull(dependency);
         deploy("ConstructorInterceptorWithDependencyTestCaseNotAutomatic1.xml");
         try
         {
            validate();
            SimpleBean bean = (SimpleBean) getBean("Intercepted");
            assertNotNull(bean);
            assertTrue(dependency == InterceptorWithDependency.intercepted);
         }
         finally
         {
View Full Code Here

   {
      InterceptorWithDependency.intercepted = null;
      deploy("ConstructorInterceptorWithDependencyTestCaseNotAutomatic1.xml");
      try
      {
         SimpleBean bean;
         try
         {
            bean = (SimpleBean) getBean("Intercepted");
            fail("'Interceped' should not be installed yet");
         }
         catch (IllegalStateException expected)
         {
         }
        
         bean = (SimpleBean) getBean("Intercepted", ControllerState.DESCRIBED);
         assertNull("This should not be deployed until the interceptor is", bean);
         assertNull(InterceptorWithDependency.intercepted);
        
         deploy("ConstructorInterceptorWithDependencyTestCaseNotAutomatic0.xml");
         try
         {
            validate();
            SimpleBean dependency = (SimpleBean) getBean("Dependency");
            assertNotNull(dependency);
            bean = (SimpleBean) getBean("Intercepted");
            assertNotNull(bean);
            assertTrue(dependency == InterceptorWithDependency.intercepted);
         }
View Full Code Here

   {
      InterceptorWithDependency.intercepted = null;
      deploy("ConstructorInterceptorWithDependencyTestCaseNotAutomatic1.xml");
      try
      {
         SimpleBean bean;
         try
         {
            bean = (SimpleBean) getBean("Intercepted");
            fail("Bean should not be installed until the dependency is");
         }
         catch (IllegalStateException expected)
         {
            KernelControllerContext context = getControllerContext("Intercepted", ControllerState.DESCRIBED);
            assertNotNull(context);
         }
         assertNull(InterceptorWithDependency.intercepted);

         deploy("ConstructorInterceptorWithDependencyTestCaseNotAutomatic0.xml");
         try
         {
            validate();
            SimpleBean dependency = (SimpleBean) getBean("Dependency");
            assertNotNull(dependency);
            bean = (SimpleBean) getBean("Intercepted");
            assertNotNull(bean);
            assertTrue(dependency == InterceptorWithDependency.intercepted);
         }
         finally
         {
            InterceptorWithDependency.intercepted = null;
            undeploy("ConstructorInterceptorWithDependencyTestCaseNotAutomatic0.xml");
         }
        
         try
         {
            bean = (SimpleBean) getBean("Intercepted");
            fail("Bean should not be installed after the dependency is undeployed");
         }
         catch (IllegalStateException expected)
         {
            KernelControllerContext context = getControllerContext("Intercepted", ControllerState.DESCRIBED);
            assertNotNull(context);
         }

        
         assertNull(InterceptorWithDependency.intercepted);
         deploy("ConstructorInterceptorWithDependencyTestCaseNotAutomatic0.xml");
         try
         {
            validate();
            SimpleBean dependency = (SimpleBean) getBean("Dependency");
            assertNotNull(dependency);
            bean = (SimpleBean) getBean("Intercepted");
            assertNotNull(bean);
            assertTrue("Should not be caching the interceptor/dependency across rebinding", dependency == InterceptorWithDependency.intercepted);
         }
View Full Code Here

   {
      InterceptorWithDependency.intercepted = null;
      deploy("ConstructorInterceptorWithDependencyTestCaseNotAutomatic0.xml");
      try
      {
         SimpleBean dependency = (SimpleBean) getBean("Dependency");
         assertNotNull(dependency);
         deploy("ConstructorInterceptorWithDependencyTestCaseNotAutomatic1.xml");
         try
         {
            validate();
            SimpleBean bean = (SimpleBean) getBean("Intercepted");
            assertNotNull(bean);
            assertTrue(dependency == InterceptorWithDependency.intercepted);
         }
         finally
         {
            InterceptorWithDependency.intercepted = null;
            undeploy("ConstructorInterceptorWithDependencyTestCaseNotAutomatic1.xml");
         }
         assertNull(InterceptorWithDependency.intercepted);
        
         dependency = (SimpleBean) getBean("Dependency");
         assertNotNull(dependency);
         deploy("ConstructorInterceptorWithDependencyTestCaseNotAutomatic1.xml");
         try
         {
            SimpleBean bean = (SimpleBean) getBean("Intercepted");
            assertNotNull(bean);
            bean.someMethod();
            assertTrue(dependency == InterceptorWithDependency.intercepted);
         }
         finally
         {
            undeploy("ConstructorInterceptorWithDependencyTestCaseNotAutomatic1.xml");
View Full Code Here

      super(name);
   }
  
   public void testIntercepted()
   {
      SimpleBean bean = (SimpleBean) getBean("Intercepted");
      CalledInterceptor.intercepted = false;
      bean.someMethod();
      assertTrue("Should have invoked the CalledInterceptor", CalledInterceptor.intercepted);
   }
View Full Code Here

         checkNotInstalledAndDescribed("NotDeployable2");

         deploy(getDependency1DD());
         try
         {
            SimpleBean dependency1 = (SimpleBean) getBean("Dependency1");
            assertNotNull(dependency1);
            checkInterceptedAndInjected("Depends1", "A", dependency1);
            checkInterceptedAndInjected("Depends1", "B", dependency1);
            checkNotInstalledAndDescribed("Depends2");
            checkNotInstalledAndDescribed("Depends1And2");
            checkNotInstalledAndDescribed("NotDeployable");
            checkNotInstalledAndDescribed("NotDeployable1");
            checkNotInstalledAndDescribed("NotDeployable2");

         }
         finally
         {
            undeploy(getDependency1DD());
            checkNotInstalledAndDescribed("Depends1");
            checkNotInstalledAndDescribed("Depends2");
            checkNotInstalledAndDescribed("Depends1And2");
            checkNotInstalledAndDescribed("NotDeployable");
            checkNotInstalledAndDescribed("NotDeployable1");
            checkNotInstalledAndDescribed("NotDeployable2");
         }

         deploy(getDependency2DD());
         try
         {
            SimpleBean dependency2 = (SimpleBean) getBean("Dependency2");
            assertNotNull(dependency2);
            checkNotInstalledAndDescribed("Depends1");
            checkInterceptedAndInjected("Depends2", "A", dependency2);
            checkInterceptedAndInjected("Depends2", "B", dependency2);
            checkNotInstalledAndDescribed("Depends1And2");
            checkNotInstalledAndDescribed("NotDeployable");
            checkNotInstalledAndDescribed("NotDeployable1");
            checkNotInstalledAndDescribed("NotDeployable2");

         }
         finally
         {
            undeploy(getDependency2DD());
            checkNotInstalledAndDescribed("Depends1");
            checkNotInstalledAndDescribed("Depends2");
            checkNotInstalledAndDescribed("Depends1And2");
            checkNotInstalledAndDescribed("NotDeployable");
            checkNotInstalledAndDescribed("NotDeployable1");
            checkNotInstalledAndDescribed("NotDeployable2");
         }

         deploy(getDependency1DD());
         deploy(getDependency2DD());
         try
         {
            SimpleBean dependency1 = (SimpleBean) getBean("Dependency1");
            assertNotNull(dependency1);
            SimpleBean dependency2 = (SimpleBean) getBean("Dependency2");
            assertNotNull(dependency2);
            checkInterceptedAndInjected("Depends1", "A", dependency1);
            checkInterceptedAndInjected("Depends1", "B", dependency1);
            checkInterceptedAndInjected("Depends2", "A", dependency2);
            checkInterceptedAndInjected("Depends2", "B", dependency2);
View Full Code Here

TOP

Related Classes of org.jboss.test.microcontainer.support.SimpleBean

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.