本文整理了Java中org.apache.polygene.api.structure.Module.injectTo()
方法的一些代码示例,展示了Module.injectTo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Module.injectTo()
方法的具体详情如下:
包路径:org.apache.polygene.api.structure.Module
类名称:Module
方法名:injectTo
暂无
代码示例来源:origin: apache/attic-polygene-java
@Override
protected Application newApplicationInstance( ApplicationDescriptor applicationModel )
{
Application application = super.newApplicationInstance( applicationModel );
Module module = application.findModule( "Access Layer", "TestCase Module" );
module.injectTo( this );
return application;
}
代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport
@Override
protected Application newApplicationInstance( ApplicationDescriptor applicationModel )
{
Application application = super.newApplicationInstance( applicationModel );
Module module = application.findModule( "Access Layer", "TestCase Module" );
module.injectTo( this );
return application;
}
代码示例来源:origin: apache/attic-polygene-java
@Before
@Override
public void setUp()
throws Exception
{
super.setUp();
if( application == null )
{
return; // failure in Assembly.
}
Module module = application.findModule( "Layer 1", "Module 1" );
module.injectTo( this );
}
代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport
@Before
@Override
public void setUp()
throws Exception
{
super.setUp();
if( application == null )
{
return; // failure in Assembly.
}
Module module = application.findModule( "Layer 1", "Module 1" );
module.injectTo( this );
}
代码示例来源:origin: apache/attic-polygene-java
@Before
public void setup()
throws ActivationException
{
ApplicationAssembler assembler =
new ApplicationAssembler( "Multi Layered Indexing Test", "1.0", Application.Mode.development, getClass() );
assembler.initialize();
assembler.start();
application = assembler.application();
Module familyModule = application.findModule( "Domain Layer", "Family Module" );
TestData.populate( familyModule );
Module executionModule = application.findModule( "Access Layer", "TestExecution Module" );
executionModule.injectTo( this );
}
代码示例来源:origin: apache/attic-polygene-java
@Test
public final void givenImportedSpringServicesWhenServicesAreInjectedThenCanIdentifyByName()
throws ActivationException, AssemblyException
{
SingletonAssembler assembler = new SingletonAssembler()
{
public void assemble( ModuleAssembly module ) throws AssemblyException
{
module.objects( PolygeneImportServiceTest.class );
new SpringImporterAssembler( appContext ).assemble( module );
}
};
assembler.module().injectTo(this);
CommentService service = StreamSupport.stream( services.spliterator(), false )
.filter( withId( "commentService2" ) )
.findFirst().map( ServiceReference::get ).orElse( null );
assertThat( "service with correct id has been selected", service.comment( "pizza" ), equalTo( "pizza is good." ) );
}
代码示例来源:origin: org.apache.polygene.core/org.apache.polygene.core.testsupport
@Before
public void setup()
throws ActivationException
{
ApplicationAssembler assembler =
new ApplicationAssembler( "Multi Layered Indexing Test", "1.0", Application.Mode.development, getClass() );
assembler.initialize();
assembler.start();
application = assembler.application();
Module familyModule = application.findModule( "Domain Layer", "Family Module" );
TestData.populate( familyModule );
Module executionModule = application.findModule( "Access Layer", "TestExecution Module" );
executionModule.injectTo( this );
}
代码示例来源:origin: apache/attic-polygene-java
@Test
public final void givenImportedSpringServicesWhenServicesAreFoundThenCanIdentifyByName()
throws ActivationException, AssemblyException
{
SingletonAssembler assembler = new SingletonAssembler()
{
public void assemble( ModuleAssembly module ) throws AssemblyException
{
module.objects( PolygeneImportServiceTest.class );
new SpringImporterAssembler( appContext ).assemble( module );
}
};
assembler.module().injectTo( this );
CommentService foundService = finder.findServices( CommentService.class )
.filter( withId( "commentService2" ) )
.findFirst().map( ServiceReference::get )
.orElse( null );
assertThat( "service with correct id has been selected", foundService.comment( "pizza" ), equalTo( "pizza is good." ) );
}
}
代码示例来源:origin: apache/attic-polygene-java
@Test
public final void givenImportedSpringServicesWhenServiceIsInjectedThenUseSpringService()
throws ActivationException, AssemblyException
{
SingletonAssembler assembler = new SingletonAssembler()
{
public void assemble( ModuleAssembly module ) throws AssemblyException
{
module.objects( PolygeneImportServiceTest.class );
// START SNIPPET: import
new SpringImporterAssembler( appContext ).assemble( module );
// END SNIPPET: import
}
};
assembler.module().injectTo( this );
assertThat( "service can be called", service.comment( "beer" ), equalTo( "beer is good." ) );
}
代码示例来源:origin: apache/attic-polygene-java
@Test
public void testActivatable()
throws Exception
{
SingletonAssembler assembly = new SingletonAssembler()
{
public void assemble( ModuleAssembly module )
throws AssemblyException
{
module.objects( ActivatableServiceTest.class );
module.services( ActivatableComposite.class ).withActivators( TestActivator.class).instantiateOnStartup();
}
};
assertTrue( isActive );
assembly.module().injectTo( this );
assertTrue( isActive );
service.get();
assertTrue( isActive );
assembly.application().passivate();
assertFalse( isActive );
}
代码示例来源:origin: apache/attic-polygene-java
public void testActivatable()
throws Exception
{
SingletonAssembler assembly = new SingletonAssembler()
{
public void assemble( ModuleAssembly module )
throws AssemblyException
{
module.objects( LazyActivatedServiceTest.class );
module.services( LazyActivatedServiceTest.MyServiceComposite.class ).withActivators( TestActivator.class );
}
};
assertFalse( isActive );
assembly.module().injectTo( this );
assertFalse( isActive );
service.get();
assertFalse( isActive );
service.get().doStuff();
assertTrue( isActive );
assembly.application().passivate();
assertFalse( isActive );
}
代码示例来源:origin: apache/attic-polygene-java
module.injectTo( this );
内容来源于网络,如有侵权,请联系作者删除!