Package jodd.proxetta.impl

Examples of jodd.proxetta.impl.ProxyProxetta


    }
  }

  @Test
  public void testProxyProxetta() {
    ProxyProxetta proxetta = ProxyProxetta.withAspects(
      new ProxyAspect(AddStringAdvice.class, new AllRealMethodsPointcut()));

    PetiteContainer papc = new ProxettaAwarePetiteContainer(proxetta);

    papc.registerPetiteBean(SecretService.class, null, null, null, false);
View Full Code Here


  }

  @Test
  public void testInnerOverride() {
    ProxyProxetta proxyProxetta = ProxyProxetta.withAspects(new ProxyAspect(FooProxyAdvice.class, new AllMethodsPointcut()));
    ProxyProxettaBuilder builder = proxyProxetta.builder();
    builder.setTarget(Two.class);
    builder.setTargetProxyClassName("foo.");

    Two two = (Two) builder.newInstance();
View Full Code Here

    assertEquals("foo.Two$$Proxetta", two.getClass().getName());
  }

  @Test
  public void testJdk() throws Exception {
    ProxyProxetta proxyProxetta = ProxyProxetta.withAspects(new ProxyAspect(StatCounterAdvice.class, new AllMethodsPointcut()));
    proxyProxetta.setVariableClassName(false);

    ProxyProxettaBuilder builder = proxyProxetta.builder();
    builder.setTarget(Object.class);
    try {
      builder.define();
      fail("Default class loader should not load java.*");
    } catch (RuntimeException rex) {
      // ignore
    }

    builder = proxyProxetta.builder();
    builder.setTarget(Object.class);
    builder.setTargetProxyClassName("foo.");
    Object object = builder.newInstance();

    assertNotNull(object);
    assertEquals("foo.Object$$Proxetta", object.getClass().getName());

    System.out.println("----------list");

    StatCounter.counter = 0;

    builder = proxyProxetta.builder(ArrayList.class, "foo.");
    List list = (List) builder.newInstance();
    assertNotNull(list);
    assertEquals("foo.ArrayList$$Proxetta", list.getClass().getName());

    assertEquals(1, StatCounter.counter);
    list.add(new Integer(1));
    assertTrue(StatCounter.counter == 3 || StatCounter.counter == 2);

    System.out.println("----------set");

    builder = proxyProxetta.builder(HashSet.class, "foo.");
    Set set = (Set) builder.newInstance();

    assertNotNull(set);
    assertEquals("foo.HashSet$$Proxetta", set.getClass().getName());

View Full Code Here

TOP

Related Classes of jodd.proxetta.impl.ProxyProxetta

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.