Package org.jboss.test.microcontainer.beans

Examples of org.jboss.test.microcontainer.beans.POJO


   }

   public void testIntercepted() throws Exception
   {
      TestInterceptor.invoked = false;
      POJO pojo = (POJO)getBean("Bean");
      int ret = pojo.method(2);
      assertEquals(4, ret);
      assertTrue(TestInterceptor.invoked);
   }
View Full Code Here


      checkXml(element, "metadata-loader", "somexml", "hello");
   }

   public void testAspectInterceptorAndDynamicCFlow()
   {
      POJO pojo = (POJO)getBean("Bean");
      pojo.defaultMethod();
      assertTrue(XmlLoadableAspect.intercepted);
      assertTrue(XmlLoadableInterceptor.intercepted);
     
      Element element = XmlLoadableAspect.interceptedElement;
      checkXml(element, "aspect", "somexml", "hello");
View Full Code Here

      super(name);
   }

   public void testPerVm() throws Exception
   {
      POJO pojo = (POJO)getBean("POJO1A");
      POJO2 pojo2 = (POJO2)getBean("POJO2");
  
      PerVmAspect.last = null;
      pojo.method();
      PerVmAspect a1 = PerVmAspect.last;
      assertNotNull(a1);
     
      PerVmAspect.last = null;
      pojo2.method();
      PerVmAspect a2 = PerVmAspect.last;
      assertNotNull(a2);
      assertSame(a1, a2);
     
      PerVmAspect.last = null;
      pojo.method(3);
      PerVmAspect a3 = PerVmAspect.last;
      assertNotNull(a3);
      assertSame(a1, a3);
   }
View Full Code Here

      assertSame(a1, a3);
   }

   public void testPerClass() throws Exception
   {
      POJO pojo = (POJO)getBean("POJO1A");
      POJO2 pojo2 = (POJO2)getBean("POJO2");
     
      PerClassAspect.last = null;
      pojo.method();
      PerClassAspect a1 = PerClassAspect.last;
      assertNotNull(a1);
     
      PerClassAspect.last = null;
      pojo2.method();
      PerClassAspect a2 = PerClassAspect.last;
      assertNotNull(a2);
      assertNotSame(a1, a2);
     
      PerClassAspect.last = null;
      pojo.method(3);
      PerClassAspect a3 = PerClassAspect.last;
      assertNotNull(a3);
      assertSame(a1, a3);
   }
View Full Code Here

      assertSame(a1, a3);
   }

   public void testPerInstance() throws Exception
   {
      POJO pojoA = (POJO)getBean("POJO1A");
      POJO pojoB = (POJO)getBean("POJO1B");
      POJO2 pojo2 = (POJO2)getBean("POJO2");
     
      PerInstanceAspect.last = null;
      pojoA.method();
      PerInstanceAspect a1 = PerInstanceAspect.last;
      assertNotNull(a1);
     
      PerInstanceAspect.last = null;
      pojoA.method(2);
      PerInstanceAspect a2 = PerInstanceAspect.last;
      assertNotNull(a2);
      assertSame(a1, a2);
     
      PerInstanceAspect.last = null;
      pojoB.method();
      PerInstanceAspect a3 = PerInstanceAspect.last;
      assertNotNull(a3);
      assertNotSame(a3, a2);
     
      PerInstanceAspect.last = null;
      pojoB.method(4);
      PerInstanceAspect a4 = PerInstanceAspect.last;
      assertNotNull(a4);
      assertSame(a3, a4);
     
      PerInstanceAspect.last = null;
View Full Code Here

      assertSame(a5, a6);
   }

   public void testPerJoinPoint() throws Exception
   {
      POJO pojoA = (POJO)getBean("POJO1A");
      POJO pojoB = (POJO)getBean("POJO1B");
      POJO2 pojo2 = (POJO2)getBean("POJO2");
  
      PerJoinPointAspect.last = null;
      pojoA.method();
      PerJoinPointAspect a1 = PerJoinPointAspect.last;
      assertNotNull(a1);
     
      PerJoinPointAspect.last = null;
      pojoA.method(1);
      PerJoinPointAspect a2 = PerJoinPointAspect.last;
      assertNotNull(a2);
     
      PerJoinPointAspect.last = null;
      pojoB.method();
      PerJoinPointAspect a3 = PerJoinPointAspect.last;
      assertNotNull(a3);
     
      PerJoinPointAspect.last = null;
      pojoB.method(1);
      PerJoinPointAspect a4 = PerJoinPointAspect.last;
      assertNotNull(a4);
     
      PerJoinPointAspect.last = null;
      pojo2.method();
View Full Code Here

*/
public abstract class ClassMetaDataTest extends AOPMicrocontainerTest
{
   public void testMetaData() throws Exception
   {
      POJO pojo = (POJO)getBean("Bean");
      assertNotNull(pojo);
     
      assertInvokedLastAndClass("ctor");
     
      TestClassMetaDataAspect.reset();
      pojo.method(2);
      assertInvokedLastAndClass("method1");
     
      TestClassMetaDataAspect.reset();
      pojo.method();
      assertInvokedLastAndClass("method2");
     
      TestClassMetaDataAspect.reset();
      pojo.defaultMethod();
      assertInvokedLastAndClass("default");
     
   }
View Full Code Here

         assertNotNull(dependency);
         deploy(getFile1());
         try
         {
            validate();
            POJO pojo = (POJO) getBean("Intercepted");
            assertNotNull(pojo);
            TestAspectWithDependency.invoked = null;
            TestInterceptor.invoked = false;
            pojo.method(2);
            assertNotNull(TestAspectWithDependency.invoked);
            assertTrue(dependency == TestAspectWithDependency.invoked);
            assertTrue(TestInterceptor.invoked);
         }
         finally
View Full Code Here

   public void testInterceptorWithDependencyWrongOrder() throws Exception
   {
      deploy(getFile1());
      try
      {
         POJO pojo;
         try
         {
            pojo = (POJO) getBean("Intercepted");
            fail("'Interceped' should not be installed yet");
         }
         catch (IllegalStateException expected)
         {
         }
        
         pojo = (POJO) getBean("Intercepted", ControllerState.DESCRIBED);
         assertNull("This should not be deployed until the interceptor is", pojo);
        
         deploy(getFile0());
         try
         {
            validate();
            Dependency dependency = (Dependency) getBean("Dependency");
            assertNotNull(dependency);
            pojo = (POJO) getBean("Intercepted");
            assertNotNull(pojo);
            TestAspectWithDependency.invoked = null;
            TestInterceptor.invoked = false;
            pojo.method(2);
            assertTrue(dependency == TestAspectWithDependency.invoked);
            assertTrue(TestInterceptor.invoked);
         }
         finally
         {
View Full Code Here

   public void testInterceptorWithDependencyRedeploy() throws Exception
   {
      deploy(getFile1());
      try
      {
         POJO pojo;
         try
         {
            pojo = (POJO) getBean("Intercepted");
            fail("Bean should not be installed until the dependency is");
         }
         catch (IllegalStateException expected)
         {
            KernelControllerContext context = getControllerContext("Intercepted", ControllerState.DESCRIBED);
            assertNotNull(context);
         }
  
         deploy(getFile0());
         try
         {
            validate();
            Dependency dependency = (Dependency) getBean("Dependency");
            assertNotNull(dependency);
            pojo = (POJO) getBean("Intercepted");
            assertNotNull(pojo);
            TestAspectWithDependency.invoked = null;
            TestInterceptor.invoked = false;
            pojo.method(2);
            assertTrue(dependency == TestAspectWithDependency.invoked);
            assertTrue(TestInterceptor.invoked);
         }
         finally
         {
            undeploy(getFile0());
         }
        
         try
         {
            pojo = (POJO) 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(getFile0());
         try
         {
            validate();
            Dependency dependency = (Dependency) getBean("Dependency");
            assertNotNull(dependency);
            pojo = (POJO) getBean("Intercepted");
            assertNotNull(pojo);
            int called = TestAspectWithDependency.called;
            TestInterceptor.invoked = false;
            pojo.method(2);
            assertTrue("Interceptor was not rebound", called + 1 == TestAspectWithDependency.called);
            assertTrue("Should not be caching the interceptor/dependency across rebinding", dependency == TestAspectWithDependency.invoked);
            assertTrue(TestInterceptor.invoked);
         }
         finally
View Full Code Here

TOP

Related Classes of org.jboss.test.microcontainer.beans.POJO

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.