Search in sources :

Example 1 with ProxettaAwarePetiteContainer

use of jodd.petite.proxetta.ProxettaAwarePetiteContainer 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);
}
Also used : ProxyProxetta(jodd.proxetta.impl.ProxyProxetta) ProxettaAwarePetiteContainer(jodd.petite.proxetta.ProxettaAwarePetiteContainer) PetiteConfig(jodd.petite.PetiteConfig) AutomagicPetiteConfigurator(jodd.petite.config.AutomagicPetiteConfigurator) Before(org.junit.Before)

Example 2 with ProxettaAwarePetiteContainer

use of jodd.petite.proxetta.ProxettaAwarePetiteContainer in project jodd by oblac.

the class ProxettaAwareContainerTest method testProxyProxetta.

@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);
    BeanDefinition beanDefinition = papc.registerPetiteBean(PublicService.class, null, null, null, false);
    papc.registerPetiteBean(PublicService2.class, null, null, null, false);
    papc.registerPetiteBean(PublicService3.class, null, null, null, false);
    assertNotEquals(PublicService.class, beanDefinition.getType());
    PublicService publicService = (PublicService) papc.getBean(beanDefinition.getName());
    assertNotNull(publicService.secretService);
    assertEquals("Hello World! And Universe, too!", publicService.hello());
    PublicService2 publicService2 = papc.getBean(PublicService2.class);
    assertNotNull(publicService2.secretService);
    assertEquals("Hello World! And Universe, too!", publicService2.hello());
    PublicService3 publicService3 = papc.getBean(PublicService3.class);
    assertNotNull(publicService3.secretService);
    assertEquals("Hello World! And Universe, too!", publicService3.hello());
}
Also used : ProxyProxetta(jodd.proxetta.impl.ProxyProxetta) ProxettaAwarePetiteContainer(jodd.petite.proxetta.ProxettaAwarePetiteContainer) AllRealMethodsPointcut(jodd.proxetta.pointcuts.AllRealMethodsPointcut) ProxyAspect(jodd.proxetta.ProxyAspect) ProxettaAwarePetiteContainer(jodd.petite.proxetta.ProxettaAwarePetiteContainer) Test(org.junit.Test)

Aggregations

ProxettaAwarePetiteContainer (jodd.petite.proxetta.ProxettaAwarePetiteContainer)2 ProxyProxetta (jodd.proxetta.impl.ProxyProxetta)2 PetiteConfig (jodd.petite.PetiteConfig)1 AutomagicPetiteConfigurator (jodd.petite.config.AutomagicPetiteConfigurator)1 ProxyAspect (jodd.proxetta.ProxyAspect)1 AllRealMethodsPointcut (jodd.proxetta.pointcuts.AllRealMethodsPointcut)1 Before (org.junit.Before)1 Test (org.junit.Test)1