Package org.jboss.test.microcontainer.beans

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


      assertNull(TestInterceptorWithDependency.invoked);
   }

   private void checkIntercepted2(Dependency dependency2)
   {
      POJO pojo2 = (POJO) getBean("Intercepted2");
      assertNotNull(pojo2);
      TestAspectWithDependency.invoked = null;
      TestInterceptorWithDependency.invoked = null;
      pojo2.method(2);
      assertNull(TestAspectWithDependency.invoked);
      assertNotNull(TestInterceptorWithDependency.invoked);
      System.out.println(TestInterceptorWithDependency.invoked);
      assertTrue(dependency2 == TestInterceptorWithDependency.invoked);
   }
View Full Code Here


      assertTrue(dependency2 == TestInterceptorWithDependency.invoked);
   }

   private void checkIntercepted3(Dependency dependency1, Dependency dependency2)
   {
      POJO pojo3 = (POJO) getBean("Intercepted3");
      assertNotNull(pojo3);
      TestAspectWithDependency.invoked = null;
      TestInterceptorWithDependency.invoked = null;
      pojo3.method(2);
      assertNotNull(TestAspectWithDependency.invoked);
      assertTrue(dependency1 == TestAspectWithDependency.invoked);
      assertNotNull(TestInterceptorWithDependency.invoked);
      assertTrue(dependency2 == TestInterceptorWithDependency.invoked);
   }
View Full Code Here

      checkNoIntercepted("Intercepted3");
   }

   private void checkNoIntercepted(String name)
   {
      POJO pojo;
      try
      {
         pojo = (POJO) getBean(name);
         fail("'" + name + "' should not be installed yet");
      }
View Full Code Here

      super(name);
   }

   public void testDifferentInstances() throws Exception
   {
      POJO pojo = (POJO)getBean("Intercepted");
     
      TestAspectWithProperty.last = null;
      pojo.method();
      TestAspectWithProperty a1 = TestAspectWithProperty.last;
      assertNotNull(a1);
      assertEquals("PropertyA", a1.getSomeProperty());
     
      TestAspectWithProperty.last = null;
      pojo.method(2);
      TestAspectWithProperty a2 = TestAspectWithProperty.last;
      assertNotNull(a2);
      assertEquals("PropertyB", a2.getSomeProperty());
     
      assertNotSame(a1, a2);
View Full Code Here

         assertNotNull(dependency);
         deploy(getFile1());
         try
         {
            validate();
            POJO pojo = (POJO) getBean("Intercepted");
            assertNotNull(pojo);
            pojo.method(2);
            assertNotNull(TestAspectWithDependency.invoked);
            assertTrue(dependency == TestAspectWithDependency.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);
            pojo.method(2);
            assertTrue(dependency == TestAspectWithDependency.invoked);
         }
         finally
         {
            undeploy(getFile0());
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);
            pojo.method(2);
            assertTrue(dependency == TestAspectWithDependency.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;
            pojo.method(2);
            assertEquals("Interceptor was not rebound", called + 1, TestAspectWithDependency.called);
            assertTrue("Should not be caching the interceptor/dependency across rebinding", dependency == TestAspectWithDependency.invoked);
         }
         finally
         {
View Full Code Here

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

   }

   public void testIntercepted() throws Exception
   {

      POJO pojo = (POJO)getBean("Bean");
      assertTrue(pojo instanceof Advised);
   }
View Full Code Here

      super(name);
   }

   public void testPerClass() throws Exception
   {
      POJO pojo = (POJO)getBean("POJO1A");
      POJO2 pojo2 = (POJO2)getBean("POJO2");
     
      ScopedFactoryAspect.last = null;
      pojo.method();
      ScopedFactoryAspect a1 = ScopedFactoryAspect.last;
      assertNotNull(a1);
     
      ScopedFactoryAspect.last = null;
      pojo2.method();
      ScopedFactoryAspect a2 = ScopedFactoryAspect.last;
      assertNotNull(a2);
      assertNotSame(a1, a2);
     
      ScopedFactoryAspect.last = null;
      pojo.method(3);
      ScopedFactoryAspect a3 = ScopedFactoryAspect.last;
      assertNotNull(a3);
      assertSame(a1, a3);
   }
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.