Package org.jboss.test.proxyfactory.support

Examples of org.jboss.test.proxyfactory.support.Simple


   private static final int iterations = 1000;
  
   public void testSimple() throws Exception
   {
      SimpleBean bean = new SimpleBean();
      Simple simple = (Simple) assertCreateProxy(bean, Simple.class);
      SimpleInterceptor.invoked = null;
      simple.doSomething();
      assertTrue(bean.invoked);
      Method invoked = SimpleInterceptor.invoked;
      assertNotNull(invoked);
      assertEquals("doSomething", invoked.getName());
   }
View Full Code Here


      ClassLoader cl = Simple.class.getClassLoader();
      for (int i = 0; i < iterations; ++i)
      {
         SimpleBean bean = new SimpleBean();
         InvocationHandler ih = new MyInvocationHandler(bean);
         Simple simple = (Simple) Proxy.newProxyInstance(cl, interfaces, ih);
         simple.doSomething();
      }
   }
View Full Code Here

   public void testStressProxyFactory() throws Exception
   {
      for (int i = 0; i < iterations; ++i)
      {
         SimpleBean bean = new SimpleBean();
         Simple simple = (Simple) createProxy(bean);
         simple.doSomething();
      }
   }
View Full Code Here

public class InstanceAdvisedTestCase extends AbstractProxyTest
{
   public void testInstanceAdvised() throws Exception
   {
      SimpleBean bean1 = new SimpleBean();
      Simple simple1 = (Simple) assertCreateProxy(bean1, Simple.class);
      SimpleBean bean2 = new SimpleBean();
      Simple simple2 = (Simple) assertCreateProxy(bean2, Simple.class);
      InstanceInterceptor.last = null;
      simple1.doSomething();
      assertTrue(bean1.invoked);
      Object instance1 = InstanceInterceptor.last;
      assertNotNull(instance1);
      InstanceInterceptor.last = null;
      simple2.doSomething();
      assertTrue(bean2.invoked);
      Object instance2 = InstanceInterceptor.last;
      assertNotNull(instance2);
      assertFalse(instance1 == instance2);
   }
View Full Code Here

*/
public class HollowTestCase extends AbstractProxyTest
{
   public void testHollow() throws Exception
   {
      Simple simple = (Simple) assertCreateHollowProxy(new Class[] { Simple.class }, null, Simple.class);
      ReturningInterceptor.invoked = null;
      simple.doSomething();

      Method method = ReturningInterceptor.invoked;
      assertNotNull(method);
      assertEquals("doSomething", method.getName());
   }
View Full Code Here

            new Class[] {Other.class, Tagging.class},
            mixins,
            null,
            new Class[] {Other.class, Simple.class, Tagging.class, Another.class});

      Simple simple = (Simple)proxy;
      simple.doSomething();
      assertTrue(SimpleMixin.invoked);
      assertNotNull(SimpleInterceptor.invoked);
      assertEquals("doSomething", SimpleInterceptor.invoked.getName());
      assertNull(ReturningInterceptor.invoked);
      assertFalse(AnotherMixin.invoked);
View Full Code Here

*/
public class ObjectTestCase extends AbstractProxyTest
{
   public void testObject() throws Exception
   {
      Simple simple = (Simple) assertCreateProxy(new Object(), new Class[] { Simple.class }, Simple.class);
      simple.toString();
      ReturningInterceptor.invoked = null;
      simple.doSomething();
      Method method = ReturningInterceptor.invoked;
      assertNotNull(method);
      assertEquals("doSomething", method.getName());
   }
View Full Code Here

public class FieldTestCase extends AbstractProxyTest
{
   public void testField() throws Exception
   {
      SimpleBean bean = new SimpleBean();
      Simple simple = (Simple) assertCreateProxy(bean, Simple.class);
      SimpleInterceptor.invoked = null;
      simple.doSomething();
      assertTrue(bean.invoked);
      Method invoked = SimpleInterceptor.invoked;
      assertNotNull(invoked);
      assertEquals("doSomething", invoked.getName());
     
View Full Code Here

      PlainBean bean = new PlainBean();
      AOPProxyFactoryMixin[] mixins = {new AOPProxyFactoryMixin(SimpleMixin.class, new Class[]{Simple.class})};
      Object proxy = assertCreateProxy(bean, mixins, Simple.class);

      Simple simple = (Simple)proxy;
      simple.doSomething();
      assertTrue(SimpleMixin.invoked);
      assertNotNull(SimpleInterceptor.invoked);
      assertEquals("doSomething", SimpleInterceptor.invoked.getName());
   }
View Full Code Here

      PlainBean bean = new PlainBean();
      AOPProxyFactoryMixin[] mixins = {new AOPProxyFactoryMixin(SimpleMixinWithConstructorAndDelegate.class, new Class[]{Simple.class}, "this")};
      Object proxy = assertCreateProxy(bean, mixins, Simple.class);

      Simple simple = (Simple)proxy;
      simple.doSomething();
      assertTrue(SimpleMixinWithConstructorAndDelegate.invoked);
      assertNotNull(SimpleMixinWithConstructorAndDelegate.proxy);
      assertEquals(proxy, SimpleMixinWithConstructorAndDelegate.proxy);
      assertNotNull(SimpleMixinWithConstructorAndDelegate.delegate);
      assertEquals(bean, SimpleMixinWithConstructorAndDelegate.delegate);
View Full Code Here

TOP

Related Classes of org.jboss.test.proxyfactory.support.Simple

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.