Package org.jboss.test.microcontainer.matrix

Examples of org.jboss.test.microcontainer.matrix.Child


   public void testAdvisedChild() throws Exception
   {
      String name = DynamicAspectDeployer.addBinding("execution(* org.jboss.test.microcontainer.matrix.Base->*(..))", TestInterceptor.class);
      try
      {
         Child plainChild = new Child();
         assertTrue(plainChild instanceof Advised);
         assertFalse(plainChild instanceof AspectManaged);
        
         TestInterceptor.reset();
         plainChild.baseOnly();
         assertEquals(0, TestInterceptor.interceptions);
  
         TestInterceptor.reset();
         plainChild.childOnly();
         assertEquals(1, TestInterceptor.interceptions);
  
         TestInterceptor.reset();
         plainChild.baseOverridden();
         assertEquals(1, TestInterceptor.interceptions);
      }
      finally
      {
         DynamicAspectDeployer.removeBinding(name);
View Full Code Here


      String name = DynamicAspectDeployer.addBinding("execution(* org.jboss.test.microcontainer.matrix.Base->*(..))", TestInterceptor.class);
      Object proxy = null;
      try
      {
  
         Child proxiedChild = new Child();
         assertTrue(proxiedChild instanceof Advised);
         assertFalse(proxiedChild instanceof AspectManaged);
  
         System.out.println("=======> Creating proxy");
         proxy = createProxy(proxiedChild, new Class[] {ChildInterface.class});
View Full Code Here

   {
      Base base = (Base)getBean("Base");
      assertFalse(base instanceof Advised);
      assertFalse(base instanceof AspectManaged);

      Child child = (Child)getBean("Child");
      assertFalse(child instanceof Advised);
      assertFalse(child instanceof AspectManaged);
   }
View Full Code Here

      assertEquals(0, TestInterceptor.interceptions);
   }
  
   public void testAdvisedChild() throws Exception
   {
      Child plainChild = (Child)getBean("PlainChild");
      assertTrue(plainChild instanceof Advised);
      assertFalse(plainChild instanceof AspectManaged);
     
      TestInterceptor.reset();
      plainChild.baseOnly();
      assertEquals(1, TestInterceptor.interceptions);

      TestInterceptor.reset();
      plainChild.childOnly();
      assertEquals(1, TestInterceptor.interceptions);

      TestInterceptor.reset();
      plainChild.baseOverridden();
      assertEquals(1, TestInterceptor.interceptions);
   }
View Full Code Here

   private static final int EXPECTED_ANNNOTATED_CHILD_ONLY = 2;
   private static final int EXPECTED_ANNNOTATED_CHILD_BASEOVERRIDDEN = 2;
  
   public void testProxiedAndAdvisedChild() throws Exception
   {
      Child proxiedChild = (Child)getBean("ProxiedChild");
      assertTrue(proxiedChild instanceof Advised);
      assertTrue(proxiedChild instanceof AspectManaged);

      TestInterceptor.reset();
      proxiedChild.baseOnly();
      assertEquals(EXPECTED_ANNNOTATED_CHILD_BASEONLY_PROXY, TestInterceptor.interceptions);

      TestInterceptor.reset();
      proxiedChild.childOnly();
      assertEquals(EXPECTED_ANNNOTATED_CHILD_ONLY, TestInterceptor.interceptions);

      TestInterceptor.reset();
      proxiedChild.baseOverridden();
      assertEquals(EXPECTED_ANNNOTATED_CHILD_BASEOVERRIDDEN, TestInterceptor.interceptions);
   }
View Full Code Here

      assertEquals(0, TestInterceptor.interceptions);
   }
  
   public void testPlainChild() throws Exception
   {
      Child plainChild = (Child)getBean("PlainChild");
      assertFalse(plainChild instanceof Advised);
      assertFalse(plainChild instanceof AspectManaged);
     
      TestInterceptor.reset();
      plainChild.baseOnly();
      assertEquals(0, TestInterceptor.interceptions);

      TestInterceptor.reset();
      plainChild.childOnly();
      assertEquals(0, TestInterceptor.interceptions);

      TestInterceptor.reset();
      plainChild.baseOverridden();
      assertEquals(0, TestInterceptor.interceptions);
   }
View Full Code Here

   private static final int EXPECTED_ANNNOTATED_CHILD_ONLY = 1;
   private static final int EXPECTED_ANNNOTATED_CHILD_BASEOVERRIDDEN = 1;

   public void testProxiedChild() throws Exception
   {
      Child proxiedChild = (Child)getBean("ProxiedChild");
      assertFalse(proxiedChild instanceof Advised);
      assertTrue(proxiedChild instanceof AspectManaged);

      TestInterceptor.reset();
      proxiedChild.baseOnly();
      assertEquals(EXPECTED_ANNNOTATED_CHILD_BASEONLY_ADVISED, TestInterceptor.interceptions);
      assertNotNull(TestInterceptor.invoked);
      assertEquals("baseOnly", TestInterceptor.invoked.getName());
      assertNotNull(TestInterceptor.classAnnotation);
      assertTrue(TestInterceptor.classAnnotation instanceof org.jboss.test.microcontainer.support.Test);
      assertNull(TestInterceptor.methodAnnotation);
      assertNull(TestInterceptor.metadata);

      TestInterceptor.reset();
      proxiedChild.childOnly();
      assertEquals(EXPECTED_ANNNOTATED_CHILD_ONLY, TestInterceptor.interceptions);
      assertNotNull(TestInterceptor.invoked);
      assertEquals("childOnly", TestInterceptor.invoked.getName());
      assertNotNull(TestInterceptor.classAnnotation);
      assertTrue(TestInterceptor.classAnnotation instanceof org.jboss.test.microcontainer.support.Test);
      assertNull(TestInterceptor.methodAnnotation);
      assertNull(TestInterceptor.metadata);

      TestInterceptor.reset();
      proxiedChild.baseOverridden();
      assertEquals(EXPECTED_ANNNOTATED_CHILD_BASEOVERRIDDEN, TestInterceptor.interceptions);
      assertNotNull(TestInterceptor.invoked);
      assertEquals("baseOverridden", TestInterceptor.invoked.getName());
      assertNotNull(TestInterceptor.classAnnotation);
      assertTrue(TestInterceptor.classAnnotation instanceof org.jboss.test.microcontainer.support.Test);
View Full Code Here

   {
      Base base = (Base)getBean("Base");
      assertTrue(base instanceof Advised);
      assertFalse(base instanceof AspectManaged);
     
      Child plainChild = (Child)getBean("PlainChild");
      assertTrue(plainChild instanceof Advised);
      assertFalse(plainChild instanceof AspectManaged);
     
      Child proxiedChild = (Child)getBean("ProxiedChild");
      assertTrue(proxiedChild instanceof Advised);
      assertTrue(proxiedChild instanceof AspectManaged);

      TestInterceptor.reset();
      base.baseOnly();
View Full Code Here

      assertEquals(0, TestInterceptor.interceptions);
   }
  
   public void testPlainChild() throws Exception
   {
      Child plainChild = (Child)getBean("PlainChild");
      assertTrue(plainChild instanceof Advised);
      assertFalse(plainChild instanceof AspectManaged);
     
      TestInterceptor.reset();
      plainChild.baseOnly();
      assertEquals(1, TestInterceptor.interceptions);
      assertNotNull(TestInterceptor.invoked);
      assertEquals("baseOnly", TestInterceptor.invoked.getName());
      assertNull(TestInterceptor.classAnnotation);
      assertNull(TestInterceptor.methodAnnotation);
      assertNull(TestInterceptor.metadata);

      TestInterceptor.reset();
      plainChild.childOnly();
      assertEquals(0, TestInterceptor.interceptions);

      TestInterceptor.reset();
      plainChild.baseOverridden();
      assertEquals(0, TestInterceptor.interceptions);
   }
View Full Code Here

   private static final int EXPECTED_ANNNOTATED_CHILD_ONLY = 1;
   private static final int EXPECTED_ANNNOTATED_CHILD_BASEOVERRIDDEN = 1;

   public void testProxiedAndAdvisedChild() throws Exception
   {
      Child proxiedChild = (Child)getBean("ProxiedChild");
      assertTrue(proxiedChild instanceof Advised);
      assertTrue(proxiedChild instanceof AspectManaged);

      TestInterceptor.reset();
      proxiedChild.baseOnly();
      //Two bindings will apply to this method
      assertEquals(EXPECTED_ANNNOTATED_CHILD_BASEONLY, TestInterceptor.interceptions);
      assertNotNull(TestInterceptor.invoked);
      assertEquals("baseOnly", TestInterceptor.invoked.getName());
      assertNotNull(TestInterceptor.classAnnotation);
      assertTrue(TestInterceptor.classAnnotation instanceof org.jboss.test.microcontainer.support.Test);
      assertNull(TestInterceptor.methodAnnotation);
      assertNull(TestInterceptor.metadata);

      TestInterceptor.reset();
      proxiedChild.childOnly();
      assertEquals(EXPECTED_ANNNOTATED_CHILD_ONLY, TestInterceptor.interceptions);
      assertNotNull(TestInterceptor.invoked);
      assertEquals("childOnly", TestInterceptor.invoked.getName());
      assertNotNull(TestInterceptor.classAnnotation);
      assertTrue(TestInterceptor.classAnnotation instanceof org.jboss.test.microcontainer.support.Test);
      assertNull(TestInterceptor.methodAnnotation);
      assertNull(TestInterceptor.metadata);

      TestInterceptor.reset();
      proxiedChild.baseOverridden();
      assertEquals(EXPECTED_ANNNOTATED_CHILD_BASEOVERRIDDEN, TestInterceptor.interceptions);
      assertNotNull(TestInterceptor.invoked);
      assertEquals("baseOverridden", TestInterceptor.invoked.getName());
      assertNotNull(TestInterceptor.classAnnotation);
      assertTrue(TestInterceptor.classAnnotation instanceof org.jboss.test.microcontainer.support.Test);
View Full Code Here

TOP

Related Classes of org.jboss.test.microcontainer.matrix.Child

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.