You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by pa...@apache.org on 2017/05/26 15:00:19 UTC
[04/13] polygene-java git commit: Anonymous Assemblers as lambdas
Anonymous Assemblers 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/48b99287
Tree: http://git-wip-us.apache.org/repos/asf/polygene-java/tree/48b99287
Diff: http://git-wip-us.apache.org/repos/asf/polygene-java/diff/48b99287
Branch: refs/heads/develop
Commit: 48b992877faf722a24dbec09faa5d2dd047d5180
Parents: 35c0dde
Author: Paul Merlin <pa...@apache.org>
Authored: Mon May 22 20:29:05 2017 +0200
Committer: Paul Merlin <pa...@apache.org>
Committed: Mon May 22 20:29:05 2017 +0200
----------------------------------------------------------------------
.../activation/PassivationExceptionTest.java | 61 +++----
.../runtime/structure/MixinVisibilityTest.java | 181 ++++++-------------
.../polygene/index/rdf/qi95/Qi95IssueTest.java | 151 +++++-----------
.../MemoryEntityStorePerformanceTest.java | 12 +-
.../sql/DerbySQLEntityStorePerformanceTest.java | 45 ++---
.../PostgreSQLEntityStorePerformanceTest.java | 55 +++---
6 files changed, 162 insertions(+), 343 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/48b99287/core/api/src/test/java/org/apache/polygene/api/activation/PassivationExceptionTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/apache/polygene/api/activation/PassivationExceptionTest.java b/core/api/src/test/java/org/apache/polygene/api/activation/PassivationExceptionTest.java
index ba7bca9..3637fb9 100644
--- a/core/api/src/test/java/org/apache/polygene/api/activation/PassivationExceptionTest.java
+++ b/core/api/src/test/java/org/apache/polygene/api/activation/PassivationExceptionTest.java
@@ -22,21 +22,20 @@ package org.apache.polygene.api.activation;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Arrays;
-import java.util.Collections;
-import org.junit.Test;
import org.apache.polygene.api.injection.scope.Structure;
import org.apache.polygene.api.mixin.Mixins;
import org.apache.polygene.api.service.ServiceReference;
import org.apache.polygene.api.structure.Application;
import org.apache.polygene.api.structure.Layer;
import org.apache.polygene.api.structure.Module;
-import org.apache.polygene.bootstrap.Assembler;
import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.bootstrap.builder.ApplicationBuilder;
+import org.junit.Test;
-import static org.hamcrest.core.StringContains.containsString;
+import static java.util.Collections.emptyList;
+import static java.util.Collections.singletonList;
import static org.hamcrest.core.IsEqual.equalTo;
+import static org.hamcrest.core.StringContains.containsString;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
@@ -52,14 +51,14 @@ public class PassivationExceptionTest
@Test
public void testEmptyPassivationException()
{
- PassivationException empty = new PassivationException( Collections.emptyList() );
+ PassivationException empty = new PassivationException( emptyList() );
assertThat( empty.getMessage(), containsString( "has 0 cause" ) );
}
@Test
public void testSinglePassivationException()
{
- PassivationException single = new PassivationException( Collections.singletonList( new Exception( "single" ) ) );
+ PassivationException single = new PassivationException( singletonList( new Exception( "single" ) ) );
String stack = stack( single );
assertThat( single.getMessage(), containsString( "has 1 cause" ) );
assertThat( stack, containsString( "Suppressed: java.lang.Exception: single" ) );
@@ -83,30 +82,16 @@ public class PassivationExceptionTest
throws AssemblyException, ActivationException
{
ApplicationBuilder appBuilder = new ApplicationBuilder( "TestApplication" );
- appBuilder.withLayer( "Layer 1" ).withModule( "Module A" ).withAssembler( new Assembler()
- {
- @Override
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.services( TestService.class ).
- identifiedBy( "TestService_Module.A" ).
- withActivators( FailBeforePassivationServiceActivator.class ).
- instantiateOnStartup();
- }
- } );
- appBuilder.withLayer( "Layer 2" ).withModule( "Module B" ).withAssembler( new Assembler()
- {
- @Override
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.services( TestService.class ).
- identifiedBy( "TestService_Module.B" ).
- withActivators( FailAfterPassivationServiceActivator.class ).
- instantiateOnStartup();
- }
- } );
+ appBuilder.withLayer( "Layer 1" ).withModule( "Module A" ).withAssembler(
+ module -> module.services( TestService.class )
+ .identifiedBy( "TestService_Module.A" )
+ .withActivators( FailBeforePassivationServiceActivator.class )
+ .instantiateOnStartup() );
+ appBuilder.withLayer( "Layer 2" ).withModule( "Module B" ).withAssembler(
+ module -> module.services( TestService.class )
+ .identifiedBy( "TestService_Module.B" )
+ .withActivators( FailAfterPassivationServiceActivator.class )
+ .instantiateOnStartup() );
appBuilder.registerActivationEventListener( new TestActivationEventListener() );
Application app = appBuilder.newApplication();
@@ -132,12 +117,18 @@ public class PassivationExceptionTest
assertThat( stack, containsString( "EVENT: FAIL BEFORE PASSIVATION for TestApplication" ) );
assertThat( stack, containsString( "EVENT: FAIL BEFORE PASSIVATION for Layer 2" ) );
assertThat( stack, containsString( "EVENT: FAIL BEFORE PASSIVATION for Module B" ) );
- assertThat( stack, containsString( "ACTIVATOR: FAIL AFTER PASSIVATION for TestService_Module.B(active=false,module='Module B')" ) );
+ assertThat(
+ stack,
+ containsString(
+ "ACTIVATOR: FAIL AFTER PASSIVATION for TestService_Module.B(active=false,module='Module B')" ) );
assertThat( stack, containsString( "EVENT: FAIL AFTER PASSIVATION for Module B" ) );
assertThat( stack, containsString( "EVENT: FAIL AFTER PASSIVATION for Layer 2" ) );
assertThat( stack, containsString( "EVENT: FAIL BEFORE PASSIVATION for Layer 1" ) );
assertThat( stack, containsString( "EVENT: FAIL BEFORE PASSIVATION for Module A" ) );
- assertThat( stack, containsString( "ACTIVATOR: FAIL BEFORE PASSIVATION for TestService_Module.A(active=true,module='Module A')" ) );
+ assertThat(
+ stack,
+ containsString(
+ "ACTIVATOR: FAIL BEFORE PASSIVATION for TestService_Module.A(active=true,module='Module A')" ) );
assertThat( stack, containsString( "EVENT: FAIL AFTER PASSIVATION for Module A" ) );
assertThat( stack, containsString( "EVENT: FAIL AFTER PASSIVATION for Layer 1" ) );
assertThat( stack, containsString( "EVENT: FAIL AFTER PASSIVATION for TestApplication" ) );
@@ -150,7 +141,7 @@ public class PassivationExceptionTest
{
String hello();
- static class Mixin
+ class Mixin
implements TestService
{
@Structure
@@ -163,7 +154,6 @@ public class PassivationExceptionTest
return "Hello Polygene!";
}
}
-
}
public static class FailBeforePassivationServiceActivator
@@ -210,5 +200,4 @@ public class PassivationExceptionTest
}
}
}
-
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/48b99287/core/runtime/src/test/java/org/apache/polygene/runtime/structure/MixinVisibilityTest.java
----------------------------------------------------------------------
diff --git a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/MixinVisibilityTest.java b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/MixinVisibilityTest.java
index f64cf1e..a1ee0e9 100644
--- a/core/runtime/src/test/java/org/apache/polygene/runtime/structure/MixinVisibilityTest.java
+++ b/core/runtime/src/test/java/org/apache/polygene/runtime/structure/MixinVisibilityTest.java
@@ -20,23 +20,21 @@
package org.apache.polygene.runtime.structure;
-import org.junit.Test;
import org.apache.polygene.api.common.Optional;
import org.apache.polygene.api.common.Visibility;
import org.apache.polygene.api.composite.AmbiguousTypeException;
import org.apache.polygene.api.composite.NoSuchTransientException;
import org.apache.polygene.api.composite.TransientBuilder;
import org.apache.polygene.api.composite.TransientBuilderFactory;
-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.property.Property;
import org.apache.polygene.api.structure.Application;
import org.apache.polygene.bootstrap.ApplicationAssemblerAdapter;
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.junit.Assert.assertEquals;
@@ -54,15 +52,10 @@ public class MixinVisibilityTest
{
{ // Layer
{ // Module 1
- new Assembler()
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.setName( "Module A" );
- module.transients( B1Composite.class );
- module.objects( ObjectA.class );
- }
+ module -> {
+ module.setName( "Module A" );
+ module.transients( B1Composite.class );
+ module.objects( ObjectA.class );
}
}
}
@@ -86,15 +79,10 @@ public class MixinVisibilityTest
{
{ // Layer
{ // Module 1
- new Assembler()
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.setName( "Module A" );
- module.transients( B1Composite.class, B2Composite.class );
- module.objects( ObjectA.class );
- }
+ module -> {
+ module.setName( "Module A" );
+ module.transients( B1Composite.class, B2Composite.class );
+ module.objects( ObjectA.class );
}
}
}
@@ -118,25 +106,15 @@ public class MixinVisibilityTest
{
{ // Layer
{
- new Assembler()
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.setName( "Module A" );
- module.objects( ObjectA.class );
- }
+ module -> {
+ module.setName( "Module A" );
+ module.objects( ObjectA.class );
}
},
{
- new Assembler()
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.setName( "Module B" );
- module.transients( B1Composite.class );
- }
+ module -> {
+ module.setName( "Module B" );
+ module.transients( B1Composite.class );
}
}
}
@@ -160,25 +138,15 @@ public class MixinVisibilityTest
{
{ // Layer
{
- new Assembler()
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.setName( "Module A" );
- module.objects( ObjectA.class );
- }
+ module -> {
+ module.setName( "Module A" );
+ module.objects( ObjectA.class );
}
},
{
- new Assembler()
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.setName( "Module B" );
- module.transients( B1Composite.class ).visibleIn( Visibility.layer );
- }
+ module -> {
+ module.setName( "Module B" );
+ module.transients( B1Composite.class ).visibleIn( Visibility.layer );
}
}
}
@@ -202,26 +170,16 @@ public class MixinVisibilityTest
{
{ // Layer
{
- new Assembler()
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.setName( "Module A" );
- module.objects( ObjectA.class );
- }
+ module -> {
+ module.setName( "Module A" );
+ module.objects( ObjectA.class );
}
},
{
- new Assembler()
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.setName( "Module B" );
- module.transients( B1Composite.class, B2Composite.class )
- .visibleIn( Visibility.layer );
- }
+ module -> {
+ module.setName( "Module B" );
+ module.transients( B1Composite.class, B2Composite.class )
+ .visibleIn( Visibility.layer );
}
}
}
@@ -245,36 +203,21 @@ public class MixinVisibilityTest
{
{ // Layer
{ // Module 1
- new Assembler()
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.setName( "Module A" );
- module.objects( ObjectA.class );
- }
+ module -> {
+ module.setName( "Module A" );
+ module.objects( ObjectA.class );
}
},
{ // Module 2
- new Assembler()
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.setName( "Module B" );
- module.transients( B1Composite.class ).visibleIn( Visibility.layer );
- }
+ module -> {
+ module.setName( "Module B" );
+ module.transients( B1Composite.class ).visibleIn( Visibility.layer );
}
},
{ // Module 3
- new Assembler()
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.setName( "Module C" );
- module.transients( B2Composite.class ).visibleIn( Visibility.layer );
- }
+ module -> {
+ module.setName( "Module C" );
+ module.transients( B2Composite.class ).visibleIn( Visibility.layer );
}
}
}
@@ -300,27 +243,17 @@ public class MixinVisibilityTest
{
{ // Layer 1
{
- new Assembler()
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.setName( "Module A" );
- module.objects( ObjectA.class );
- }
+ module -> {
+ module.setName( "Module A" );
+ module.objects( ObjectA.class );
}
}
},
{ // Layer 2
{
- new Assembler()
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.setName( "Module B" );
- module.transients( B1Composite.class ).visibleIn( Visibility.layer );
- }
+ module -> {
+ module.setName( "Module B" );
+ module.transients( B1Composite.class ).visibleIn( Visibility.layer );
}
}
}
@@ -344,27 +277,17 @@ public class MixinVisibilityTest
{
{ // Layer 1
{
- new Assembler()
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.setName( "Module A" );
- module.objects( ObjectA.class );
- }
+ module -> {
+ module.setName( "Module A" );
+ module.objects( ObjectA.class );
}
}
},
{ // Layer 2
{
- new Assembler()
- {
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.setName( "Module B" );
- module.transients( B1Composite.class ).visibleIn( Visibility.application );
- }
+ module -> {
+ module.setName( "Module B" );
+ module.transients( B1Composite.class ).visibleIn( Visibility.application );
}
}
}
@@ -382,8 +305,8 @@ public class MixinVisibilityTest
class AssemblerB
implements Assembler
{
+ @Override
public void assemble( ModuleAssembly module )
- throws AssemblyException
{
module.setName( "Module B" );
module.transients( B1Composite.class ).visibleIn( Visibility.module );
@@ -412,12 +335,12 @@ public class MixinVisibilityTest
@Mixins( { MixinB.class } )
public interface B1Composite
- extends TransientComposite, B1
+ extends B1
{
}
public interface B2Composite
- extends TransientComposite, B2
+ extends B2
{
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/48b99287/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 43b6de0..54a35fc 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
@@ -25,7 +25,6 @@ import java.util.Collection;
import java.util.Collections;
import org.apache.polygene.api.common.Visibility;
import org.apache.polygene.api.entity.EntityBuilder;
-import org.apache.polygene.api.entity.EntityComposite;
import org.apache.polygene.api.property.Property;
import org.apache.polygene.api.query.QueryBuilder;
import org.apache.polygene.api.query.QueryBuilderFactory;
@@ -143,7 +142,7 @@ public class Qi95IssueTest
uow = unitOfWorkFactory.newUnitOfWork();
QueryBuilder<ItemType> qb = queryBuilderFactory.newQueryBuilder( ItemType.class );
- Iterable<ItemType> initialList = copyOf( uow.newQuery( qb ));
+ Iterable<ItemType> initialList = copyOf( uow.newQuery( qb ) );
assertTrue( "Band is not in the initial list", hasItemTypeNamed( "Band", initialList ) );
assertTrue( "Bracelet is not in the initial list", hasItemTypeNamed( "Bracelet", initialList ) );
@@ -156,10 +155,14 @@ public class Qi95IssueTest
qb = queryBuilderFactory.newQueryBuilder( ItemType.class );
Iterable<ItemType> listAfterFirstQueryAndAdd = copyOf( uow.newQuery( qb ) );
- assertTrue( "Band is not in the list after the first query and add", hasItemTypeNamed( "Band", listAfterFirstQueryAndAdd ) );
- assertTrue( "Bracelet is not in the list after the first query and add", hasItemTypeNamed( "Bracelet", listAfterFirstQueryAndAdd ) );
- assertTrue( "Necklace is not in the list after the first query and add", hasItemTypeNamed( "Necklace", listAfterFirstQueryAndAdd ) );
- assertTrue( "Watch is not in the list after the first query and add", hasItemTypeNamed( "Watch", listAfterFirstQueryAndAdd ) );
+ assertTrue( "Band is not in the list after the first query and add",
+ hasItemTypeNamed( "Band", listAfterFirstQueryAndAdd ) );
+ assertTrue( "Bracelet is not in the list after the first query and add",
+ hasItemTypeNamed( "Bracelet", listAfterFirstQueryAndAdd ) );
+ assertTrue( "Necklace is not in the list after the first query and add",
+ hasItemTypeNamed( "Necklace", listAfterFirstQueryAndAdd ) );
+ assertTrue( "Watch is not in the list after the first query and add",
+ hasItemTypeNamed( "Watch", listAfterFirstQueryAndAdd ) );
newItemType( uow, "Ear ring" );
uow.complete();
@@ -175,8 +178,8 @@ public class Qi95IssueTest
}
private Application createApplication( final ModuleAssemblyBuilder queryServiceModuleBuilder,
- final ModuleAssemblyBuilder entityStoreModuleBuilder,
- final LayerAssemblyBuilder domainLayerBuilder
+ final ModuleAssemblyBuilder entityStoreModuleBuilder,
+ final LayerAssemblyBuilder domainLayerBuilder
)
throws AssemblyException
{
@@ -212,118 +215,48 @@ public class Qi95IssueTest
throws AssemblyException;
}
- final ModuleAssemblyBuilder nativeRdf = new ModuleAssemblyBuilder()
- {
- @Override
- public ModuleAssembly buildModuleAssembly( LayerAssembly layer, String name )
- throws AssemblyException
- {
- return addModule( layer, name, new RdfNativeSesameStoreAssembler() );
- }
- };
+ final ModuleAssemblyBuilder nativeRdf =
+ ( layer, name ) -> addModule( layer, name, new RdfNativeSesameStoreAssembler() );
- final ModuleAssemblyBuilder inMemoryStore = new ModuleAssemblyBuilder()
- {
- @Override
- public ModuleAssembly buildModuleAssembly( LayerAssembly layer, String name )
- throws AssemblyException
- {
- return addModule( layer, name, new EntityTestAssembler().visibleIn( Visibility.application ) );
- }
- };
+ final ModuleAssemblyBuilder inMemoryStore =
+ ( layer, name ) -> addModule( layer, name, new EntityTestAssembler().visibleIn( Visibility.application ) );
- final ModuleAssemblyBuilder inMemoryRdf = new ModuleAssemblyBuilder()
- {
- @Override
- public ModuleAssembly buildModuleAssembly( LayerAssembly layer, String name )
- throws AssemblyException
- {
- return addModule( layer, name, new RdfMemoryStoreAssembler() );
- }
- };
+ final ModuleAssemblyBuilder inMemoryRdf =
+ ( layer, name ) -> addModule( layer, name, new RdfMemoryStoreAssembler() );
- final ModuleAssemblyBuilder jdbmStore = new ModuleAssemblyBuilder()
- {
- @Override
- public ModuleAssembly buildModuleAssembly( LayerAssembly layer, String name )
- throws AssemblyException
- {
- return addModule( layer, name, jdbmEntityStoreAssembler() );
- }
- };
+ final ModuleAssemblyBuilder jdbmStore =
+ ( layer, name ) -> addModule( layer, name, new JdbmEntityStoreAssembler().visibleIn( Visibility.application ) );
- final ModuleAssemblyBuilder configModule = new ModuleAssemblyBuilder()
- {
- @Override
- public ModuleAssembly buildModuleAssembly( LayerAssembly layer, String name )
- throws AssemblyException
- {
- return addModule( layer, name, entityStoreConfigAssembler() );
- }
- };
+ final ModuleAssemblyBuilder configModule =
+ ( layer, name ) -> addModule( layer, name, entityStoreConfigAssembler() );
- final LayerAssemblyBuilder domain = new LayerAssemblyBuilder()
- {
- @Override
- public LayerAssembly buildLayerAssembly( ApplicationAssembly appAssembly )
- throws AssemblyException
- {
- LayerAssembly domainLayer = appAssembly.layer( "Domain" );
- addModule( domainLayer, "Domain", new Assembler()
- {
- @Override
- @SuppressWarnings( "unchecked" )
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- module.entities( ItemTypeEntity.class );
- }
- } );
+ final LayerAssemblyBuilder domain =
+ application -> {
+ LayerAssembly domainLayer = application.layer( "Domain" );
+ addModule( domainLayer, "Domain", module -> module.entities( ItemTypeEntity.class ) );
return domainLayer;
- }
- };
-
- private Assembler entityStoreConfigAssembler()
- {
- return new Assembler()
- {
- @Override
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- new EntityTestAssembler().assemble( module );
-
- module.entities( NativeConfiguration.class ).visibleIn( Visibility.application );
- module.forMixin( NativeConfiguration.class )
- .declareDefaults()
- .dataDirectory()
- .set( rdfDirectory().getAbsolutePath() );
-
- module.entities( JdbmConfiguration.class ).visibleIn( Visibility.application );
- module.forMixin( JdbmConfiguration.class )
- .declareDefaults()
- .file()
- .set( jdbmDirectory().getAbsolutePath() );
- }
};
- }
- private Assembler jdbmEntityStoreAssembler()
+ private Assembler entityStoreConfigAssembler()
{
- return new Assembler()
- {
- @Override
- @SuppressWarnings( "unchecked" )
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- new JdbmEntityStoreAssembler().visibleIn( Visibility.application ).assemble( module );
- }
+ return module -> {
+ new EntityTestAssembler().assemble( module );
+
+ module.entities( NativeConfiguration.class ).visibleIn( Visibility.application );
+ module.forMixin( NativeConfiguration.class )
+ .declareDefaults()
+ .dataDirectory()
+ .set( rdfDirectory().getAbsolutePath() );
+
+ module.entities( JdbmConfiguration.class ).visibleIn( Visibility.application );
+ module.forMixin( JdbmConfiguration.class )
+ .declareDefaults()
+ .file()
+ .set( jdbmDirectory().getAbsolutePath() );
};
}
private ModuleAssembly addModule( LayerAssembly layerAssembly, String name, Assembler assembler )
- throws AssemblyException
{
ModuleAssembly moduleAssembly = layerAssembly.module( name );
assembler.assemble( moduleAssembly );
@@ -363,7 +296,7 @@ public class Qi95IssueTest
private Iterable<ItemType> copyOf( Iterable<ItemType> iterable )
{
- Collection<ItemType> copy = new ArrayList<ItemType>();
+ Collection<ItemType> copy = new ArrayList<>();
for( ItemType i : iterable )
{
copy.add( i );
@@ -384,7 +317,7 @@ public class Qi95IssueTest
}
interface ItemTypeEntity
- extends ItemType, EntityComposite
+ extends ItemType
{
}
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/48b99287/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/memory/MemoryEntityStorePerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/memory/MemoryEntityStorePerformanceTest.java b/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/memory/MemoryEntityStorePerformanceTest.java
index 956cc7a..69da80b 100644
--- a/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/memory/MemoryEntityStorePerformanceTest.java
+++ b/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/memory/MemoryEntityStorePerformanceTest.java
@@ -19,8 +19,6 @@ package org.apache.polygene.test.performance.entitystore.memory;
import org.apache.polygene.api.mixin.Mixins;
import org.apache.polygene.bootstrap.Assembler;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.entitystore.memory.MemoryEntityStoreService;
import org.apache.polygene.entitystore.memory.assembly.MemoryEntityStoreAssembler;
import org.apache.polygene.spi.entitystore.helpers.MapEntityStoreMixin;
@@ -37,15 +35,7 @@ public class MemoryEntityStorePerformanceTest
private static Assembler createAssembler()
{
- return new Assembler()
- {
- @Override
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- new MemoryEntityStoreAssembler().assemble( module );
- }
- };
+ return module -> new MemoryEntityStoreAssembler().assemble( module );
}
// Alternate variant that uses the standard MapEntityStore
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/48b99287/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/DerbySQLEntityStorePerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/DerbySQLEntityStorePerformanceTest.java b/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/DerbySQLEntityStorePerformanceTest.java
index 09a0331..656939c 100644
--- a/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/DerbySQLEntityStorePerformanceTest.java
+++ b/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/DerbySQLEntityStorePerformanceTest.java
@@ -24,7 +24,6 @@ import org.apache.polygene.api.common.Visibility;
import org.apache.polygene.api.unitofwork.UnitOfWork;
import org.apache.polygene.api.usecase.UsecaseBuilder;
import org.apache.polygene.bootstrap.Assembler;
-import org.apache.polygene.bootstrap.AssemblyException;
import org.apache.polygene.bootstrap.ModuleAssembly;
import org.apache.polygene.entitystore.sql.SQLMapEntityStoreConfiguration;
import org.apache.polygene.entitystore.sql.assembly.DerbySQLEntityStoreAssembler;
@@ -49,34 +48,28 @@ public class DerbySQLEntityStorePerformanceTest
private static Assembler createAssembler()
{
- return new Assembler()
- {
- @Override
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- ModuleAssembly config = module.layer().module( "config" );
- new EntityTestAssembler().assemble( config );
+ return module -> {
+ ModuleAssembly config = module.layer().module( "config" );
+ new EntityTestAssembler().assemble( config );
- // DataSourceService
- new DBCPDataSourceServiceAssembler().
- identifiedBy( "derby-datasource-service" ).
- visibleIn( Visibility.module ).
- withConfig( config, Visibility.layer ).
- assemble( module );
+ // DataSourceService
+ new DBCPDataSourceServiceAssembler()
+ .identifiedBy( "derby-datasource-service" )
+ .visibleIn( Visibility.module )
+ .withConfig( config, Visibility.layer )
+ .assemble( module );
- // DataSource
- new DataSourceAssembler().
- withDataSourceServiceIdentity( "derby-datasource-service" ).
- identifiedBy( "derby-datasource" ).
- withCircuitBreaker().
- assemble( module );
+ // DataSource
+ new DataSourceAssembler()
+ .withDataSourceServiceIdentity( "derby-datasource-service" )
+ .identifiedBy( "derby-datasource" )
+ .withCircuitBreaker()
+ .assemble( module );
- // SQL EntityStore
- new DerbySQLEntityStoreAssembler().
- withConfig( config, Visibility.layer ).
- assemble( module );
- }
+ // SQL EntityStore
+ new DerbySQLEntityStoreAssembler()
+ .withConfig( config, Visibility.layer )
+ .assemble( module );
};
}
http://git-wip-us.apache.org/repos/asf/polygene-java/blob/48b99287/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/PostgreSQLEntityStorePerformanceTest.java
----------------------------------------------------------------------
diff --git a/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/PostgreSQLEntityStorePerformanceTest.java b/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/PostgreSQLEntityStorePerformanceTest.java
index b1e8a17..c6ed02b 100644
--- a/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/PostgreSQLEntityStorePerformanceTest.java
+++ b/tests/performance/src/perf/java/org/apache/polygene/test/performance/entitystore/sql/PostgreSQLEntityStorePerformanceTest.java
@@ -28,7 +28,6 @@ import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
import org.apache.polygene.api.usecase.UsecaseBuilder;
import org.apache.polygene.bootstrap.ApplicationAssemblerAdapter;
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.apache.polygene.entitystore.memory.MemoryEntityStoreService;
@@ -62,35 +61,28 @@ public class PostgreSQLEntityStorePerformanceTest
private static Assembler createAssembler()
{
- return new Assembler()
- {
- @Override
- public void assemble( ModuleAssembly module )
- throws AssemblyException
- {
- ModuleAssembly config = module.layer().module( "config" );
- config.services( MemoryEntityStoreService.class );
+ return module -> {
+ ModuleAssembly config = module.layer().module( "config" );
+ config.services( MemoryEntityStoreService.class );
- // DataSourceService
- new DBCPDataSourceServiceAssembler().
- identifiedBy( "postgresql-datasource-service" ).
- visibleIn( Visibility.module ).
- withConfig( config, Visibility.layer ).
- assemble( module );
+ // DataSourceService
+ new DBCPDataSourceServiceAssembler()
+ .identifiedBy( "postgresql-datasource-service" )
+ .visibleIn( Visibility.module )
+ .withConfig( config, Visibility.layer )
+ .assemble( module );
- // DataSource
- new DataSourceAssembler().
- withDataSourceServiceIdentity( "postgresql-datasource-service" ).
- identifiedBy( "postgresql-datasource" ).
- withCircuitBreaker().
- assemble( module );
-
- // SQL EntityStore
- new PostgreSQLEntityStoreAssembler().
- withConfig( config, Visibility.layer ).
- assemble( module );
- }
+ // DataSource
+ new DataSourceAssembler()
+ .withDataSourceServiceIdentity( "postgresql-datasource-service" )
+ .identifiedBy( "postgresql-datasource" )
+ .withCircuitBreaker()
+ .assemble( module );
+ // SQL EntityStore
+ new PostgreSQLEntityStoreAssembler()
+ .withConfig( config, Visibility.layer )
+ .assemble( module );
};
}
@@ -107,13 +99,13 @@ public class PostgreSQLEntityStorePerformanceTest
Energy4Java polygene = new Energy4Java();
Assembler[][][] assemblers = new Assembler[][][]
- {
{
{
- createAssembler()
+ {
+ createAssembler()
+ }
}
- }
- };
+ };
Application application = polygene.newApplication( new ApplicationAssemblerAdapter( assemblers )
{
} );
@@ -142,5 +134,4 @@ public class PostgreSQLEntityStorePerformanceTest
}
}
}
-
}