polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paulmer...@apache.org
Subject [08/13] polygene-java git commit: Prefer SingletonAssembler lambda ctor over anonymous override
Date Fri, 26 May 2017 15:00:23 GMT
Prefer SingletonAssembler lambda ctor over anonymous override

Did not do all of them, there are too many
All documentation snippets should be done


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

Branch: refs/heads/develop
Commit: 2a2a28b8d5981c98efd6ec8b9df5fb49f850deb2
Parents: 4d6d5be
Author: Paul Merlin <paulmerlin@apache.org>
Authored: Mon May 22 21:46:23 2017 +0200
Committer: Paul Merlin <paulmerlin@apache.org>
Committed: Mon May 22 21:46:23 2017 +0200

----------------------------------------------------------------------
 .../org/apache/polygene/api/OperatorsTest.java  | 14 ++--
 .../api/docsupport/ApplicationDocs.java         | 11 +---
 .../polygene/bootstrap/ClassScannerTest.java    | 10 +--
 .../bootstrap/DocumentationSupport.java         | 12 +---
 .../polygene/bootstrap/RuntimeMixinsTest.java   | 69 +++++---------------
 .../activation/ApplicationActivationTest.java   | 19 ++----
 .../ImportedServiceActivationTest.java          | 68 ++++++++-----------
 .../runtime/activation/LayerActivationTest.java | 19 ++----
 .../activation/ModuleActivationTest.java        | 19 ++----
 .../activation/ServiceActivationTest.java       | 26 +++-----
 .../ConstructorInjectionOfThisTest.java         | 49 ++++----------
 .../injection/InvocationInjectionTest.java      | 17 ++---
 .../runtime/injection/ServiceInjectionTest.java | 60 +++++++----------
 .../objects/ObjectBuilderFactoryTest.java       | 64 ++++--------------
 .../runtime/objects/ObjectConcernTest.java      | 14 ++--
 .../index/elasticsearch/ESEmbeddedRule.java     |  9 +--
 .../polygene/migration/MigrationTest.java       | 56 ++++++----------
 .../fileconfig/FileConfigurationTest.java       | 42 ++++--------
 .../apache/polygene/library/jmx/JMXTest.java    | 13 +---
 .../library/scripting/HelloSpeakerTest.java     | 27 +++-----
 .../moneytransfer/test/TransferMoneyTest.java   | 21 +++---
 .../moneytransfer/test/TransferMoneyTest2.java  | 29 ++++----
 .../sample/swing/binding/example/Main.java      | 18 ++---
 .../CompositeCreationPerformanceTest.java       | 10 +--
 .../object/ObjectCreationPerformanceTest.java   | 10 +--
 .../ServiceInvocationPerformanceTest.java       | 10 +--
 .../cargo/step2/SequencingConcernTest.java      | 34 ++++------
 .../composites/tutorial10/HelloWorldTest.java   | 16 +----
 .../composites/tutorial3/HelloWorldTest.java    | 16 ++---
 .../composites/tutorial4/HelloWorldTest.java    | 16 ++---
 .../composites/tutorial5/HelloWorldTest.java    | 16 ++---
 .../composites/tutorial6/HelloWorldTest.java    | 16 ++---
 .../composites/tutorial7/HelloWorldTest.java    | 16 ++---
 .../composites/tutorial8/HelloWorldTest.java    | 18 ++---
 .../composites/tutorial9/HelloWorldTest.java    | 18 ++---
 35 files changed, 261 insertions(+), 621 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/core/api/src/test/java/org/apache/polygene/api/OperatorsTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/OperatorsTest.java b/core/api/src/test/java/org/apache/polygene/api/OperatorsTest.java
index 7a0da9a..025f987 100644
--- a/core/api/src/test/java/org/apache/polygene/api/OperatorsTest.java
+++ b/core/api/src/test/java/org/apache/polygene/api/OperatorsTest.java
@@ -33,8 +33,6 @@ import org.apache.polygene.api.unitofwork.UnitOfWork;
 import org.apache.polygene.api.unitofwork.UnitOfWorkCompletionException;
 import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
 import org.apache.polygene.api.value.ValueComposite;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
 import org.apache.polygene.test.EntityTestAssembler;
 import org.junit.Assert;
@@ -47,14 +45,10 @@ public class OperatorsTest
 {
     @Test
     public void testOperators()
-        throws UnitOfWorkCompletionException, ActivationException, AssemblyException
+        throws UnitOfWorkCompletionException, ActivationException
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
+        SingletonAssembler assembler = new SingletonAssembler(
+            module -> {
                 new EntityTestAssembler().assemble( module );
 
                 module.entities( TestEntity.class );
@@ -62,7 +56,7 @@ public class OperatorsTest
                 module.forMixin( TestEntity.class ).declareDefaults().foo().set( "Bar" );
                 module.forMixin( TestValue.class ).declareDefaults().bar().set( "Xyz" );
             }
-        };
+        );
 
         UnitOfWorkFactory uowf = assembler.module().unitOfWorkFactory();
         UnitOfWork uow = uowf.newUnitOfWork();

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/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 5032206..de60c22 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
@@ -37,14 +37,9 @@ public class ApplicationDocs
     {
         {
 // START SNIPPET: application1
-            SingletonAssembler polygene = new SingletonAssembler()
-            {
-                public void assemble( ModuleAssembly assembly )
-                    throws AssemblyException
-                {
-                    assembly.values( MyStuffValueComposite.class );
-                }
-            };
+            SingletonAssembler polygene = new SingletonAssembler(
+                module -> module.values( MyStuffValueComposite.class )
+            );
 // END SNIPPET: application1
         }
         {

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/ClassScannerTest.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/ClassScannerTest.java b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/ClassScannerTest.java
index 0d3e53f..49697ca 100644
--- a/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/ClassScannerTest.java
+++ b/core/bootstrap/src/test/java/org/apache/polygene/bootstrap/ClassScannerTest.java
@@ -36,17 +36,13 @@ public class ClassScannerTest
     public void testClassScannerFiles()
         throws ActivationException, AssemblyException
     {
-        SingletonAssembler singleton = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
+        SingletonAssembler singleton = new SingletonAssembler(
+            module -> {
                 // Find all classes starting from TestValue, but include only the ones that are named *Value
                 findClasses( TestValue.class ).filter( matches( ".*Value" ) )
                                               .forEach( module::values );
             }
-        };
+        );
 
         singleton.module().newValueBuilder( TestValue.class );
         singleton.module().newValueBuilder( Test2Value.class );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/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 59f1f2c..591bacc 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
@@ -201,19 +201,13 @@ public class DocumentationSupport
             throws ActivationException, AssemblyException
         {
             // START SNIPPET: singleton
-            SingletonAssembler assembler = new SingletonAssembler()
-            {
-
-                @Override
-                public void assemble( ModuleAssembly module )
-                        throws AssemblyException
-                {
+            SingletonAssembler assembler = new SingletonAssembler(
+                module -> {
                     module.services( MyService.class ).identifiedBy( "Foo" );
                     module.services( MyService.class ).identifiedBy( "Bar" );
                     module.objects( Stuff.class );
                 }
-
-            };
+            );
             Module module = assembler.module();
             Stuff stuff = module.newObject( Stuff.class );
             // END SNIPPET: singleton

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/core/runtime/src/test/java/org/apache/polygene/bootstrap/RuntimeMixinsTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/bootstrap/RuntimeMixinsTest.java b/core/runtime/src/test/java/org/apache/polygene/bootstrap/RuntimeMixinsTest.java
index cdf8ead..1283272 100644
--- a/core/runtime/src/test/java/org/apache/polygene/bootstrap/RuntimeMixinsTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/bootstrap/RuntimeMixinsTest.java
@@ -35,10 +35,7 @@ public class RuntimeMixinsTest
         throws ActivationException
     {
         SingletonAssembler singletonAssembler = new SingletonAssembler(
-            module ->
-            {
-                module.values( SayWhat.class ).withMixins( SayThisMixin.class, SayThatMixin.class );
-            }
+            module -> module.values( SayWhat.class ).withMixins( SayThisMixin.class, SayThatMixin.class )
         );
 
         SayWhat value = singletonAssembler.valueBuilderFactory().newValue( SayWhat.class );
@@ -50,15 +47,9 @@ public class RuntimeMixinsTest
     public void givenValueWithRuntimeMixinOverrideWhenAssembledExpectCorrectComposition()
         throws ActivationException
     {
-        SingletonAssembler singletonAssembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.values( SayWhere.class ).withMixins( SayHereMixin.class );
-            }
-        };
+        SingletonAssembler singletonAssembler = new SingletonAssembler(
+            module -> module.values( SayWhere.class ).withMixins( SayHereMixin.class )
+        );
         SayWhere value = singletonAssembler.valueBuilderFactory().newValue( SayWhere.class );
         assertThat( value.sayHere(), equalTo( "here" ) );
         assertThat( value.sayThere(), nullValue() );
@@ -68,16 +59,9 @@ public class RuntimeMixinsTest
     public void givenTransientWithRuntimeMixinsWhenAssembledExpectCorrectComposition()
         throws ActivationException
     {
-        SingletonAssembler singletonAssembler = new SingletonAssembler()
-        {
-
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.transients( SayWhat.class ).withMixins( SayThisMixin.class, SayThatMixin.class );
-            }
-        };
+        SingletonAssembler singletonAssembler = new SingletonAssembler(
+            module -> module.transients( SayWhat.class ).withMixins( SayThisMixin.class, SayThatMixin.class )
+        );
         SayWhat value = singletonAssembler.transientBuilderFactory().newTransient( SayWhat.class );
         assertThat( value.sayThis(), equalTo( "this" ) );
         assertThat( value.sayThat(), equalTo( "that" ) );
@@ -87,16 +71,9 @@ public class RuntimeMixinsTest
     public void givenTransientWithRuntimeMixinOverrideWhenAssembledExpectCorrectComposition()
         throws ActivationException
     {
-        SingletonAssembler singletonAssembler = new SingletonAssembler()
-        {
-
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.transients( SayWhere.class ).withMixins( SayHereMixin.class );
-            }
-        };
+        SingletonAssembler singletonAssembler = new SingletonAssembler(
+            module -> module.transients( SayWhere.class ).withMixins( SayHereMixin.class )
+        );
         SayWhere value = singletonAssembler.transientBuilderFactory().newTransient( SayWhere.class );
         assertThat( value.sayHere(), equalTo( "here" ) );
         assertThat( value.sayThere(), nullValue() );
@@ -106,16 +83,9 @@ public class RuntimeMixinsTest
     public void givenServiceWithRuntimeMixinsWhenAssembledExpectCorrectComposition()
         throws ActivationException
     {
-        SingletonAssembler singletonAssembler = new SingletonAssembler()
-        {
-
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.services( SayWhat.class ).withMixins( SayThisMixin.class, SayThatMixin.class );
-            }
-        };
+        SingletonAssembler singletonAssembler = new SingletonAssembler(
+            module -> module.services( SayWhat.class ).withMixins( SayThisMixin.class, SayThatMixin.class )
+        );
         SayWhat value = singletonAssembler.serviceFinder().findService( SayWhat.class ).get();
         assertThat( value.sayThis(), equalTo( "this" ) );
         assertThat( value.sayThat(), equalTo( "that" ) );
@@ -125,16 +95,9 @@ public class RuntimeMixinsTest
     public void givenServiceWithRuntimeMixinOverrideWhenAssembledExpectCorrectComposition()
         throws ActivationException
     {
-        SingletonAssembler singletonAssembler = new SingletonAssembler()
-        {
-
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.services( SayWhere.class ).withMixins( SayHereMixin.class );
-            }
-        };
+        SingletonAssembler singletonAssembler = new SingletonAssembler(
+            module -> module.services( SayWhere.class ).withMixins( SayHereMixin.class )
+        );
         SayWhere value = singletonAssembler.serviceFinder().findService( SayWhere.class ).get();
         assertThat( value.sayHere(), equalTo( "here" ) );
         assertThat( value.sayThere(), nullValue() );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ApplicationActivationTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ApplicationActivationTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ApplicationActivationTest.java
index 95084a4..d8fb864 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ApplicationActivationTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ApplicationActivationTest.java
@@ -19,13 +19,11 @@
  */
 package org.apache.polygene.runtime.activation;
 
-import org.junit.Assert;
-import org.junit.Test;
 import org.apache.polygene.api.activation.Activator;
 import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
+import org.junit.Assert;
+import org.junit.Test;
 
 public class ApplicationActivationTest
 {
@@ -64,16 +62,9 @@ public class ApplicationActivationTest
     public void testApplicationActivator()
             throws Exception
     {
-        SingletonAssembler assembly = new SingletonAssembler()
-        {
-
-            public void assemble( ModuleAssembly module )
-                    throws AssemblyException
-            {
-                module.layer().application().withActivators( TestedActivator.class );
-            }
-
-        };
+        SingletonAssembler assembly = new SingletonAssembler(
+            module -> module.layer().application().withActivators( TestedActivator.class )
+        );
 
         // Activate
         Application application = assembly.application();

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ImportedServiceActivationTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ImportedServiceActivationTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ImportedServiceActivationTest.java
index 6d65488..e5f7a7c 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ImportedServiceActivationTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ImportedServiceActivationTest.java
@@ -19,10 +19,8 @@
  */
 package org.apache.polygene.runtime.activation;
 
-import org.apache.polygene.api.identity.StringIdentity;
-import org.junit.Before;
-import org.junit.Test;
 import org.apache.polygene.api.activation.Activator;
+import org.apache.polygene.api.identity.StringIdentity;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.service.ImportedServiceDescriptor;
 import org.apache.polygene.api.service.ServiceComposite;
@@ -30,12 +28,15 @@ import org.apache.polygene.api.service.ServiceImporter;
 import org.apache.polygene.api.service.ServiceImporterException;
 import org.apache.polygene.api.service.ServiceReference;
 import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ImportedServiceDeclaration;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
+import org.junit.Before;
+import org.junit.Test;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 public class ImportedServiceActivationTest
 {
@@ -139,19 +140,12 @@ public class ImportedServiceActivationTest
     public void testNewInstanceImportedServiceActivators()
             throws Exception
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-
-            public void assemble( ModuleAssembly module )
-                    throws AssemblyException
-            {
-                module.importedServices( TestedService.class ).
-                        withActivators( TestedActivator.class ).
-                        setMetaInfo( new TestedServiceInstance() ).
-                        importOnStartup();
-            }
-
-        };
+        SingletonAssembler assembler = new SingletonAssembler(
+            module -> module.importedServices( TestedService.class )
+                            .withActivators( TestedActivator.class )
+                            .setMetaInfo( new TestedServiceInstance() )
+                            .importOnStartup()
+        );
         Application application = assembler.application();
         assertEquals( "Activation Level", 2, activationLevel );
         application.passivate();
@@ -162,20 +156,15 @@ public class ImportedServiceActivationTest
     public void testNewObjectImportedServiceActivators()
             throws Exception
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-
-            public void assemble( ModuleAssembly module )
-                    throws AssemblyException
-            {
+        SingletonAssembler assembler = new SingletonAssembler(
+            module -> {
                 module.importedServices( TestedService.class ).
-                        importedBy( ImportedServiceDeclaration.NEW_OBJECT ).
-                        withActivators( TestedActivator.class ).
-                        importOnStartup();
+                    importedBy( ImportedServiceDeclaration.NEW_OBJECT ).
+                          withActivators( TestedActivator.class ).
+                          importOnStartup();
                 module.objects( TestedServiceInstance.class );
             }
-
-        };
+        );
         Application application = assembler.application();
         assertEquals( "Activation Level", 2, activationLevel );
         application.passivate();
@@ -186,21 +175,16 @@ public class ImportedServiceActivationTest
     public void testServiceImporterImportedServiceActivators()
             throws Exception
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-
-            public void assemble( ModuleAssembly module )
-                    throws AssemblyException
-            {
+        SingletonAssembler assembler = new SingletonAssembler(
+            module -> {
                 module.importedServices( TestedService.class ).
-                        importedBy( ImportedServiceDeclaration.SERVICE_IMPORTER ).
-                        setMetaInfo( new StringIdentity( "testimporter" ) ).
-                        withActivators( TestedActivator.class ).
-                        importOnStartup();
+                    importedBy( ImportedServiceDeclaration.SERVICE_IMPORTER ).
+                          setMetaInfo( new StringIdentity( "testimporter" ) ).
+                          withActivators( TestedActivator.class ).
+                          importOnStartup();
                 module.services( TestedServiceImporterService.class ).identifiedBy( "testimporter" );
             }
-
-        };
+        );
         Application application = assembler.application();
         assertEquals( "Activation Level", 2, activationLevel );
         application.passivate();

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/core/runtime/src/test/java/org/apache/polygene/runtime/activation/LayerActivationTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/activation/LayerActivationTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/activation/LayerActivationTest.java
index cfa7a57..f6d5e7c 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/activation/LayerActivationTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/activation/LayerActivationTest.java
@@ -19,14 +19,12 @@
  */
 package org.apache.polygene.runtime.activation;
 
-import org.junit.Assert;
-import org.junit.Test;
 import org.apache.polygene.api.activation.Activator;
 import org.apache.polygene.api.structure.Application;
 import org.apache.polygene.api.structure.Layer;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
+import org.junit.Assert;
+import org.junit.Test;
 
 public class LayerActivationTest
 {
@@ -65,16 +63,9 @@ public class LayerActivationTest
     public void testLayersActivators()
             throws Exception
     {
-        SingletonAssembler assembly = new SingletonAssembler()
-        {
-
-            public void assemble( ModuleAssembly module )
-                    throws AssemblyException
-            {
-                module.layer().withActivators( TestedActivator.class );
-            }
-
-        };
+        SingletonAssembler assembly = new SingletonAssembler(
+            module -> module.layer().withActivators( TestedActivator.class )
+        );
         // Activate
         Application application = assembly.application();
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ModuleActivationTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ModuleActivationTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ModuleActivationTest.java
index b6e3e2a..74b9b89 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ModuleActivationTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ModuleActivationTest.java
@@ -19,14 +19,12 @@
  */
 package org.apache.polygene.runtime.activation;
 
-import org.junit.Assert;
-import org.junit.Test;
 import org.apache.polygene.api.activation.Activator;
 import org.apache.polygene.api.structure.Application;
 import org.apache.polygene.api.structure.Module;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
+import org.junit.Assert;
+import org.junit.Test;
 
 public class ModuleActivationTest
 {
@@ -65,16 +63,9 @@ public class ModuleActivationTest
     public void testModulesActivators()
             throws Exception
     {
-        SingletonAssembler assembly = new SingletonAssembler()
-        {
-
-            public void assemble( ModuleAssembly module )
-                    throws AssemblyException
-            {
-                module.withActivators( TestedActivator.class );
-            }
-
-        };
+        SingletonAssembler assembly = new SingletonAssembler(
+            module -> module.withActivators( TestedActivator.class )
+        );
         // Activate
         Application application = assembly.application();
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ServiceActivationTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ServiceActivationTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ServiceActivationTest.java
index 708c6fa..2355314 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ServiceActivationTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/activation/ServiceActivationTest.java
@@ -19,17 +19,14 @@
  */
 package org.apache.polygene.runtime.activation;
 
-import org.junit.Assert;
-import org.junit.Test;
-
 import org.apache.polygene.api.activation.Activator;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.service.ServiceComposite;
 import org.apache.polygene.api.service.ServiceReference;
 import org.apache.polygene.api.structure.Application;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
+import org.junit.Assert;
+import org.junit.Test;
 
 public class ServiceActivationTest
 {
@@ -114,21 +111,16 @@ public class ServiceActivationTest
     public void testServicesActivators()
             throws Exception
     {
-        SingletonAssembler assembly = new SingletonAssembler()
-        {
-
-            public void assemble( ModuleAssembly module )
-                    throws AssemblyException
-            {
+        SingletonAssembler assembly = new SingletonAssembler(
+            module -> {
                 module.addServices( TestedServiceComposite.class ).
-                        withActivators( TestedActivator.class ).
-                        instantiateOnStartup();
+                    withActivators( TestedActivator.class ).
+                          instantiateOnStartup();
                 module.addServices( TestedServiceComposite2.class ).
-                        withActivators( TestedActivator.class ).
-                        instantiateOnStartup();
+                    withActivators( TestedActivator.class ).
+                          instantiateOnStartup();
             }
-
-        };
+        );
         // Activate
         Application application = assembly.application();
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/core/runtime/src/test/java/org/apache/polygene/runtime/injection/ConstructorInjectionOfThisTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/ConstructorInjectionOfThisTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/ConstructorInjectionOfThisTest.java
index e7ecdc2..41791f7 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/ConstructorInjectionOfThisTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/ConstructorInjectionOfThisTest.java
@@ -19,7 +19,6 @@
  */
 package org.apache.polygene.runtime.injection;
 
-import org.junit.Test;
 import org.apache.polygene.api.activation.ActivationException;
 import org.apache.polygene.api.common.UseDefaults;
 import org.apache.polygene.api.concern.ConcernOf;
@@ -28,9 +27,8 @@ import org.apache.polygene.api.mixin.NoopMixin;
 import org.apache.polygene.api.property.Property;
 import org.apache.polygene.api.sideeffect.SideEffectOf;
 import org.apache.polygene.api.structure.Module;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
+import org.junit.Test;
 
 import static org.junit.Assert.assertFalse;
 
@@ -42,18 +40,11 @@ public class ConstructorInjectionOfThisTest
 
     @Test
     public void givenMixinWithThisInConstructorWhenCreatingModelExpectNoException()
-        throws ActivationException, AssemblyException
+        throws ActivationException
     {
-        SingletonAssembler singletonAssembler = new SingletonAssembler()
-        {
-
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.values( Does.class ).withMixins( DoesMixin.class );
-            }
-        };
+        SingletonAssembler singletonAssembler = new SingletonAssembler(
+            module -> module.values( Does.class ).withMixins( DoesMixin.class )
+        );
         Module module = singletonAssembler.application().findModule( "Layer 1", "Module 1" );
         Does does = module.newValue( Does.class );
         does.doSomething();
@@ -61,18 +52,11 @@ public class ConstructorInjectionOfThisTest
 
     @Test
     public void givenConcernWithThisInConstructorWhenCreatingModelExpectNoException()
-        throws ActivationException, AssemblyException
+        throws ActivationException
     {
-        SingletonAssembler singletonAssembler = new SingletonAssembler()
-        {
-
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.values( Does.class ).withMixins( NoopMixin.class ).withConcerns( DoesConcern.class );
-            }
-        };
+        SingletonAssembler singletonAssembler = new SingletonAssembler(
+            module -> module.values( Does.class ).withMixins( NoopMixin.class ).withConcerns( DoesConcern.class )
+        );
         Module module = singletonAssembler.application().findModule( "Layer 1", "Module 1" );
         Does does = module.newValue( Does.class );
         does.doSomething();
@@ -80,18 +64,11 @@ public class ConstructorInjectionOfThisTest
 
     @Test
     public void givenSideEffectWithThisInConstructorWhenCreatingModelExpectNoException()
-        throws ActivationException, AssemblyException
+        throws ActivationException
     {
-        SingletonAssembler singletonAssembler = new SingletonAssembler()
-        {
-
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.values( Does.class ).withMixins( NoopMixin.class ).withSideEffects( DoesSideEffect.class );
-            }
-        };
+        SingletonAssembler singletonAssembler = new SingletonAssembler(
+            module -> module.values( Does.class ).withMixins( NoopMixin.class ).withSideEffects( DoesSideEffect.class )
+        );
         Module module = singletonAssembler.application().findModule( "Layer 1", "Module 1" );
         Does does = module.newValue( Does.class );
         does.doSomething();

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/core/runtime/src/test/java/org/apache/polygene/runtime/injection/InvocationInjectionTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/InvocationInjectionTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/InvocationInjectionTest.java
index 045f722..91bacbc 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/InvocationInjectionTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/InvocationInjectionTest.java
@@ -23,17 +23,15 @@ package org.apache.polygene.runtime.injection;
 import java.lang.annotation.Retention;
 import java.lang.reflect.AnnotatedElement;
 import java.lang.reflect.Method;
-import org.hamcrest.CoreMatchers;
-import org.junit.Assert;
-import org.junit.Test;
 import org.apache.polygene.api.composite.TransientComposite;
 import org.apache.polygene.api.concern.ConcernOf;
 import org.apache.polygene.api.concern.Concerns;
 import org.apache.polygene.api.injection.scope.Invocation;
 import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
+import org.hamcrest.CoreMatchers;
+import org.junit.Assert;
+import org.junit.Test;
 
 import static java.lang.annotation.RetentionPolicy.RUNTIME;
 
@@ -46,14 +44,7 @@ public class InvocationInjectionTest
     public void whenInvocationInjectionWithMethodWhenInjectedThenInjectMethod()
         throws Exception
     {
-        SingletonAssembler assembly = new SingletonAssembler()
-        {
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.transients( MyComposite.class );
-            }
-        };
+        SingletonAssembler assembly = new SingletonAssembler( module -> module.transients( MyComposite.class ) );
 
         MyComposite composite = assembly.module().newTransient( MyComposite.class );
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/core/runtime/src/test/java/org/apache/polygene/runtime/injection/ServiceInjectionTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/ServiceInjectionTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/ServiceInjectionTest.java
index e0d8f6b..10d47b9 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/injection/ServiceInjectionTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/injection/ServiceInjectionTest.java
@@ -39,7 +39,6 @@ import org.apache.polygene.api.service.qualifier.AnnotationQualifier;
 import org.apache.polygene.api.service.qualifier.IdentifiedBy;
 import org.apache.polygene.api.service.qualifier.Qualifier;
 import org.apache.polygene.bootstrap.ApplicationAssembly;
-import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.LayerAssembly;
 import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.ServiceDeclaration;
@@ -61,21 +60,18 @@ public class ServiceInjectionTest
     public void testInjectService()
         throws Exception
     {
-        SingletonAssembler assembly = new SingletonAssembler()
-        {
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
+        SingletonAssembler assembly = new SingletonAssembler(
+            module -> {
                 module.services( MyServiceComposite.class )
-                    .identifiedBy( "Foo" )
-                    .setMetaInfo( new ServiceName( "Foo" ) );
+                      .identifiedBy( "Foo" )
+                      .setMetaInfo( new ServiceName( "Foo" ) );
                 module.services( MyServiceComposite2.class )
-                    .identifiedBy( "Bar" )
-                    .setMetaInfo( new ServiceName( "Bar" ) );
+                      .identifiedBy( "Bar" )
+                      .setMetaInfo( new ServiceName( "Bar" ) );
                 module.services( StringService.class, LongService.class );
                 module.objects( ServiceUser.class );
             }
-        };
+        );
 
         testInjection( assembly );
     }
@@ -97,16 +93,13 @@ public class ServiceInjectionTest
 
     @Test
     public void testInjectionServiceBetweenModules()
-        throws ActivationException, AssemblyException
+        throws ActivationException
     {
-        SingletonAssembler assembly = new SingletonAssembler()
-        {
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
+        SingletonAssembler assembly = new SingletonAssembler(
+            module -> {
                 module.services( MyServiceComposite.class )
-                    .identifiedBy( "Foo" )
-                    .setMetaInfo( new ServiceName( "Foo" ) );
+                      .identifiedBy( "Foo" )
+                      .setMetaInfo( new ServiceName( "Foo" ) );
                 module.services( StringService.class, LongService.class );
                 module.objects( ServiceUser.class );
 
@@ -117,23 +110,20 @@ public class ServiceInjectionTest
                 ServiceDeclaration service3Decl = module2.services( MyServiceComposite2.class );
                 service3Decl.identifiedBy( "Boo" ).setMetaInfo( new ServiceName( "Boo" ) );
             }
-        };
+        );
 
         testInjection( assembly );
     }
 
     @Test
     public void testInjectionServiceBetweenLayers()
-        throws ActivationException, AssemblyException
+        throws ActivationException
     {
-        SingletonAssembler assembly = new SingletonAssembler()
-        {
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
+        SingletonAssembler assembly = new SingletonAssembler(
+            module -> {
                 module.services( MyServiceComposite.class )
-                    .identifiedBy( "Foo" )
-                    .setMetaInfo( new ServiceName( "Foo" ) );
+                      .identifiedBy( "Foo" )
+                      .setMetaInfo( new ServiceName( "Foo" ) );
                 module.services( StringService.class, LongService.class );
                 LayerAssembly layerAssembly = module.layer();
                 module.objects( ServiceUser.class );
@@ -147,24 +137,18 @@ public class ServiceInjectionTest
                 ServiceDeclaration service2Decl = module2.services( MyServiceComposite2.class );
                 service2Decl.identifiedBy( "Bar" ).setMetaInfo( new ServiceName( "Bar" ) ).visibleIn( application );
             }
-        };
+        );
 
         testInjection( assembly );
     }
 
     @Test( expected = ConstructionException.class )
     public void testMissingServiceDependency()
-        throws ActivationException, AssemblyException
+        throws ActivationException
     {
         // No service fulfils the dependency injection -> fail to create application
-        new SingletonAssembler()
-        {
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.objects( ServiceUser.class );
-            }
-        }.module().newObject( ServiceUser.class );
+        new SingletonAssembler( module -> module.objects( ServiceUser.class ) )
+            .module().newObject( ServiceUser.class );
     }
 
     @Mixins( MyServiceMixin.class )

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/core/runtime/src/test/java/org/apache/polygene/runtime/objects/ObjectBuilderFactoryTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/objects/ObjectBuilderFactoryTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/objects/ObjectBuilderFactoryTest.java
index f978aa0..39cb71c 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/objects/ObjectBuilderFactoryTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/objects/ObjectBuilderFactoryTest.java
@@ -20,16 +20,14 @@
 
 package org.apache.polygene.runtime.objects;
 
-import org.junit.Assert;
-import org.junit.Test;
 import org.apache.polygene.api.activation.ActivationException;
 import org.apache.polygene.api.injection.scope.Structure;
 import org.apache.polygene.api.injection.scope.Uses;
 import org.apache.polygene.api.object.NoSuchObjectException;
 import org.apache.polygene.api.structure.Module;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
+import org.junit.Assert;
+import org.junit.Test;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.notNullValue;
@@ -49,13 +47,7 @@ public class ObjectBuilderFactoryTest
     public void newBuilderForUnregisteredObject()
         throws Exception
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-            }
-        };
+        SingletonAssembler assembler = new SingletonAssembler( module -> {} );
         assembler.module().newObject( AnyObject.class );
     }
 
@@ -68,13 +60,7 @@ public class ObjectBuilderFactoryTest
     public void newBuilderForNullType()
         throws Exception
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-            }
-        };
+        SingletonAssembler assembler = new SingletonAssembler( module -> {} );
         assembler.module().newObject( null );
     }
 
@@ -87,13 +73,7 @@ public class ObjectBuilderFactoryTest
     public void newObjectInstanceForNullType()
         throws Exception
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-            }
-        };
+        SingletonAssembler assembler = new SingletonAssembler( module -> {} );
         assembler.module().newObject( null );
     }
 
@@ -102,31 +82,17 @@ public class ObjectBuilderFactoryTest
      */
     @Test
     public void newInstanceForRegisteredObject()
-        throws ActivationException, AssemblyException
+        throws ActivationException
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.objects( AnyObject.class );
-            }
-        };
+        SingletonAssembler assembler = new SingletonAssembler( module -> module.objects( AnyObject.class ) );
         assembler.module().newObject( AnyObject.class );
     }
 
     @Test
     public void givenManyConstructorsWhenInstantiateThenChooseCorrectConstructor()
-        throws ActivationException, AssemblyException
+        throws ActivationException
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.objects( ManyConstructorObject.class );
-            }
-        };
+        SingletonAssembler assembler = new SingletonAssembler( module -> module.objects( ManyConstructorObject.class ) );
 
         ManyConstructorObject object = assembler.module().newObject( ManyConstructorObject.class );
         Assert.assertThat( "ref is not null", object.anyObject, notNullValue() );
@@ -139,17 +105,9 @@ public class ObjectBuilderFactoryTest
 
     @Test
     public void givenClassWithInnerClassesWhenInstantiateThenInstantiateInnerClass()
-        throws ActivationException, AssemblyException
+        throws ActivationException
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.objects( OuterClass.class );
-            }
-        };
+        SingletonAssembler assembler = new SingletonAssembler( module -> module.objects( OuterClass.class ) );
 
         Assert.assertThat( "inner class has been injected", assembler.module()
             .newObject( OuterClass.class )

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/core/runtime/src/test/java/org/apache/polygene/runtime/objects/ObjectConcernTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/objects/ObjectConcernTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/objects/ObjectConcernTest.java
index 2af7434..28922ba 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/objects/ObjectConcernTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/objects/ObjectConcernTest.java
@@ -21,13 +21,12 @@
 package org.apache.polygene.runtime.objects;
 
 import java.lang.reflect.Method;
-import org.junit.Test;
 import org.apache.polygene.api.activation.ActivationException;
 import org.apache.polygene.api.concern.Concerns;
 import org.apache.polygene.api.concern.GenericConcern;
 import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
+import org.junit.Test;
 
 /**
  * JAVADOC
@@ -39,14 +38,9 @@ public class ObjectConcernTest
     public void testConcernOnObject()
         throws ActivationException, AssemblyException
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.objects( TestObject.class );
-            }
-        };
+        SingletonAssembler assembler = new SingletonAssembler(
+            module -> module.objects( TestObject.class )
+        );
 
         TestObject object = assembler.module().newObject( TestObject.class );
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ESEmbeddedRule.java
----------------------------------------------------------------------
diff --git a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ESEmbeddedRule.java b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ESEmbeddedRule.java
index df3e422..8c9807c 100644
--- a/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ESEmbeddedRule.java
+++ b/extensions/indexing-elasticsearch/src/test/java/org/apache/polygene/index/elasticsearch/ESEmbeddedRule.java
@@ -97,11 +97,8 @@ public class ESEmbeddedRule implements TestRule
     {
         try
         {
-            return new SingletonAssembler()
-            {
-                @Override
-                public void assemble( final ModuleAssembly module ) throws AssemblyException
-                {
+            return new SingletonAssembler(
+                module -> {
                     module.layer().application().setName( name );
                     ModuleAssembly config = module.layer().module( "config" );
                     new EntityTestAssembler().assemble( config );
@@ -114,7 +111,7 @@ public class ESEmbeddedRule implements TestRule
                         .withConfig( config, Visibility.layer )
                         .assemble( module );
                 }
-            };
+            );
         }
         catch( ActivationException | AssemblyException ex )
         {

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/extensions/migration/src/test/java/org/apache/polygene/migration/MigrationTest.java
----------------------------------------------------------------------
diff --git a/extensions/migration/src/test/java/org/apache/polygene/migration/MigrationTest.java b/extensions/migration/src/test/java/org/apache/polygene/migration/MigrationTest.java
index 53d80d8..b47656c 100644
--- a/extensions/migration/src/test/java/org/apache/polygene/migration/MigrationTest.java
+++ b/extensions/migration/src/test/java/org/apache/polygene/migration/MigrationTest.java
@@ -103,16 +103,12 @@ public class MigrationTest
         // Set up version 1
         List<String> data_v1;
         {
-            SingletonAssembler v1 = new SingletonAssembler()
-            {
-                @Override
-                public void assemble( ModuleAssembly module )
-                    throws AssemblyException
-                {
-                    MigrationTest.this.assemble( module );
-                    module.layer().application().setVersion( "1.0" );
+            SingletonAssembler v1 = new SingletonAssembler(
+                moduleAssembly -> {
+                    MigrationTest.this.assemble( moduleAssembly );
+                    moduleAssembly.layer().application().setVersion( "1.0" );
                 }
-            };
+            );
 
             UnitOfWork uow = v1.module().unitOfWorkFactory().newUnitOfWork();
             TestEntity1_0 entity = uow.newEntity( TestEntity1_0.class );
@@ -132,16 +128,12 @@ public class MigrationTest
         // Set up version 1.1
         List<String> data_v1_1;
         {
-            SingletonAssembler v1_1 = new SingletonAssembler()
-            {
-                @Override
-                public void assemble( ModuleAssembly module )
-                    throws AssemblyException
-                {
-                    MigrationTest.this.assemble( module );
-                    module.layer().application().setVersion( "1.1" );
+            SingletonAssembler v1_1 = new SingletonAssembler(
+                moduleAssembly -> {
+                    MigrationTest.this.assemble( moduleAssembly );
+                    moduleAssembly.layer().application().setVersion( "1.1" );
                 }
-            };
+            );
 
             BackupRestore testData = v1_1.module().findService( BackupRestore.class ).get();
             testData.restore( data_v1.stream() );
@@ -161,16 +153,12 @@ public class MigrationTest
 
         // Set up version 2.0
         {
-            SingletonAssembler v2_0 = new SingletonAssembler()
-            {
-                @Override
-                public void assemble( ModuleAssembly module )
-                    throws AssemblyException
-                {
-                    MigrationTest.this.assemble( module );
-                    module.layer().application().setVersion( "2.0" );
+            SingletonAssembler v2_0 = new SingletonAssembler(
+                moduleAssembly -> {
+                    MigrationTest.this.assemble( moduleAssembly );
+                    moduleAssembly.layer().application().setVersion( "2.0" );
                 }
-            };
+            );
 
             BackupRestore testData = v2_0.module().findService( BackupRestore.class ).get();
 
@@ -189,16 +177,12 @@ public class MigrationTest
 
         // Set up version 3.0
         {
-            SingletonAssembler v3_0 = new SingletonAssembler()
-            {
-                @Override
-                public void assemble( ModuleAssembly module )
-                    throws AssemblyException
-                {
-                    MigrationTest.this.assemble( module );
-                    module.layer().application().setVersion( "3.0" );
+            SingletonAssembler v3_0 = new SingletonAssembler(
+                moduleAssembly -> {
+                    MigrationTest.this.assemble( moduleAssembly );
+                    moduleAssembly.layer().application().setVersion( "3.0" );
                 }
-            };
+            );
 
             BackupRestore testData = v3_0.module().findService( BackupRestore.class ).get();
             testData.restore( data_v1_1.stream() );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/libraries/fileconfig/src/test/java/org/apache/polygene/library/fileconfig/FileConfigurationTest.java
----------------------------------------------------------------------
diff --git a/libraries/fileconfig/src/test/java/org/apache/polygene/library/fileconfig/FileConfigurationTest.java b/libraries/fileconfig/src/test/java/org/apache/polygene/library/fileconfig/FileConfigurationTest.java
index 6f34efb..4cf5ac2 100644
--- a/libraries/fileconfig/src/test/java/org/apache/polygene/library/fileconfig/FileConfigurationTest.java
+++ b/libraries/fileconfig/src/test/java/org/apache/polygene/library/fileconfig/FileConfigurationTest.java
@@ -21,12 +21,10 @@ package org.apache.polygene.library.fileconfig;
 
 import java.io.File;
 import java.io.IOException;
-import org.junit.Rule;
-import org.junit.Test;
 import org.apache.polygene.api.activation.ActivationException;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
+import org.junit.Rule;
+import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
 
 import static org.junit.Assert.assertEquals;
@@ -39,19 +37,15 @@ public class FileConfigurationTest
 
     @Test
     public void testFileConfiguration()
-        throws ActivationException, AssemblyException
+        throws ActivationException
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
+        SingletonAssembler assembler = new SingletonAssembler(
+            module -> {
                 // START SNIPPET: simple
                 new FileConfigurationAssembler().assemble( module );
                 // END SNIPPET: simple
             }
-        };
+        );
 
         FileConfiguration config = assembler.module().findService( FileConfiguration.class ).get();
         assertNotNull( config.configurationDirectory() );
@@ -69,7 +63,7 @@ public class FileConfigurationTest
 
     @Test
     public void testFileConfigurationOverride()
-        throws IOException, ActivationException, AssemblyException
+        throws IOException, ActivationException
     {
         File testFile = tmpDir.getRoot();
         final File confDir = testFile;
@@ -77,12 +71,8 @@ public class FileConfigurationTest
         final File tempDir = testFile;
         final File cacheDir = testFile;
         final File logDir = testFile;
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
+        SingletonAssembler assembler = new SingletonAssembler(
+            module -> {
                 // START SNIPPET: override
                 FileConfigurationOverride override = new FileConfigurationOverride()
                     .withConfiguration( confDir )
@@ -93,7 +83,7 @@ public class FileConfigurationTest
                 new FileConfigurationAssembler().withOverride( override ).assemble( module );
                 // END SNIPPET: override
             }
-        };
+        );
 
         FileConfiguration config = assembler.module().findService( FileConfiguration.class ).get();
 
@@ -106,22 +96,18 @@ public class FileConfigurationTest
 
     @Test
     public void testFileConfigurationOverrideConvention()
-        throws IOException, ActivationException, AssemblyException
+        throws IOException, ActivationException
     {
         File rootDir = tmpDir.getRoot();
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
+        SingletonAssembler assembler = new SingletonAssembler(
+            module -> {
                 // START SNIPPET: override-convention
                 new FileConfigurationAssembler()
                     .withOverride( new FileConfigurationOverride().withConventionalRoot( rootDir ) )
                     .assemble( module );
                 // END SNIPPET: override-convention
             }
-        };
+        );
 
         FileConfiguration config = assembler.module().findService( FileConfiguration.class ).get();
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/libraries/jmx/src/test/java/org/apache/polygene/library/jmx/JMXTest.java
----------------------------------------------------------------------
diff --git a/libraries/jmx/src/test/java/org/apache/polygene/library/jmx/JMXTest.java b/libraries/jmx/src/test/java/org/apache/polygene/library/jmx/JMXTest.java
index 0f0d041..4db31b2 100644
--- a/libraries/jmx/src/test/java/org/apache/polygene/library/jmx/JMXTest.java
+++ b/libraries/jmx/src/test/java/org/apache/polygene/library/jmx/JMXTest.java
@@ -71,16 +71,9 @@ public class JMXTest extends AbstractPolygeneTest
     public static void main(String[] args )
         throws InterruptedException, ActivationException, AssemblyException
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                    throws AssemblyException
-            {
-                new JMXTest().assemble(module);
-            }
-
-        };
+        SingletonAssembler assembler = new SingletonAssembler(
+            moduleAssembly -> new JMXTest().assemble(moduleAssembly)
+        );
         // This allows user to connect using VisualVM/JConsole
         while ( true ) {
             Thread.sleep( 10_000 );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/libraries/scripting/src/test/groovy/org/apache/polygene/library/scripting/HelloSpeakerTest.java
----------------------------------------------------------------------
diff --git a/libraries/scripting/src/test/groovy/org/apache/polygene/library/scripting/HelloSpeakerTest.java b/libraries/scripting/src/test/groovy/org/apache/polygene/library/scripting/HelloSpeakerTest.java
index 6ae5436..c9167e6 100644
--- a/libraries/scripting/src/test/groovy/org/apache/polygene/library/scripting/HelloSpeakerTest.java
+++ b/libraries/scripting/src/test/groovy/org/apache/polygene/library/scripting/HelloSpeakerTest.java
@@ -40,15 +40,11 @@ public class HelloSpeakerTest extends AbstractPolygeneTest
         throws Exception
     {
         // START SNIPPET: script
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.values( HelloSpeaker.class ).setMetaInfo( Scripting.GROOVY ).withMixins( ScriptMixin.class );
-            }
-        };
+        SingletonAssembler assembler = new SingletonAssembler(
+            assembly -> assembly.values( HelloSpeaker.class )
+                                .setMetaInfo( Scripting.GROOVY )
+                                .withMixins( ScriptMixin.class )
+        );
         HelloSpeaker speaker = assembler.module().newValue( HelloSpeaker.class );
         assertThat( speaker.sayHello(), equalTo("Hello, Groovy") );
         // END SNIPPET: script
@@ -59,15 +55,10 @@ public class HelloSpeakerTest extends AbstractPolygeneTest
         throws Exception
     {
         // START SNIPPET: direct
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.transients( HelloSpeaker.class ).withMixins( HelloSpeakerMixin.class );
-            }
-        };
+        SingletonAssembler assembler = new SingletonAssembler(
+            assembly -> assembly.transients( HelloSpeaker.class )
+                                .withMixins( HelloSpeakerMixin.class )
+        );
         HelloSpeaker speaker = assembler.module().newTransient( HelloSpeaker.class );
         assertThat( speaker.sayHello(), equalTo("Hello there, Groovy") );
         // END SNIPPET: direct

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/samples/dci/src/test/java/org/apache/polygene/dci/moneytransfer/test/TransferMoneyTest.java
----------------------------------------------------------------------
diff --git a/samples/dci/src/test/java/org/apache/polygene/dci/moneytransfer/test/TransferMoneyTest.java b/samples/dci/src/test/java/org/apache/polygene/dci/moneytransfer/test/TransferMoneyTest.java
index f3814f7..698dfeb 100644
--- a/samples/dci/src/test/java/org/apache/polygene/dci/moneytransfer/test/TransferMoneyTest.java
+++ b/samples/dci/src/test/java/org/apache/polygene/dci/moneytransfer/test/TransferMoneyTest.java
@@ -20,15 +20,9 @@
 
 package org.apache.polygene.dci.moneytransfer.test;
 
-import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
 import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
 import org.apache.polygene.api.usecase.UsecaseBuilder;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
 import org.apache.polygene.dci.moneytransfer.context.PayBillsContext;
 import org.apache.polygene.dci.moneytransfer.context.TransferMoneyContext;
@@ -39,6 +33,10 @@ import org.apache.polygene.dci.moneytransfer.rolemap.CheckingAccountRolemap;
 import org.apache.polygene.dci.moneytransfer.rolemap.CreditorRolemap;
 import org.apache.polygene.dci.moneytransfer.rolemap.SavingsAccountRolemap;
 import org.apache.polygene.test.EntityTestAssembler;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
 
 import static org.apache.polygene.api.usecase.UsecaseBuilder.newUsecase;
 
@@ -55,11 +53,8 @@ public class TransferMoneyTest
     public static void setup()
         throws Exception
     {
-        assembler = new SingletonAssembler()
-        {
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
+        assembler = new SingletonAssembler(
+            module -> {
                 module.entities(
                     CheckingAccountRolemap.class,
                     SavingsAccountRolemap.class,
@@ -67,7 +62,7 @@ public class TransferMoneyTest
 
                 new EntityTestAssembler().assemble( module );
             }
-        };
+        );
         uowf = assembler.module().unitOfWorkFactory();
         bootstrapData( assembler );
     }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/samples/dci/src/test/java/org/apache/polygene/dci/moneytransfer/test/TransferMoneyTest2.java
----------------------------------------------------------------------
diff --git a/samples/dci/src/test/java/org/apache/polygene/dci/moneytransfer/test/TransferMoneyTest2.java b/samples/dci/src/test/java/org/apache/polygene/dci/moneytransfer/test/TransferMoneyTest2.java
index 19e0fb0..3f6834d 100644
--- a/samples/dci/src/test/java/org/apache/polygene/dci/moneytransfer/test/TransferMoneyTest2.java
+++ b/samples/dci/src/test/java/org/apache/polygene/dci/moneytransfer/test/TransferMoneyTest2.java
@@ -20,16 +20,10 @@
 
 package org.apache.polygene.dci.moneytransfer.test;
 
-import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
 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.api.usecase.UsecaseBuilder;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
 import org.apache.polygene.dci.moneytransfer.context.PayBillsContext2;
 import org.apache.polygene.dci.moneytransfer.context.TransferMoneyContext2;
@@ -38,6 +32,10 @@ import org.apache.polygene.dci.moneytransfer.domain.entity.CheckingAccountEntity
 import org.apache.polygene.dci.moneytransfer.domain.entity.CreditorEntity;
 import org.apache.polygene.dci.moneytransfer.domain.entity.SavingsAccountEntity;
 import org.apache.polygene.test.EntityTestAssembler;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
 
 import static org.apache.polygene.api.usecase.UsecaseBuilder.newUsecase;
 
@@ -54,22 +52,19 @@ public class TransferMoneyTest2
     public static void setup()
         throws Exception
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.entities(
+        SingletonAssembler assembler = new SingletonAssembler(
+            moduleAssembly -> {
+                moduleAssembly.entities(
                     CheckingAccountEntity.class,
                     SavingsAccountEntity.class,
                     CreditorEntity.class );
 
-                new EntityTestAssembler().assemble( module );
+                new EntityTestAssembler().assemble( moduleAssembly );
 
-                module.transients( TransferMoneyContext2.class );
-                module.objects( PayBillsContext2.class );
+                moduleAssembly.transients( TransferMoneyContext2.class );
+                moduleAssembly.objects( PayBillsContext2.class );
             }
-        };
+        );
 
         module = assembler.module();
         uowf = module.unitOfWorkFactory();

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/samples/swing/src/main/java/org/apache/polygene/sample/swing/binding/example/Main.java
----------------------------------------------------------------------
diff --git a/samples/swing/src/main/java/org/apache/polygene/sample/swing/binding/example/Main.java b/samples/swing/src/main/java/org/apache/polygene/sample/swing/binding/example/Main.java
index 5fd826e..f24a45a 100644
--- a/samples/swing/src/main/java/org/apache/polygene/sample/swing/binding/example/Main.java
+++ b/samples/swing/src/main/java/org/apache/polygene/sample/swing/binding/example/Main.java
@@ -30,7 +30,6 @@ import javax.swing.JPanel;
 import org.apache.polygene.api.composite.TransientBuilder;
 import org.apache.polygene.api.structure.Module;
 import org.apache.polygene.api.value.ValueBuilder;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
 import org.apache.polygene.sample.swing.binding.StateModel;
 import org.apache.polygene.sample.swing.binding.SwingBindingAssembler;
@@ -43,17 +42,14 @@ public class Main
     public static void main( String[] args )
         throws Exception
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-            {
-                module.transients( BoundPersonComposite.class );
-                module.transients( AddressTransient.class );
-                module.values( CityValue.class, CountryValue.class );
-                new SwingBindingAssembler().assemble( module );
+        SingletonAssembler assembler = new SingletonAssembler(
+            moduleAssembly -> {
+                moduleAssembly.transients( BoundPersonComposite.class );
+                moduleAssembly.transients( AddressTransient.class );
+                moduleAssembly.values( CityValue.class, CountryValue.class );
+                new SwingBindingAssembler().assemble( moduleAssembly );
             }
-        };
+        );
         module = assembler.module();
         Address address1 = createAddress( "Vista Damai", "Jalan Tun Razak" );
         Address address2 = createAddress( "Mutiara", "Jalan Ceylon" );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/composite/CompositeCreationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/composite/CompositeCreationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/composite/CompositeCreationPerformanceTest.java
index 0f03463..4007ece 100644
--- a/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/composite/CompositeCreationPerformanceTest.java
+++ b/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/composite/CompositeCreationPerformanceTest.java
@@ -23,7 +23,6 @@ import org.apache.polygene.api.composite.TransientComposite;
 import org.apache.polygene.api.object.ObjectFactory;
 import org.apache.polygene.api.value.ValueBuilderFactory;
 import org.apache.polygene.api.value.ValueComposite;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
 import org.junit.Test;
 
@@ -36,16 +35,13 @@ public class CompositeCreationPerformanceTest
     public void newInstanceForRegisteredCompositePerformance()
         throws ActivationException, InterruptedException
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-            {
+        SingletonAssembler assembler = new SingletonAssembler(
+            module -> {
                 module.transients( AnyComposite.class );
                 module.objects( AnyObject.class );
                 module.values( AnyValue.class );
             }
-        };
+        );
         int warmups = 10;
         int runs = 20;
         long waitBeforeRun = 1000;

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/object/ObjectCreationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/object/ObjectCreationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/object/ObjectCreationPerformanceTest.java
index d6ecc28..706a66c 100644
--- a/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/object/ObjectCreationPerformanceTest.java
+++ b/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/object/ObjectCreationPerformanceTest.java
@@ -20,7 +20,6 @@ package org.apache.polygene.test.performance.runtime.object;
 
 import org.apache.polygene.api.activation.ActivationException;
 import org.apache.polygene.api.object.ObjectFactory;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
 import org.junit.Test;
 
@@ -34,14 +33,7 @@ public class ObjectCreationPerformanceTest
     public void newInstanceForRegisteredObjectPerformance()
         throws ActivationException
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-            {
-                module.objects( AnyObject.class );
-            }
-        };
+        SingletonAssembler assembler = new SingletonAssembler( module -> module.objects( AnyObject.class ) );
         ObjectFactory objectFactory = assembler.module();
         for( int i = 0; i < 10; i++ )
         {

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/service/ServiceInvocationPerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/service/ServiceInvocationPerformanceTest.java b/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/service/ServiceInvocationPerformanceTest.java
index b09f03a..858e95d 100644
--- a/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/service/ServiceInvocationPerformanceTest.java
+++ b/tests/performance/src/perf/java/org/apache/polygene/test/performance/runtime/service/ServiceInvocationPerformanceTest.java
@@ -25,7 +25,6 @@ import junit.framework.TestCase;
 import org.apache.polygene.api.injection.scope.Service;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.service.ServiceComposite;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
 
 public class ServiceInvocationPerformanceTest
@@ -37,15 +36,12 @@ public class ServiceInvocationPerformanceTest
     public void testInjectService()
         throws Exception
     {
-        SingletonAssembler assembly = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-            {
+        SingletonAssembler assembly = new SingletonAssembler(
+            module -> {
                 module.services( ServiceInvocationPerformanceTest.MyServiceComposite.class );
                 module.objects( ServiceInvocationPerformanceTest.class );
             }
-        };
+        );
 
         assembly.module().injectTo( this );
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/tutorials/cargo/src/test/java/org/apache/polygene/tutorials/cargo/step2/SequencingConcernTest.java
----------------------------------------------------------------------
diff --git a/tutorials/cargo/src/test/java/org/apache/polygene/tutorials/cargo/step2/SequencingConcernTest.java b/tutorials/cargo/src/test/java/org/apache/polygene/tutorials/cargo/step2/SequencingConcernTest.java
index 84cf70b..20c964f 100644
--- a/tutorials/cargo/src/test/java/org/apache/polygene/tutorials/cargo/step2/SequencingConcernTest.java
+++ b/tutorials/cargo/src/test/java/org/apache/polygene/tutorials/cargo/step2/SequencingConcernTest.java
@@ -19,19 +19,21 @@
  */
 package org.apache.polygene.tutorials.cargo.step2;
 
-import org.junit.Ignore;
-import org.junit.Test;
 import org.apache.polygene.api.activation.ActivationException;
 import org.apache.polygene.api.concern.Concerns;
 import org.apache.polygene.api.mixin.Mixins;
 import org.apache.polygene.api.property.Property;
 import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
 import org.apache.polygene.test.mock.MockComposite;
 import org.apache.polygene.test.mock.MockPlayerMixin;
+import org.junit.Ignore;
+import org.junit.Test;
 
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.replay;
+import static org.easymock.EasyMock.verify;
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
@@ -52,15 +54,9 @@ public class SequencingConcernTest
     public void failingBooking()
         throws ActivationException, AssemblyException
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.transients( ShippingServiceTestComposite.class );
-            }
-        };
+        SingletonAssembler assembler = new SingletonAssembler(
+            module -> module.transients( ShippingServiceTestComposite.class )
+        );
         ShippingService shippingService = createMock( ShippingService.class );
         Cargo cargo = createMock( Cargo.class );
         Voyage voyage = createMock( Voyage.class );
@@ -89,15 +85,9 @@ public class SequencingConcernTest
     public void successfulBooking()
         throws ActivationException, AssemblyException
     {
-        SingletonAssembler assembler = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.transients( ShippingServiceTestComposite.class );
-            }
-        };
+        SingletonAssembler assembler = new SingletonAssembler(
+            module -> module.transients( ShippingServiceTestComposite.class )
+        );
         ShippingService shippingService = createMock( ShippingService.class );
         Cargo cargo = createMock( Cargo.class );
         Voyage voyage = createMock( Voyage.class );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial10/HelloWorldTest.java
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial10/HelloWorldTest.java b/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial10/HelloWorldTest.java
index 4cc74e2..762fd53 100644
--- a/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial10/HelloWorldTest.java
+++ b/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial10/HelloWorldTest.java
@@ -19,12 +19,10 @@
  */
 package org.apache.polygene.tutorials.composites.tutorial10;
 
-import org.junit.Before;
-import org.junit.Test;
 import org.apache.polygene.api.composite.TransientBuilder;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
 import org.apache.polygene.bootstrap.SingletonAssembler;
+import org.junit.Before;
+import org.junit.Test;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.junit.Assert.assertThat;
@@ -38,15 +36,7 @@ public class HelloWorldTest
     public void setUp()
         throws Exception
     {
-        assembly = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.transients( HelloWorldComposite.class );
-            }
-        };
+        assembly = new SingletonAssembler( module -> module.transients( HelloWorldComposite.class ));
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial3/HelloWorldTest.java
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial3/HelloWorldTest.java b/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial3/HelloWorldTest.java
index acd4533..2870d27 100644
--- a/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial3/HelloWorldTest.java
+++ b/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial3/HelloWorldTest.java
@@ -19,11 +19,9 @@
  */
 package org.apache.polygene.tutorials.composites.tutorial3;
 
+import org.apache.polygene.bootstrap.SingletonAssembler;
 import org.junit.Before;
 import org.junit.Test;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.SingletonAssembler;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.junit.Assert.assertThat;
@@ -37,15 +35,9 @@ public class HelloWorldTest
     public void setUp()
         throws Exception
     {
-        SingletonAssembler assembly = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.transients( HelloWorldComposite.class );
-            }
-        };
+        SingletonAssembler assembly = new SingletonAssembler(
+            module -> module.transients( HelloWorldComposite.class )
+        );
 
         helloWorld = assembly.module().newTransient( HelloWorldComposite.class );
     }

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial4/HelloWorldTest.java
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial4/HelloWorldTest.java b/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial4/HelloWorldTest.java
index 3cf3bf2..a635a67 100644
--- a/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial4/HelloWorldTest.java
+++ b/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial4/HelloWorldTest.java
@@ -19,11 +19,9 @@
  */
 package org.apache.polygene.tutorials.composites.tutorial4;
 
+import org.apache.polygene.bootstrap.SingletonAssembler;
 import org.junit.Before;
 import org.junit.Test;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.SingletonAssembler;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.junit.Assert.assertThat;
@@ -37,15 +35,9 @@ public class HelloWorldTest
     public void setUp()
         throws Exception
     {
-        SingletonAssembler assembly = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.transients( HelloWorldComposite.class );
-            }
-        };
+        SingletonAssembler assembly = new SingletonAssembler(
+            module -> module.transients( HelloWorldComposite.class )
+        );
         helloWorld = assembly.module().newTransientBuilder( HelloWorldComposite.class ).newInstance();
     }
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial5/HelloWorldTest.java
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial5/HelloWorldTest.java b/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial5/HelloWorldTest.java
index 526f738..82f259e 100644
--- a/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial5/HelloWorldTest.java
+++ b/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial5/HelloWorldTest.java
@@ -19,11 +19,9 @@
  */
 package org.apache.polygene.tutorials.composites.tutorial5;
 
+import org.apache.polygene.bootstrap.SingletonAssembler;
 import org.junit.Before;
 import org.junit.Test;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.SingletonAssembler;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.junit.Assert.assertThat;
@@ -37,15 +35,9 @@ public class HelloWorldTest
     public void setUp()
         throws Exception
     {
-        SingletonAssembler assembly = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.transients( HelloWorldComposite.class );
-            }
-        };
+        SingletonAssembler assembly = new SingletonAssembler(
+            module -> module.transients( HelloWorldComposite.class )
+        );
         helloWorld = assembly.module().newTransientBuilder( HelloWorldComposite.class ).newInstance();
     }
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial6/HelloWorldTest.java
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial6/HelloWorldTest.java b/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial6/HelloWorldTest.java
index 0330bc6..0d3c101 100644
--- a/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial6/HelloWorldTest.java
+++ b/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial6/HelloWorldTest.java
@@ -19,11 +19,9 @@
  */
 package org.apache.polygene.tutorials.composites.tutorial6;
 
+import org.apache.polygene.bootstrap.SingletonAssembler;
 import org.junit.Before;
 import org.junit.Test;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.SingletonAssembler;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.junit.Assert.assertThat;
@@ -37,15 +35,9 @@ public class HelloWorldTest
     public void setUp()
         throws Exception
     {
-        SingletonAssembler assembly = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.transients( HelloWorldComposite.class );
-            }
-        };
+        SingletonAssembler assembly = new SingletonAssembler(
+            module -> module.transients( HelloWorldComposite.class )
+        );
         helloWorld = assembly.module().newTransient(HelloWorldComposite.class );
     }
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/2a2a28b8/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial7/HelloWorldTest.java
----------------------------------------------------------------------
diff --git a/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial7/HelloWorldTest.java b/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial7/HelloWorldTest.java
index 7592313..6c9a291 100644
--- a/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial7/HelloWorldTest.java
+++ b/tutorials/composites/src/test/java/org/apache/polygene/tutorials/composites/tutorial7/HelloWorldTest.java
@@ -19,11 +19,9 @@
  */
 package org.apache.polygene.tutorials.composites.tutorial7;
 
+import org.apache.polygene.bootstrap.SingletonAssembler;
 import org.junit.Before;
 import org.junit.Test;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.bootstrap.SingletonAssembler;
 
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.junit.Assert.assertThat;
@@ -37,15 +35,9 @@ public class HelloWorldTest
     public void setUp()
         throws Exception
     {
-        SingletonAssembler assembly = new SingletonAssembler()
-        {
-            @Override
-            public void assemble( ModuleAssembly module )
-                throws AssemblyException
-            {
-                module.transients( HelloWorldComposite.class );
-            }
-        };
+        SingletonAssembler assembly = new SingletonAssembler(
+            module -> module.transients( HelloWorldComposite.class )
+        );
         helloWorld = assembly.module().newTransientBuilder( HelloWorldComposite.class ).newInstance();
     }
 


Mime
View raw message