Examples of AcrossContextBeanRegistry


Examples of com.foreach.across.core.context.registry.AcrossContextBeanRegistry

  public void setup() {
    installerRepository = mock( AcrossInstallerRepository.class );

    beanFactory = mock( AcrossListableBeanFactory.class );

    AcrossContextBeanRegistry beanRegistry = mock( AcrossContextBeanRegistry.class );
    when( beanRegistry.getBeanOfType( AcrossInstallerRepository.class ) ).thenReturn( installerRepository );

    AbstractApplicationContext applicationContext = mock( AbstractApplicationContext.class );
    when( applicationContext.getBean( AcrossContextBeanRegistry.class ) ).thenReturn( beanRegistry );

    AcrossApplicationContextHolder acrossApplicationContextHolder = mock( AcrossApplicationContextHolder.class );
View Full Code Here

Examples of com.foreach.across.core.context.registry.AcrossContextBeanRegistry

public class TestAcrossContextShutdown
{
  @Test
  public void withoutParentSingleModuleApplicationContextDestroyed() {
    AcrossContext context = boot();
    AcrossContextBeanRegistry registry = AcrossContextUtils.getBeanRegistry( context );

    assertEquals( "one", fetch( registry, "one" ) );
    assertEquals( "two", fetch( registry, "two" ) );

    destroy( context, "two" );
View Full Code Here

Examples of com.foreach.across.core.context.registry.AcrossContextBeanRegistry

  }

  @Test
  public void withoutParentRootApplicationContextDestroyed() {
    AcrossContext context = boot();
    AcrossContextBeanRegistry registry = AcrossContextUtils.getBeanRegistry( context );

    assertEquals( "one", fetch( registry, "one" ) );
    assertEquals( "two", fetch( registry, "two" ) );

    context.shutdown();
View Full Code Here

Examples of com.foreach.across.core.context.registry.AcrossContextBeanRegistry

                                                            context.getParentApplicationContext() );

    ProvidedBeansMap providedBeans = new ProvidedBeansMap();

    // Create the AcrossContextBeanRegistry
    AcrossContextBeanRegistry contextBeanRegistry = new DefaultAcrossContextBeanRegistry( contextInfo );
    providedBeans.put( contextBeanRegistry.getFactoryName(),
                       new PrimarySingletonBean(
                           new DefaultAcrossContextBeanRegistry( contextInfo ),
                           new AutowireCandidateQualifier( Qualifier.class.getName(),
                                                           AcrossContextBeanRegistry.BEAN )
                       ) );
View Full Code Here

Examples of com.foreach.across.core.context.registry.AcrossContextBeanRegistry

    context.addModule( new ModuleOne() );
    context.addModule( new ModuleTwo() );
    context.addModule( new ModuleThree() );
    context.bootstrap();

    AcrossContextBeanRegistry registry = AcrossContextUtils.getBeanRegistry( context );
    List<MyBeanConfig> beans = registry.getBeansOfType( MyBeanConfig.class );
    assertTrue( beans.isEmpty() );

    beans = registry.getBeansOfType( MyBeanConfig.class, true );
    assertEquals( 3, beans.size() );

    assertEquals( "ModuleOne", beans.get( 0 ).getModule() );
    assertEquals( "ModuleTwo", beans.get( 1 ).getModule() );
    assertEquals( "ModuleThree", beans.get( 2 ).getModule() );
View Full Code Here

Examples of com.foreach.across.core.context.registry.AcrossContextBeanRegistry

    context.addModule( new ModuleOne() );
    context.addModule( new ModuleTwo() );
    context.addModule( new ModuleThree() );
    context.bootstrap();

    AcrossContextBeanRegistry registry = AcrossContextUtils.getBeanRegistry( context );
    List<GenericBean> beans = registry.getBeansOfType( GenericBean.class, true );

    assertEquals( 6, beans.size() );

    ResolvableType listType = ResolvableType.forClassWithGenerics( List.class, Integer.class );
    ResolvableType type = ResolvableType.forClassWithGenerics( GenericBean.class,
                                                               ResolvableType.forClass( Long.class ),
                                                               listType
    );

    beans = registry.getBeansOfType( type, true );
    assertEquals( 3, beans.size() );
    assertEquals( "longWithIntegerList", beans.get( 0 ).getName() );
    assertEquals( "longWithIntegerList", beans.get( 1 ).getName() );
    assertEquals( "longWithIntegerList", beans.get( 2 ).getName() );

    listType = ResolvableType.forClassWithGenerics( List.class, Date.class );
    type = ResolvableType.forClassWithGenerics( GenericBean.class,
                                                ResolvableType.forClass( String.class ),
                                                listType
    );

    beans = registry.getBeansOfType( type, true );
    assertEquals( 3, beans.size() );
    assertEquals( "stringWithDateList", beans.get( 0 ).getName() );
    assertEquals( "stringWithDateList", beans.get( 1 ).getName() );
    assertEquals( "stringWithDateList", beans.get( 2 ).getName() );
  }
View Full Code Here

Examples of com.foreach.across.core.context.registry.AcrossContextBeanRegistry

    AcrossContext context = new AcrossContext();
    context.addModule( new ModuleOne() );
    context.addModule( new ModuleTwo() );
    context.bootstrap();

    AcrossContextBeanRegistry registry = AcrossContextUtils.getBeanRegistry( context );
    MyBeanConfig one = registry.getBeanOfTypeFromModule( "ModuleOne", MyBeanConfig.class );
    MyBeanConfig two = registry.getBeanOfTypeFromModule( "ModuleTwo", MyBeanConfig.class );

    Collection<GenericBean<Long, List<Integer>>> integersOne = one.getIntegerLists();
    assertNotNull( integersOne );
    assertTrue( integersOne.getClass().equals( RefreshableRegistry.class ) );
    assertEquals( 2, integersOne.size() );
View Full Code Here

Examples of com.foreach.across.core.context.registry.AcrossContextBeanRegistry

    ModuleThree moduleThree = new ModuleThree();
    context.addModule( moduleThree );

    context.bootstrap();

    AcrossContextBeanRegistry registry = AcrossContextUtils.getBeanRegistry( context );
    List<MyBeanConfig> beans = registry.getBeansOfType( MyBeanConfig.class, true );
    assertEquals( 3, beans.size() );

    assertEquals( "ModuleThree", beans.get( 0 ).getModule() );
    assertEquals( "ModuleOne", beans.get( 1 ).getModule() );
    assertEquals( "ModuleTwo", beans.get( 2 ).getModule() );
View Full Code Here

Examples of com.foreach.across.core.context.registry.AcrossContextBeanRegistry

    ModuleThree moduleThree = new ModuleThree();
    context.addModule( moduleThree );

    context.bootstrap();

    AcrossContextBeanRegistry registry = AcrossContextUtils.getBeanRegistry( context );
    List<MyBeanConfig> beans = registry.getBeansOfType( MyBeanConfig.class, true );
    assertEquals( 4, beans.size() );

    assertEquals( "ApplicationContext", beans.get( 0 ).getModule() );
    assertEquals( "ModuleThree", beans.get( 1 ).getModule() );
    assertEquals( "ModuleTwo", beans.get( 2 ).getModule() );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.