@Test public void givenBuilderUseWhenBuildingApplicationExpectSuccess() throws AssemblyException, ActivationException { ApplicationBuilder builder = new ApplicationBuilder( "Build from API test." ); builder.withLayer( "layer1" ).using( "layer2" ).using( "layer3" ); builder.withLayer( "layer2" ); builder.withLayer( "layer3" ) .withModule( "test module" ) .withAssemblers( findClasses( getClass() ).filter( matches( ".*ServiceAssembler" ) ) .collect( toList() ) ); Application application = builder.newApplication(); Module module = application.findModule( "layer3", "test module" ); TestService service = module.findService( TestService.class ).get(); assertThat( service.sayHello(), equalTo( "Hello Polygene!" ) ); }
LayerDeclaration layerDeclaration = withLayer( layerName ); JsonValue optUsing = layerObject.get( "uses" ); if( optUsing != null && optUsing.getValueType() == JsonValue.ValueType.ARRAY )
LayerDeclaration layerDeclaration = withLayer( layerName ); JsonValue optUsing = layerObject.get( "uses" ); if( optUsing != null && optUsing.getValueType() == JsonValue.ValueType.ARRAY )
appBuilder.withLayer( "Layer 1" ).withModule( "Module A" ).withAssembler( module -> module.services( TestService.class ) .identifiedBy( "TestService_Module.A" ) .withActivators( FailBeforePassivationServiceActivator.class ) .instantiateOnStartup() ); appBuilder.withLayer( "Layer 2" ).withModule( "Module B" ).withAssembler( module -> module.services( TestService.class ) .identifiedBy( "TestService_Module.B" )