use of jodd.proxetta.impl.ProxyProxetta in project jodd by oblac.
the class SubclassTest method testInnerOverride.
@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();
assertNotNull(two);
assertEquals("foo.Two$$Proxetta", two.getClass().getName());
}
use of jodd.proxetta.impl.ProxyProxetta in project jodd by oblac.
the class SubclassTest method test1.
@Test
public void test1() {
ProxyAspect a1 = new ProxyAspect(FooProxyAdvice.class, new ProxyPointcut() {
public boolean apply(MethodInfo methodInfo) {
return true;
}
});
/*
byte[] b = Proxetta.withAspects(a1).createProxy(Foo.class);
try {
FileUtil.writeBytes("d:\\Foo.class", b);
} catch (IOException e) {
e.printStackTrace();
}
*/
ProxyProxetta proxyProxetta = ProxyProxetta.withAspects(a1);
proxyProxetta.setClassNameSuffix("$$$Proxetta");
ProxyProxettaBuilder pb = proxyProxetta.builder();
pb.setTarget(Foo.class);
Foo foo = (Foo) pb.newInstance();
Class fooProxyClass = foo.getClass();
assertNotNull(fooProxyClass);
Method[] methods = fooProxyClass.getMethods();
assertEquals(12, methods.length);
try {
fooProxyClass.getMethod("m1");
} catch (NoSuchMethodException nsmex) {
fail(nsmex.toString());
}
methods = fooProxyClass.getDeclaredMethods();
assertEquals(15, methods.length);
try {
fooProxyClass.getDeclaredMethod("m2");
} catch (NoSuchMethodException nsmex) {
fail(nsmex.toString());
}
}
use of jodd.proxetta.impl.ProxyProxetta in project jodd by oblac.
the class MixedScope343Test method setupPetiteContainer.
@Before
public void setupPetiteContainer() {
PetiteConfig petiteConfig = PetiteHelper.createPetiteConfig();
ProxyProxetta proxyProxetta = PetiteHelper.createProxyProxetta();
petiteContainer = new ProxettaAwarePetiteContainer(proxyProxetta, petiteConfig);
AutomagicPetiteConfigurator petiteConfigurator = new AutomagicPetiteConfigurator();
petiteConfigurator.setIncludedEntries(this.getClass().getPackage().getName() + ".*");
petiteConfigurator.configure(petiteContainer);
}
use of jodd.proxetta.impl.ProxyProxetta in project jodd by oblac.
the class PetiteHelper method createProxyProxetta.
public static ProxyProxetta createProxyProxetta() {
ProxyPointcut pointcut_logged = new MethodAnnotationPointcut(Logged.class);
ProxyAspect aspect_logged = new ProxyAspect(LogProxyAdvice.class, pointcut_logged);
ProxyProxetta proxetta = ProxyProxetta.withAspects(aspect_logged);
return proxetta;
}
use of jodd.proxetta.impl.ProxyProxetta in project jodd by oblac.
the class WireBeansWithProxettaTest method setupPetiteContainer.
@Before
public void setupPetiteContainer() {
PetiteConfig petiteConfig = PetiteHelper.createPetiteConfig();
ProxyProxetta proxyProxetta = PetiteHelper.createProxyProxetta();
petiteContainer = new PetiteProxettaContainer(proxyProxetta, petiteConfig);
//AutomagicPetiteConfigurator petiteConfigurator = new AutomagicPetiteConfigurator();
//petiteConfigurator.configure(petiteContainer);
petiteContainer.registerPetiteBean(Bean1.class);
petiteContainer.registerPetiteBean(Bean2.class);
}
Aggregations