Anonymous ApplicationAssemblers as lambdas

Project: http://git-wip-us.apache.org/repos/asf/polygene-java/repo
Commit: http://git-wip-us.apache.org/repos/asf/polygene-java/commit/35c0dde4
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/35c0dde4
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/35c0dde4

Branch: refs/heads/develop
Commit: 35c0dde46d2ddddbb54dbf35c8926d2320cbca8a
Parents: 9042a31
Author: Paul Merlin <[email protected]>
Authored: Mon May 22 20:12:07 2017 +0200
Committer: Paul Merlin <[email protected]>
Committed: Mon May 22 20:12:07 2017 +0200

----------------------------------------------------------------------
 .../api/docsupport/ApplicationDocs.java         | 22 +-------
 .../bootstrap/ApplicationAssembler.java         |  1 +
 .../bootstrap/builder/ApplicationBuilder.java   | 56 +++++++++-----------
 .../bootstrap/DocumentationSupport.java         | 33 +++---------
 .../bootstrap/ApplicationAssemblerTest.java     | 26 ++++-----
 .../polygene/regression/qi78/IssueTest.java     | 23 +++-----
 .../bootstrap/docs/DocumentationSupport.java    | 25 +++------
 .../polygene/runtime/structure/ModuleTest.java  | 52 +++++-------------
 .../runtime/structure/StructureTest.java        | 33 +++++-------
 .../polygene/index/rdf/qi95/Qi95IssueTest.java  | 30 ++++-------
 .../polygene/library/rdf/Model2XMLTest.java     | 33 +++++-------
 11 files changed, 112 insertions(+), 222 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/35c0dde4/core/api/src/test/java/org/apache/polygene/api/docsupport/ApplicationDocs.java
----------------------------------------------------------------------
diff --git 
a/core/api/src/test/java/org/apache/polygene/api/docsupport/ApplicationDocs.java
 
b/core/api/src/test/java/org/apache/polygene/api/docsupport/ApplicationDocs.java
index c6a6e78..5032206 100644
--- 
a/core/api/src/test/java/org/apache/polygene/api/docsupport/ApplicationDocs.java
+++ 
b/core/api/src/test/java/org/apache/polygene/api/docsupport/ApplicationDocs.java
@@ -21,7 +21,6 @@ package org.apache.polygene.api.docsupport;
 
 import org.apache.polygene.api.structure.Application;
 import org.apache.polygene.api.structure.ApplicationDescriptor;
-import org.apache.polygene.bootstrap.ApplicationAssembler;
 import org.apache.polygene.bootstrap.ApplicationAssembly;
 import org.apache.polygene.bootstrap.ApplicationAssemblyFactory;
 import org.apache.polygene.bootstrap.Assembler;
@@ -82,16 +81,7 @@ public class ApplicationDocs
                     }
                 };
             Energy4Java polygene = new Energy4Java();
-            Application app = polygene.newApplication( new 
ApplicationAssembler()
-            {
-
-                @Override
-                public ApplicationAssembly assemble( 
ApplicationAssemblyFactory applicationFactory )
-                    throws AssemblyException
-                {
-                    return applicationFactory.newApplicationAssembly( 
assemblers );
-                }
-            } );
+            Application app = polygene.newApplication( factory -> 
factory.newApplicationAssembly( assemblers ) );
             app.activate();
 // END SNIPPET: application2
         }
@@ -118,15 +108,7 @@ public class ApplicationDocs
         throws Exception
     {
         polygene = new Energy4Java();
-        ApplicationDescriptor model = polygene.newApplicationModel( new 
ApplicationAssembler()
-        {
-            @Override
-            public ApplicationAssembly assemble( ApplicationAssemblyFactory 
applicationFactory )
-                throws AssemblyException
-            {
-                return createAssembly( applicationFactory );
-            }
-        } );
+        ApplicationDescriptor model = polygene.newApplicationModel( factory -> 
createAssembly( factory ) );
         Application application = model.newInstance( polygene.spi() );
     }
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/35c0dde4/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssembler.java
----------------------------------------------------------------------
diff --git 
a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssembler.java
 
b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssembler.java
index 37f4f5b..a0593d0 100644
--- 
a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssembler.java
+++ 
b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/ApplicationAssembler.java
@@ -32,6 +32,7 @@ package org.apache.polygene.bootstrap;
  * and then activate the created application, which will be the runtime
  * instance that forms your application.
  */
+@FunctionalInterface
 public interface ApplicationAssembler
 {
     ApplicationAssembly assemble( ApplicationAssemblyFactory 
applicationFactory )

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/35c0dde4/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/ApplicationBuilder.java
----------------------------------------------------------------------
diff --git 
a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/ApplicationBuilder.java
 
b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/ApplicationBuilder.java
index 6159686..0302763 100644
--- 
a/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/ApplicationBuilder.java
+++ 
b/core/bootstrap/src/main/java/org/apache/polygene/bootstrap/builder/ApplicationBuilder.java
@@ -36,9 +36,7 @@ import org.apache.polygene.api.activation.ActivationException;
 import org.apache.polygene.api.activation.ApplicationPassivationThread;
 import org.apache.polygene.api.structure.Application;
 import org.apache.polygene.api.structure.ApplicationDescriptor;
-import org.apache.polygene.bootstrap.ApplicationAssembler;
 import org.apache.polygene.bootstrap.ApplicationAssembly;
-import org.apache.polygene.bootstrap.ApplicationAssemblyFactory;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.Energy4Java;
 import org.apache.polygene.bootstrap.LayerAssembly;
@@ -103,38 +101,32 @@ public class ApplicationBuilder
         throws AssemblyException, ActivationException
     {
         Energy4Java polygene = new Energy4Java();
-        ApplicationDescriptor model = polygene.newApplicationModel( new 
ApplicationAssembler()
-        {
-            @Override
-            public ApplicationAssembly assemble( ApplicationAssemblyFactory 
factory )
-                throws AssemblyException
+        ApplicationDescriptor model = polygene.newApplicationModel( factory -> 
{
+            ApplicationAssembly assembly = factory.newApplicationAssembly();
+            assembly.setName( applicationName );
+            if( applicationVersion != null )
             {
-                ApplicationAssembly assembly = 
factory.newApplicationAssembly();
-                assembly.setName( applicationName );
-                if( applicationVersion != null )
-                {
-                    assembly.setVersion( applicationVersion );
-                }
-                if( applicationMode != null )
-                {
-                    assembly.setMode( applicationMode );
-                }
-                for( Object metaInfo : metaInfos )
-                {
-                    assembly.setMetaInfo( metaInfo );
-                }
-                HashMap<String, LayerAssembly> createdLayers = new HashMap<>();
-                for( Map.Entry<String, LayerDeclaration> entry : 
layers.entrySet() )
-                {
-                    LayerAssembly layer = entry.getValue().createLayer( 
assembly );
-                    createdLayers.put( entry.getKey(), layer );
-                }
-                for( LayerDeclaration layer : layers.values() )
-                {
-                    layer.initialize( createdLayers );
-                }
-                return assembly;
+                assembly.setVersion( applicationVersion );
+            }
+            if( applicationMode != null )
+            {
+                assembly.setMode( applicationMode );
+            }
+            for( Object metaInfo : metaInfos )
+            {
+                assembly.setMetaInfo( metaInfo );
+            }
+            HashMap<String, LayerAssembly> createdLayers = new HashMap<>();
+            for( Map.Entry<String, LayerDeclaration> entry : layers.entrySet() 
)
+            {
+                LayerAssembly layer = entry.getValue().createLayer( assembly );
+                createdLayers.put( entry.getKey(), layer );
+            }
+            for( LayerDeclaration layer : layers.values() )
+            {
+                layer.initialize( createdLayers );
             }
+            return assembly;
         } );
         Application application = model.newInstance( polygene.api() );
         for( ActivationEventListener activationListener : activationListeners )

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/35c0dde4/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
----------------------------------------------------------------------
diff --git 
a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
 
b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
index a89629a..59f1f2c 100644
--- 
a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
+++ 
b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/DocumentationSupport.java
@@ -289,17 +289,7 @@ public class DocumentationSupport
         private static ApplicationDescriptor newApplication( final 
Assembler[][][] assemblers )
                 throws AssemblyException
         {
-            return polygene.newApplicationModel( new ApplicationAssembler()
-            {
-
-                @Override
-                public ApplicationAssembly assemble( 
ApplicationAssemblyFactory appFactory )
-                        throws AssemblyException
-                {
-                    return appFactory.newApplicationAssembly( assemblers );
-                }
-
-            } );
+            return polygene.newApplicationModel( factory -> 
factory.newApplicationAssembly( assemblers ) );
         }
         // END SNIPPET: pancake
 
@@ -330,24 +320,13 @@ public class DocumentationSupport
         {
             // Create a Polygene Runtime
             polygene = new Energy4Java();
-            application = polygene.newApplication( new ApplicationAssembler()
-            {
-
-                @Override
-                public ApplicationAssembly assemble( 
ApplicationAssemblyFactory appFactory )
-                        throws AssemblyException
-                {
-                    ApplicationAssembly assembly = 
appFactory.newApplicationAssembly();
-                    buildAssembly( assembly );
-                    return assembly;
-                }
-
-            } );
-            // activate the application
+            // Create the application
+            application = polygene.newApplication( factory -> buildAssembly( 
factory.newApplicationAssembly() ) );
+            // Activate the application
             application.activate();
         }
 
-        static void buildAssembly( ApplicationAssembly app ) throws 
AssemblyException
+        static ApplicationAssembly buildAssembly( ApplicationAssembly app ) 
throws AssemblyException
         {
             LayerAssembly webLayer = createWebLayer( app );
             LayerAssembly domainLayer = createDomainLayer( app );
@@ -359,6 +338,8 @@ public class DocumentationSupport
             domainLayer.uses( authLayer );
             domainLayer.uses( persistenceLayer );
             domainLayer.uses( messagingLayer );
+
+            return app;
         }
 
         static LayerAssembly createWebLayer( ApplicationAssembly app ) throws 
AssemblyException

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/35c0dde4/core/runtime/src/test/java/org/apache/polygene/bootstrap/ApplicationAssemblerTest.java
----------------------------------------------------------------------
diff --git 
a/core/runtime/src/test/java/org/apache/polygene/bootstrap/ApplicationAssemblerTest.java
 
b/core/runtime/src/test/java/org/apache/polygene/bootstrap/ApplicationAssemblerTest.java
index eb58551..908a0dc 100644
--- 
a/core/runtime/src/test/java/org/apache/polygene/bootstrap/ApplicationAssemblerTest.java
+++ 
b/core/runtime/src/test/java/org/apache/polygene/bootstrap/ApplicationAssemblerTest.java
@@ -43,30 +43,24 @@ public class ApplicationAssemblerTest
     {
         Energy4Java polygene = new Energy4Java();
 
-        ApplicationDescriptor model = polygene.newApplicationModel( new 
ApplicationAssembler()
-        {
-            @Override
-            public ApplicationAssembly assemble( ApplicationAssemblyFactory 
applicationFactory )
-                throws AssemblyException
-            {
-                ApplicationAssembly assembly = 
applicationFactory.newApplicationAssembly();
+        ApplicationDescriptor model = polygene.newApplicationModel( factory -> 
{
+            ApplicationAssembly assembly = factory.newApplicationAssembly();
 
-                LayerAssembly layer1 = assembly.layer( "Layer1" );
+            LayerAssembly layer1 = assembly.layer( "Layer1" );
 
-                ModuleAssembly module = layer1.module( "Module1" );
+            ModuleAssembly module = layer1.module( "Module1" );
 
-                module.services( TestService.class );
+            module.services( TestService.class );
 
-                module.entities( TestEntity.class );
+            module.entities( TestEntity.class );
 
-                layer1.services( AssemblySpecifications.ofAnyType( 
TestService.class ) ).instantiateOnStartup();
+            layer1.services( AssemblySpecifications.ofAnyType( 
TestService.class ) ).instantiateOnStartup();
 
-                layer1.services( s -> true ).visibleIn( Visibility.layer );
+            layer1.services( s -> true ).visibleIn( Visibility.layer );
 
-                layer1.entities( s -> true ).visibleIn( Visibility.application 
);
+            layer1.entities( s -> true ).visibleIn( Visibility.application );
 
-                return assembly;
-            }
+            return assembly;
         } );
 
         model.accept( new HierarchicalVisitorAdapter<Object, Object, 
RuntimeException>()

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/35c0dde4/core/runtime/src/test/java/org/apache/polygene/regression/qi78/IssueTest.java
----------------------------------------------------------------------
diff --git 
a/core/runtime/src/test/java/org/apache/polygene/regression/qi78/IssueTest.java 
b/core/runtime/src/test/java/org/apache/polygene/regression/qi78/IssueTest.java
index 7e96d69..04dade8 100644
--- 
a/core/runtime/src/test/java/org/apache/polygene/regression/qi78/IssueTest.java
+++ 
b/core/runtime/src/test/java/org/apache/polygene/regression/qi78/IssueTest.java
@@ -23,9 +23,7 @@ import org.apache.polygene.api.structure.Application;
 import org.apache.polygene.api.structure.ApplicationDescriptor;
 import org.apache.polygene.api.structure.LayerDescriptor;
 import org.apache.polygene.api.util.HierarchicalVisitorAdapter;
-import org.apache.polygene.bootstrap.ApplicationAssembler;
 import org.apache.polygene.bootstrap.ApplicationAssembly;
-import org.apache.polygene.bootstrap.ApplicationAssemblyFactory;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.Energy4Java;
 import org.apache.polygene.bootstrap.LayerAssembly;
@@ -40,23 +38,18 @@ public class IssueTest
     {
         Energy4Java polygene = new Energy4Java();
 
-        Application app = polygene.newApplication( new ApplicationAssembler()
-        {
-            public ApplicationAssembly assemble( ApplicationAssemblyFactory 
applicationFactory )
-                throws AssemblyException
-            {
-                ApplicationAssembly assembly = 
applicationFactory.newApplicationAssembly();
+        Application app = polygene.newApplication( factory -> {
+            ApplicationAssembly assembly = factory.newApplicationAssembly();
 
-                LayerAssembly domainLayer = assembly.layer( null );
-                domainLayer.setName( "Domain" );
+            LayerAssembly domainLayer = assembly.layer( null );
+            domainLayer.setName( "Domain" );
 
-                LayerAssembly infrastructureLayer = assembly.layer( null );
-                infrastructureLayer.setName( "Infrastructure" );
+            LayerAssembly infrastructureLayer = assembly.layer( null );
+            infrastructureLayer.setName( "Infrastructure" );
 
-                domainLayer.uses( infrastructureLayer );
+            domainLayer.uses( infrastructureLayer );
 
-                return assembly;
-            }
+            return assembly;
         } );
         ApplicationDescriptor model = app.descriptor();
         model.accept( new HierarchicalVisitorAdapter<Object, Object, 
RuntimeException>()

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/35c0dde4/core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/docs/DocumentationSupport.java
----------------------------------------------------------------------
diff --git 
a/core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/docs/DocumentationSupport.java
 
b/core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/docs/DocumentationSupport.java
index 3c80414..09e1193 100644
--- 
a/core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/docs/DocumentationSupport.java
+++ 
b/core/runtime/src/test/java/org/apache/polygene/runtime/bootstrap/docs/DocumentationSupport.java
@@ -21,10 +21,7 @@
 package org.apache.polygene.runtime.bootstrap.docs;
 
 import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.bootstrap.ApplicationAssembler;
 import org.apache.polygene.bootstrap.ApplicationAssembly;
-import org.apache.polygene.bootstrap.ApplicationAssemblyFactory;
-import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.Energy4Java;
 import org.apache.polygene.runtime.bootstrap.AssemblyHelper;
 import org.apache.polygene.runtime.composite.FragmentClassLoader;
@@ -41,21 +38,15 @@ public class DocumentationSupport
     {
         // Create a Polygene Runtime
         polygene = new Energy4Java();
-        application = polygene.newApplication( new ApplicationAssembler()
-        {
-
-            @Override
-            public ApplicationAssembly assemble( ApplicationAssemblyFactory 
appFactory )
-                throws AssemblyException
-            {
-                ApplicationAssembly assembly = 
appFactory.newApplicationAssembly();
-                assembly.setMetaInfo( new DalvikAssemblyHelper() );
-                // END SNIPPET: customAssemblyHelper
-                // START SNIPPET: customAssemblyHelper
-                return assembly;
-            }
+        // Create the application
+        application = polygene.newApplication( factory -> {
+            ApplicationAssembly assembly = factory.newApplicationAssembly();
+            assembly.setMetaInfo( new DalvikAssemblyHelper() );
+            // END SNIPPET: customAssemblyHelper
+            // START SNIPPET: customAssemblyHelper
+            return assembly;
         } );
-        // activate the application
+        // Activate the application
         application.activate();
     }
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/35c0dde4/core/runtime/src/test/java/org/apache/polygene/runtime/structure/ModuleTest.java
----------------------------------------------------------------------
diff --git 
a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/ModuleTest.java
 
b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/ModuleTest.java
index 83897e4..3e746b4 100644
--- 
a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/ModuleTest.java
+++ 
b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/ModuleTest.java
@@ -20,20 +20,16 @@
 
 package org.apache.polygene.runtime.structure;
 
-import org.junit.Test;
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.api.composite.TransientComposite;
 import org.apache.polygene.api.injection.scope.Structure;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.structure.Application;
 import org.apache.polygene.api.structure.Module;
-import org.apache.polygene.bootstrap.ApplicationAssembler;
-import org.apache.polygene.bootstrap.ApplicationAssembly;
-import org.apache.polygene.bootstrap.ApplicationAssemblyFactory;
 import org.apache.polygene.bootstrap.Assembler;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.Energy4Java;
-import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.junit.Test;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.junit.Assert.assertThat;
@@ -48,39 +44,19 @@ public class ModuleTest
         throws AssemblyException
     {
         Energy4Java polygene = new Energy4Java();
-        return polygene.newApplication( new ApplicationAssembler()
-        {
-            public ApplicationAssembly assemble( ApplicationAssemblyFactory 
applicationFactory )
-                throws AssemblyException
-            {
-                return applicationFactory.newApplicationAssembly( new 
Assembler[][][]
-                                                                  {
-                                                                      {
-                                                                          {
-                                                                              
new Assembler()
-                                                                              {
-                                                                               
   public void assemble( ModuleAssembly module )
-                                                                               
       throws AssemblyException
-                                                                               
   {
-                                                                               
       module.transients( TestComposite1.class );
-                                                                               
   }
-                                                                              }
-                                                                          },
-                                                                          {
-                                                                              
new Assembler()
-                                                                              {
-                                                                               
   public void assemble( ModuleAssembly module )
-                                                                               
       throws AssemblyException
-                                                                               
   {
-                                                                               
       module.transients( TestComposite2.class )
-                                                                               
           .visibleIn( Visibility.layer );
-                                                                               
   }
-                                                                              }
-                                                                          }
-                                                                      }
-                                                                  } );
-            }
-        } );
+        return polygene.newApplication(
+            factory -> factory.newApplicationAssembly(
+                new Assembler[][][]
+                    {
+                        {
+                            {
+                                module -> module.transients( 
TestComposite1.class )
+                            },
+                            {
+                                module -> module.transients( 
TestComposite2.class ).visibleIn( Visibility.layer )
+                            }
+                        }
+                    } ) );
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/35c0dde4/core/runtime/src/test/java/org/apache/polygene/runtime/structure/StructureTest.java
----------------------------------------------------------------------
diff --git 
a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/StructureTest.java
 
b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/StructureTest.java
index e43f752..aba2f3b 100644
--- 
a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/StructureTest.java
+++ 
b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/StructureTest.java
@@ -20,16 +20,14 @@
 
 package org.apache.polygene.runtime.structure;
 
-import org.junit.Test;
-import org.apache.polygene.bootstrap.ApplicationAssembler;
 import org.apache.polygene.bootstrap.ApplicationAssemblerAdapter;
 import org.apache.polygene.bootstrap.ApplicationAssembly;
-import org.apache.polygene.bootstrap.ApplicationAssemblyFactory;
 import org.apache.polygene.bootstrap.Assembler;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.Energy4Java;
 import org.apache.polygene.bootstrap.LayerAssembly;
 import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.junit.Test;
 
 /**
  * JAVADOC
@@ -42,24 +40,19 @@ public class StructureTest
         throws AssemblyException
     {
         Energy4Java polygene = new Energy4Java();
-        polygene.newApplication( new ApplicationAssembler()
-        {
-            public ApplicationAssembly assemble( ApplicationAssemblyFactory 
applicationFactory )
-                throws AssemblyException
-            {
-                ApplicationAssembly applicationAssembly = 
applicationFactory.newApplicationAssembly();
-                // Application Layer
-                LayerAssembly applicationLayer = applicationAssembly.layer( 
"Application" );
-                ModuleAssembly applicationModule = applicationLayer.module( 
"Application" );
-                new DomainApplicationAssembler().assemble( applicationModule );
+        polygene.newApplication( factory -> {
+            ApplicationAssembly applicationAssembly = 
factory.newApplicationAssembly();
+            // Application Layer
+            LayerAssembly applicationLayer = applicationAssembly.layer( 
"Application" );
+            ModuleAssembly applicationModule = applicationLayer.module( 
"Application" );
+            new DomainApplicationAssembler().assemble( applicationModule );
 
-                // View Layer
-                LayerAssembly viewLayer = applicationAssembly.layer( "View" );
-                ModuleAssembly viewModule = viewLayer.module( "View" );
-                new ViewAssembler().assemble( viewModule );
-                viewLayer.uses( applicationLayer );
-                return applicationAssembly;
-            }
+            // View Layer
+            LayerAssembly viewLayer = applicationAssembly.layer( "View" );
+            ModuleAssembly viewModule = viewLayer.module( "View" );
+            new ViewAssembler().assemble( viewModule );
+            viewLayer.uses( applicationLayer );
+            return applicationAssembly;
         } );
     }
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/35c0dde4/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java
----------------------------------------------------------------------
diff --git 
a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java
 
b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java
index 2694153..43b6de0 100644
--- 
a/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java
+++ 
b/extensions/indexing-rdf/src/test/java/org/apache/polygene/index/rdf/qi95/Qi95IssueTest.java
@@ -33,9 +33,7 @@ import org.apache.polygene.api.structure.Application;
 import org.apache.polygene.api.structure.Module;
 import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
-import org.apache.polygene.bootstrap.ApplicationAssembler;
 import org.apache.polygene.bootstrap.ApplicationAssembly;
-import org.apache.polygene.bootstrap.ApplicationAssemblyFactory;
 import org.apache.polygene.bootstrap.Assembler;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.Energy4Java;
@@ -183,27 +181,21 @@ public class Qi95IssueTest
         throws AssemblyException
     {
         Energy4Java polygene = new Energy4Java();
-        Application application = polygene.newApplication( new 
ApplicationAssembler()
-        {
-            @Override
-            public ApplicationAssembly assemble( ApplicationAssemblyFactory 
applicationFactory )
-                throws AssemblyException
-            {
-                ApplicationAssembly applicationAssembly = 
applicationFactory.newApplicationAssembly();
+        Application application = polygene.newApplication( factory -> {
+            ApplicationAssembly applicationAssembly = 
factory.newApplicationAssembly();
 
-                LayerAssembly configLayer = applicationAssembly.layer( 
"Config" );
-                configModule.buildModuleAssembly( configLayer, "Configuration" 
);
+            LayerAssembly configLayer = applicationAssembly.layer( "Config" );
+            configModule.buildModuleAssembly( configLayer, "Configuration" );
 
-                LayerAssembly infrastructureLayer = applicationAssembly.layer( 
"Infrastructure" );
-                infrastructureLayer.uses( configLayer );
+            LayerAssembly infrastructureLayer = applicationAssembly.layer( 
"Infrastructure" );
+            infrastructureLayer.uses( configLayer );
 
-                queryServiceModuleBuilder.buildModuleAssembly( 
infrastructureLayer, "Query Service" );
-                entityStoreModuleBuilder.buildModuleAssembly( 
infrastructureLayer, "Entity Store" );
+            queryServiceModuleBuilder.buildModuleAssembly( 
infrastructureLayer, "Query Service" );
+            entityStoreModuleBuilder.buildModuleAssembly( infrastructureLayer, 
"Entity Store" );
 
-                LayerAssembly domainLayer = 
domainLayerBuilder.buildLayerAssembly( applicationAssembly );
-                domainLayer.uses( infrastructureLayer );
-                return applicationAssembly;
-            }
+            LayerAssembly domainLayer = domainLayerBuilder.buildLayerAssembly( 
applicationAssembly );
+            domainLayer.uses( infrastructureLayer );
+            return applicationAssembly;
         } );
         return application;
     }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/35c0dde4/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/Model2XMLTest.java
----------------------------------------------------------------------
diff --git 
a/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/Model2XMLTest.java
 
b/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/Model2XMLTest.java
index 3e652d5..14a8182 100644
--- 
a/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/Model2XMLTest.java
+++ 
b/libraries/rdf/src/test/java/org/apache/polygene/library/rdf/Model2XMLTest.java
@@ -42,30 +42,25 @@ public class Model2XMLTest
     public void testModel2XML() throws AssemblyException, TransformerException
     {
         Energy4Java polygene = new Energy4Java(  );
-        ApplicationDescriptor model = polygene.newApplicationModel( new 
ApplicationAssembler()
-        {
-            @Override
-            public ApplicationAssembly assemble( ApplicationAssemblyFactory 
applicationFactory ) throws AssemblyException
-            {
-                ApplicationAssembly assembly = 
applicationFactory.newApplicationAssembly();
+        ApplicationDescriptor model = polygene.newApplicationModel( factory -> 
{
+            ApplicationAssembly assembly = factory.newApplicationAssembly();
 
-                assembly.setName( "Test application" );
+            assembly.setName( "Test application" );
 
-                LayerAssembly webLayer = assembly.layer( "Web" );
-                LayerAssembly domainLayer = assembly.layer( "Domain" );
-                LayerAssembly infrastructureLayer = assembly.layer( 
"Infrastructure" );
+            LayerAssembly webLayer = assembly.layer( "Web" );
+            LayerAssembly domainLayer = assembly.layer( "Domain" );
+            LayerAssembly infrastructureLayer = assembly.layer( 
"Infrastructure" );
 
-                webLayer.uses( domainLayer, infrastructureLayer );
-                domainLayer.uses( infrastructureLayer );
+            webLayer.uses( domainLayer, infrastructureLayer );
+            domainLayer.uses( infrastructureLayer );
 
-                ModuleAssembly rest = webLayer.module( "REST" );
-                rest.transients( TestTransient.class ).visibleIn( 
Visibility.layer );
-                
-                domainLayer.module( "Domain" );
-                infrastructureLayer.module( "Database" );
+            ModuleAssembly rest = webLayer.module( "REST" );
+            rest.transients( TestTransient.class ).visibleIn( Visibility.layer 
);
 
-                return assembly;
-            }
+            domainLayer.module( "Domain" );
+            infrastructureLayer.module( "Database" );
+
+            return assembly;
         } );
 
         Document document = new Model2XML().apply( model );

Reply via email to