polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [28/33] polygene-java git commit: Introducing the whole test suite from entitystore-sqlkv and starting to solidify the implementation against all these SQL systems.
Date Thu, 26 Oct 2017 07:34:58 GMT
Introducing the whole test suite from entitystore-sqlkv and starting to solidify the implementation against all these SQL systems.


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

Branch: refs/heads/develop
Commit: 0f8f0b8d9677c37a136cd4b3e050107d09e4c483
Parents: ff9c272
Author: niclas <niclas@hedhman.org>
Authored: Sun Sep 10 20:22:00 2017 +0800
Committer: niclas <niclas@hedhman.org>
Committed: Sun Sep 10 20:22:00 2017 +0800

----------------------------------------------------------------------
 extensions/entitystore-sql/build.gradle         |   2 +-
 .../polygene/entitystore/sql/EntitiesTable.java |  48 +++-
 .../entitystore/sql/SqlEntityStoreMixin.java    |   4 +-
 .../polygene/entitystore/sql/SqlTable.java      |  14 +-
 .../AbstractSQLEntityStoreAssembler.java        |  73 ++++++
 .../assembly/DerbySQLEntityStoreAssembler.java  |  12 +
 .../sql/assembly/H2SQLEntityStoreAssembler.java |  12 +
 .../MariaDbSQLEntityStoreAssembler.java         |  12 +
 .../sql/assembly/MySQLEntityStoreAssembler.java |  12 +
 .../PostgreSQLEntityStoreAssembler.java         |  12 +
 .../sql/assembly/SQLEntityStoreAssembler.java   |   9 +
 .../assembly/SQLiteEntityStoreAssembler.java    |  12 +
 .../sql/assembly/SqlEntityStoreAssembler.java   |  78 ------
 .../sql/DerbySQLEntityStoreTest.java            |  99 ++++++++
 .../sql/DerbySQLEntityStoreTestSuite.java       |  94 +++++++
 .../entitystore/sql/H2SQLEntityStoreTest.java   |  67 +++++
 .../sql/H2SQLEntityStoreTestSuite.java          |  56 +++++
 .../entitystore/sql/MySQLEntityStoreTest.java   | 125 ++++++++++
 .../sql/MySQLEntityStoreTestSuite.java          | 118 +++++++++
 .../sql/PostgreSQLEntityStoreTest.java          | 114 +++++++++
 .../sql/PostgreSQLEntityStoreTestSuite.java     | 112 +++++++++
 .../entitystore/sql/SQLiteEntityStoreTest.java  |  75 ++++++
 .../sql/SQLiteEntityStoreTestSuite.java         |  65 +++++
 .../entitystore/sql/SqlEntityStoreTest.java     |   7 +-
 .../test/resources/derby-datasource.properties  |  25 ++
 .../src/test/resources/h2-datasource.properties |  25 ++
 .../src/test/resources/logback.xml              |  35 +++
 .../test/resources/mysql-datasource.properties  |  25 ++
 .../resources/postgresql-datasource.properties  |  24 ++
 .../test/resources/sqlite-datasource.properties |  25 ++
 .../sql/SQLEntityStoreConfiguration.java        |  47 ----
 .../entitystore/sql/SQLEntityStoreMixin.java    | 244 -------------------
 .../entitystore/sql/SQLEntityStoreService.java  |  43 ----
 .../AbstractSQLEntityStoreAssembler.java        |  98 --------
 .../assembly/DerbySQLEntityStoreAssembler.java  |  35 ---
 .../sql/assembly/H2SQLEntityStoreAssembler.java |  35 ---
 .../sql/assembly/MySQLEntityStoreAssembler.java |  35 ---
 .../PostgreSQLEntityStoreAssembler.java         |  35 ---
 .../sql/assembly/SQLEntityStoreAssembler.java   |  28 ---
 .../assembly/SQLiteEntityStoreAssembler.java    |  35 ---
 .../entitystore/sql/assembly/package.html       |  24 --
 .../polygene/entitystore/sql/package.html       |  24 --
 .../sqlkv/SQLEntityStoreConfiguration.java      |  47 ++++
 .../entitystore/sqlkv/SQLEntityStoreMixin.java  | 244 +++++++++++++++++++
 .../sqlkv/SQLEntityStoreService.java            |  43 ++++
 .../AbstractSQLEntityStoreAssembler.java        |  98 ++++++++
 .../assembly/DerbySQLEntityStoreAssembler.java  |  35 +++
 .../assembly/H2SQLEntityStoreAssembler.java     |  35 +++
 .../assembly/MySQLEntityStoreAssembler.java     |  35 +++
 .../PostgreSQLEntityStoreAssembler.java         |  35 +++
 .../sqlkv/assembly/SQLEntityStoreAssembler.java |  28 +++
 .../assembly/SQLiteEntityStoreAssembler.java    |  35 +++
 .../entitystore/sqlkv/assembly/package.html     |  24 ++
 .../polygene/entitystore/sqlkv/package.html     |  24 ++
 .../sql/DerbySQLEntityStoreTest.java            | 101 --------
 .../sql/DerbySQLEntityStoreTestSuite.java       |  94 -------
 .../entitystore/sql/H2SQLEntityStoreTest.java   |  67 -----
 .../sql/H2SQLEntityStoreTestSuite.java          |  56 -----
 .../entitystore/sql/MySQLEntityStoreTest.java   | 127 ----------
 .../sql/MySQLEntityStoreTestSuite.java          | 122 ----------
 .../sql/PostgreSQLEntityStoreTest.java          | 115 ---------
 .../sql/PostgreSQLEntityStoreTestSuite.java     | 111 ---------
 .../entitystore/sql/SQLiteEntityStoreTest.java  |  75 ------
 .../sql/SQLiteEntityStoreTestSuite.java         |  65 -----
 .../sqlkv/DerbySQLEntityStoreTest.java          | 102 ++++++++
 .../sqlkv/DerbySQLEntityStoreTestSuite.java     |  95 ++++++++
 .../entitystore/sqlkv/H2SQLEntityStoreTest.java |  67 +++++
 .../sqlkv/H2SQLEntityStoreTestSuite.java        |  56 +++++
 .../entitystore/sqlkv/MySQLEntityStoreTest.java | 128 ++++++++++
 .../sqlkv/MySQLEntityStoreTestSuite.java        | 123 ++++++++++
 .../sqlkv/PostgreSQLEntityStoreTest.java        | 115 +++++++++
 .../sqlkv/PostgreSQLEntityStoreTestSuite.java   | 111 +++++++++
 .../sqlkv/SQLiteEntityStoreTest.java            |  75 ++++++
 .../sqlkv/SQLiteEntityStoreTestSuite.java       |  65 +++++
 .../sql/dbcp/DBCPDataSourceServiceImporter.java |  51 ++--
 .../DataSourceConfigurationState.java           |   2 +
 .../DataSourceServiceImporterActivation.java    |   3 -
 .../sample/sqlsupport/AppAssembler.java         |   2 +-
 .../apache/polygene/sample/sqlsupport/Main.java |   2 +-
 .../sql/DerbySQLEntityStorePerformanceTest.java |   6 +-
 .../PostgreSQLEntityStorePerformanceTest.java   |   4 +-
 tools/generator-polygene/app/index.js           |   1 +
 .../StorageModule/bootstrap.tmpl                |   2 +-
 .../storage/ds-es-mariadb.properties            |  24 ++
 .../storage/ds-es-sqlite.properties             |   2 +-
 .../RestAPIApplication/bootstrap-test.tmpl      |   2 +-
 86 files changed, 2976 insertions(+), 1752 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/build.gradle
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/build.gradle b/extensions/entitystore-sql/build.gradle
index 32ceb70..8eb353f 100644
--- a/extensions/entitystore-sql/build.gradle
+++ b/extensions/entitystore-sql/build.gradle
@@ -34,10 +34,10 @@ dependencies {
   testImplementation polygene.internals.testsupport
   testImplementation polygene.library( 'sql-dbcp' )
   testImplementation libraries.docker_junit
+  testImplementation libraries.h2
 
   testRuntimeOnly libraries.logback
   testRuntimeOnly libraries.derby
-  testRuntimeOnly libraries.h2
   testRuntimeOnly libraries.mysql_connector
   testRuntimeOnly libraries.postgres
   testRuntimeOnly libraries.sqlite

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/EntitiesTable.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/EntitiesTable.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/EntitiesTable.java
index d25e7fc..257ca02 100644
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/EntitiesTable.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/EntitiesTable.java
@@ -22,6 +22,7 @@ import java.sql.Timestamp;
 import java.time.Instant;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 import java.util.UUID;
 import java.util.concurrent.ConcurrentHashMap;
@@ -49,6 +50,7 @@ import org.apache.polygene.spi.entitystore.helpers.DefaultEntityState;
 import org.jooq.Condition;
 import org.jooq.Field;
 import org.jooq.Record;
+import org.jooq.RecordType;
 import org.jooq.Result;
 import org.jooq.Schema;
 import org.jooq.SelectJoinStep;
@@ -83,7 +85,6 @@ public class EntitiesTable
 
     public BaseEntity fetchEntity( EntityReference reference, ModuleDescriptor module )
     {
-
         Result<Record> baseEntityResult = dsl
             .selectFrom( entitiesTable )
             .where( identityColumn.eq( reference.identity().toString() ) )
@@ -128,7 +129,7 @@ public class EntitiesTable
         }
         catch( ClassNotFoundException e )
         {
-            throw new NoSuchEntityTypeException( typeName, module);
+            throw new NoSuchEntityTypeException( typeName, module );
         }
     }
 
@@ -202,18 +203,29 @@ public class EntitiesTable
         };
     }
 
-    void createNewBaseEntity( EntityReference reference, EntityDescriptor descriptor, EntityStoreUnitOfWork uow )
+    BaseEntity createNewBaseEntity( EntityReference reference, EntityDescriptor descriptor, EntityStoreUnitOfWork uow )
     {
         String valueIdentity = UUID.randomUUID().toString();
+        String typeName = descriptor.primaryType().getName();
+        Instant currentTime = uow.currentTime();
         dsl.insertInto( entitiesTable )
            .set( identityColumn, reference.identity().toString() )
-           .set( createdColumn, new Timestamp( uow.currentTime().toEpochMilli() ) )
-           .set( modifiedColumn, new Timestamp( uow.currentTime().toEpochMilli() ) )
+           .set( createdColumn, new Timestamp( currentTime.toEpochMilli() ))
+           .set( modifiedColumn, new Timestamp( currentTime.toEpochMilli()) )
            .set( valueIdentityColumn, valueIdentity )
-           .set( typeNameColumn, descriptor.primaryType().getName() )
+           .set( typeNameColumn, typeName )
            .set( versionColumn, "1" )
            .set( applicationVersionColumn, applicationVersion )
            .execute();
+        BaseEntity baseEntity = new BaseEntity();
+        baseEntity.type = descriptor;
+        baseEntity.version = "1";
+        baseEntity.applicationVersion = applicationVersion;
+        baseEntity.identity = reference.identity();
+        baseEntity.currentValueIdentity = null;
+        baseEntity.modifedAt = currentTime;
+        baseEntity.createdAt = currentTime;
+        return baseEntity;
     }
 
     private void updateBaseEntity( BaseEntity entity, EntityStoreUnitOfWork uow )
@@ -301,19 +313,34 @@ public class EntitiesTable
         String reference = entity.identity.toString();
         SelectQuery<Record> query = from.where( identityColumnOf( entitiesTable ).eq( reference ) ).getQuery();
         Result<Record> result = query.fetch();
+        RecordType<Record> recordType = result.recordType();
         result.forEach( record ->
                         {
                             AssociationValue value = new AssociationValue();
-                            value.name = QualifiedName.fromClass( entityDescriptor.primaryType(), record.getValue( nameColumn ) );
-                            value.position = record.getValue( indexColumn );
-                            value.reference = record.getValue( referenceColumn );
+                            if( recordType.indexOf( referenceColumn ) >= 0 )
+                            {
+                                // some many-to-many association found.
+                                if( recordType.indexOf( nameColumn ) >= 0 )
+                                {
+                                    // NamedAssociations found.
+                                    value.name = QualifiedName.fromClass( entityDescriptor.primaryType(), record.getValue( nameColumn ) );
+                                }
+                                if( recordType.indexOf( indexColumn ) >= 0 )
+                                {
+                                    // ManyAssociations found.
+                                    value.position = record.getValue( indexColumn );
+                                }
+                                value.reference = record.getValue( referenceColumn );
+                            }
                             consume.accept( value );
                         } );
     }
 
     private Field<String> identityColumnOf( Table<Record> joinedTable )
     {
-        return DSL.field( DSL.name( joinedTable.getName(), identityColumn.getName() ), String.class );
+        String name = joinedTable.getName();
+        String identity = identityColumn.getName();
+        return DSL.field( DSL.name( name, identity ), String.class );
     }
 
     public List<Table<Record>> getMixinTables( EntityDescriptor entityDescriptor )
@@ -334,6 +361,7 @@ public class EntitiesTable
             .filter( NOT_HASIDENTITY )
             .map( type -> findMixinTable( type, entityDescriptor ) )
             .map( MixinTable::associationsTable )
+            .filter( Objects::nonNull )
             .collect( Collectors.toList() );
     }
 

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SqlEntityStoreMixin.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SqlEntityStoreMixin.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SqlEntityStoreMixin.java
index 5f17fd4..4fd7d3c 100644
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SqlEntityStoreMixin.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SqlEntityStoreMixin.java
@@ -317,8 +317,8 @@ public class SqlEntityStoreMixin
         {
             EntityReference ref = state.entityReference();
             EntityDescriptor descriptor = state.entityDescriptor();
-            sqlTable.createNewBaseEntity( ref, descriptor, this.unitOfWork );
-            sqlTable.insertEntity( state, sqlTable.fetchBaseEntity( ref, module ), unitOfWork );
+            BaseEntity baseEntity = sqlTable.createNewBaseEntity( ref, descriptor, this.unitOfWork );
+            sqlTable.insertEntity( state, baseEntity, unitOfWork );
         }
 
         private void updateState( DefaultEntityState state, EntityStoreUnitOfWork unitOfWork )

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SqlTable.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SqlTable.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SqlTable.java
index 6537782..a2fc658 100644
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SqlTable.java
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/SqlTable.java
@@ -20,7 +20,6 @@ package org.apache.polygene.entitystore.sql;
 import java.util.function.Consumer;
 import java.util.stream.Stream;
 import javax.sql.DataSource;
-import org.apache.polygene.api.PolygeneAPI;
 import org.apache.polygene.api.composite.TransientBuilderFactory;
 import org.apache.polygene.api.configuration.Configuration;
 import org.apache.polygene.api.entity.EntityDescriptor;
@@ -30,7 +29,6 @@ import org.apache.polygene.api.injection.scope.Structure;
 import org.apache.polygene.api.injection.scope.This;
 import org.apache.polygene.api.injection.scope.Uses;
 import org.apache.polygene.api.mixin.Mixins;
-import org.apache.polygene.api.object.ObjectFactory;
 import org.apache.polygene.api.service.ServiceActivation;
 import org.apache.polygene.api.service.ServiceDescriptor;
 import org.apache.polygene.api.structure.Application;
@@ -102,7 +100,7 @@ public interface SqlTable extends ServiceActivation
 
     void fetchAssociations( BaseEntity entity, EntityDescriptor descriptor, Consumer<AssociationValue> consume );
 
-    void createNewBaseEntity( EntityReference ref, EntityDescriptor descriptor, EntityStoreUnitOfWork unitOfWork );
+    BaseEntity createNewBaseEntity( EntityReference ref, EntityDescriptor descriptor, EntityStoreUnitOfWork unitOfWork );
 
     void insertEntity( DefaultEntityState state, BaseEntity baseEntity, EntityStoreUnitOfWork unitOfWork );
 
@@ -162,9 +160,9 @@ public interface SqlTable extends ServiceActivation
         }
 
         @Override
-        public void createNewBaseEntity( EntityReference ref, EntityDescriptor descriptor, EntityStoreUnitOfWork unitOfWork )
+        public BaseEntity createNewBaseEntity( EntityReference ref, EntityDescriptor descriptor, EntityStoreUnitOfWork unitOfWork )
         {
-            entitiesTable.createNewBaseEntity( ref, descriptor, unitOfWork );
+            return entitiesTable.createNewBaseEntity( ref, descriptor, unitOfWork );
         }
 
         @Override
@@ -216,7 +214,8 @@ public interface SqlTable extends ServiceActivation
                 if( !dialect.equals( SQLDialect.SQLITE )
                     && dsl.meta().getSchemas().stream().noneMatch( s -> schema.getName().equalsIgnoreCase( s.getName() ) ) )
                 {
-                    dsl.createSchema( schema ).execute();
+                    dsl.createSchema( schemaName ).execute();
+                    datasource.getConnection().commit();
                 }
 
                 dsl.createTableIfNotExists( DSL.name( schemaName, typesTableName ) )
@@ -225,6 +224,7 @@ public interface SqlTable extends ServiceActivation
                    .column( createdColumn )
                    .column( modifiedColumn )
                    .execute();
+                datasource.getConnection().commit();
 
                 dsl.createTableIfNotExists( DSL.name( schemaName, entitiesTableName ) )
                    .column( identityColumn )
@@ -235,8 +235,8 @@ public interface SqlTable extends ServiceActivation
                    .column( modifiedColumn )
                    .column( createdColumn )
                    .execute();
+                datasource.getConnection().commit();
             }
-            datasource.getConnection().commit();
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/AbstractSQLEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/AbstractSQLEntityStoreAssembler.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/AbstractSQLEntityStoreAssembler.java
new file mode 100644
index 0000000..c9258ec
--- /dev/null
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/AbstractSQLEntityStoreAssembler.java
@@ -0,0 +1,73 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.sql.assembly;
+
+import org.apache.polygene.api.identity.Identity;
+import org.apache.polygene.api.identity.StringIdentity;
+import org.apache.polygene.bootstrap.Assembler;
+import org.apache.polygene.bootstrap.Assemblers;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.sql.JooqDslContext;
+import org.apache.polygene.entitystore.sql.SqlEntityStoreConfiguration;
+import org.apache.polygene.entitystore.sql.SqlEntityStoreService;
+import org.jooq.conf.RenderNameStyle;
+import org.jooq.conf.Settings;
+
+/**
+ * JOOQ EntityStore assembly.
+ */
+@SuppressWarnings( "WeakerAccess" )
+public abstract class AbstractSQLEntityStoreAssembler<T extends AbstractSQLEntityStoreAssembler> extends Assemblers.VisibilityIdentityConfig<T>
+    implements Assembler
+{
+    public static final Identity DEFAULT_ENTITYSTORE_IDENTITY = StringIdentity.identityOf( "entitystore-sql" );
+
+    @Override
+    public void assemble( ModuleAssembly module )
+    {
+        Settings settings = getSettings();
+        if( settings == null )
+        {
+            throw new AssemblyException( "Settings must not be null" );
+        }
+
+        String identity = ( hasIdentity() ? identity() : DEFAULT_ENTITYSTORE_IDENTITY ).toString();
+        module.transients( JooqDslContext.class );
+
+        module.services( SqlEntityStoreService.class )
+              .identifiedBy( identity )
+              .visibleIn( visibility() )
+              .instantiateOnStartup()
+              .setMetaInfo( settings );
+
+        if( hasConfig() )
+        {
+            configModule().entities( SqlEntityStoreConfiguration.class ).visibleIn( configVisibility() );
+        }
+        super.assemble( module );
+    }
+
+    protected Settings getSettings()
+    {
+        return new Settings().withRenderNameStyle( RenderNameStyle.QUOTED );
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/DerbySQLEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/DerbySQLEntityStoreAssembler.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/DerbySQLEntityStoreAssembler.java
new file mode 100644
index 0000000..f150ede
--- /dev/null
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/DerbySQLEntityStoreAssembler.java
@@ -0,0 +1,12 @@
+package org.apache.polygene.entitystore.sql.assembly;
+
+import org.jooq.SQLDialect;
+
+public class DerbySQLEntityStoreAssembler extends AbstractSQLEntityStoreAssembler<DerbySQLEntityStoreAssembler>
+{
+    protected SQLDialect getSQLDialect()
+    {
+        return SQLDialect.DERBY;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/H2SQLEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/H2SQLEntityStoreAssembler.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/H2SQLEntityStoreAssembler.java
new file mode 100644
index 0000000..4bc40e2
--- /dev/null
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/H2SQLEntityStoreAssembler.java
@@ -0,0 +1,12 @@
+package org.apache.polygene.entitystore.sql.assembly;
+
+import org.jooq.SQLDialect;
+
+public class H2SQLEntityStoreAssembler extends AbstractSQLEntityStoreAssembler<H2SQLEntityStoreAssembler>
+{
+    protected SQLDialect getSQLDialect()
+    {
+        return SQLDialect.H2;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/MariaDbSQLEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/MariaDbSQLEntityStoreAssembler.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/MariaDbSQLEntityStoreAssembler.java
new file mode 100644
index 0000000..a9b6d6b
--- /dev/null
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/MariaDbSQLEntityStoreAssembler.java
@@ -0,0 +1,12 @@
+package org.apache.polygene.entitystore.sql.assembly;
+
+import org.jooq.SQLDialect;
+
+public class MariaDbSQLEntityStoreAssembler extends AbstractSQLEntityStoreAssembler<MariaDbSQLEntityStoreAssembler>
+{
+    protected SQLDialect getSQLDialect()
+    {
+        return SQLDialect.MARIADB;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/MySQLEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/MySQLEntityStoreAssembler.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/MySQLEntityStoreAssembler.java
new file mode 100644
index 0000000..4cc3bda
--- /dev/null
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/MySQLEntityStoreAssembler.java
@@ -0,0 +1,12 @@
+package org.apache.polygene.entitystore.sql.assembly;
+
+import org.jooq.SQLDialect;
+
+public class MySQLEntityStoreAssembler extends AbstractSQLEntityStoreAssembler<MySQLEntityStoreAssembler>
+{
+    protected SQLDialect getSQLDialect()
+    {
+        return SQLDialect.MYSQL;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/PostgreSQLEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/PostgreSQLEntityStoreAssembler.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/PostgreSQLEntityStoreAssembler.java
new file mode 100644
index 0000000..34901f4
--- /dev/null
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/PostgreSQLEntityStoreAssembler.java
@@ -0,0 +1,12 @@
+package org.apache.polygene.entitystore.sql.assembly;
+
+import org.jooq.SQLDialect;
+
+public class PostgreSQLEntityStoreAssembler extends AbstractSQLEntityStoreAssembler<PostgreSQLEntityStoreAssembler>
+{
+    protected SQLDialect getSQLDialect()
+    {
+        return SQLDialect.POSTGRES;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLEntityStoreAssembler.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLEntityStoreAssembler.java
new file mode 100644
index 0000000..53a5d58
--- /dev/null
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLEntityStoreAssembler.java
@@ -0,0 +1,9 @@
+package org.apache.polygene.entitystore.sql.assembly;
+
+/**
+ * This is a dummy Assembler to support the Yeoman Polygene Generator, which require naming conventions for
+ * the systems that it supports.
+ */
+public class SQLEntityStoreAssembler extends H2SQLEntityStoreAssembler
+{
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLiteEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLiteEntityStoreAssembler.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLiteEntityStoreAssembler.java
new file mode 100644
index 0000000..6f132fd
--- /dev/null
+++ b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SQLiteEntityStoreAssembler.java
@@ -0,0 +1,12 @@
+package org.apache.polygene.entitystore.sql.assembly;
+
+import org.jooq.SQLDialect;
+
+public class SQLiteEntityStoreAssembler extends AbstractSQLEntityStoreAssembler<SQLiteEntityStoreAssembler>
+{
+    protected SQLDialect getSQLDialect()
+    {
+        return SQLDialect.SQLITE;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SqlEntityStoreAssembler.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SqlEntityStoreAssembler.java b/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SqlEntityStoreAssembler.java
deleted file mode 100644
index 847c07b..0000000
--- a/extensions/entitystore-sql/src/main/java/org/apache/polygene/entitystore/sql/assembly/SqlEntityStoreAssembler.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- *
- */
-package org.apache.polygene.entitystore.sql.assembly;
-
-import org.apache.polygene.api.identity.Identity;
-import org.apache.polygene.api.identity.StringIdentity;
-import org.apache.polygene.bootstrap.Assembler;
-import org.apache.polygene.bootstrap.Assemblers;
-import org.apache.polygene.bootstrap.AssemblyException;
-import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.sql.JooqDslContext;
-import org.apache.polygene.entitystore.sql.SqlEntityStoreConfiguration;
-import org.apache.polygene.entitystore.sql.SqlEntityStoreService;
-import org.jooq.SQLDialect;
-import org.jooq.conf.RenderNameStyle;
-import org.jooq.conf.Settings;
-
-/**
- * JOOQ EntityStore assembly.
- */
-@SuppressWarnings( "WeakerAccess" )
-public class SqlEntityStoreAssembler extends Assemblers.VisibilityIdentityConfig<SqlEntityStoreAssembler>
-    implements Assembler
-{
-    public static final Identity DEFAULT_ENTITYSTORE_IDENTITY = StringIdentity.identityOf( "entitystore-sql" );
-
-    @Override
-    public void assemble( ModuleAssembly module )
-    {
-        Settings settings = getSettings();
-        if( settings == null )
-        {
-            throw new AssemblyException( "Settings must not be null" );
-        }
-
-        String identity = ( hasIdentity() ? identity() : DEFAULT_ENTITYSTORE_IDENTITY ).toString();
-        module.transients( JooqDslContext.class );
-
-        module.services( SqlEntityStoreService.class )
-              .identifiedBy( identity )
-              .visibleIn( visibility() )
-              .instantiateOnStartup()
-              .setMetaInfo( settings );
-
-        if( hasConfig() )
-        {
-            configModule().entities( SqlEntityStoreConfiguration.class ).visibleIn( configVisibility() );
-        }
-        super.assemble( module );
-    }
-
-    protected Settings getSettings()
-    {
-        return new Settings().withRenderNameStyle( RenderNameStyle.QUOTED );
-    }
-
-    protected SQLDialect getSQLDialect()
-    {
-        return SQLDialect.DEFAULT;
-    }
-}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/DerbySQLEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/DerbySQLEntityStoreTest.java b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/DerbySQLEntityStoreTest.java
new file mode 100644
index 0000000..512c43e
--- /dev/null
+++ b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/DerbySQLEntityStoreTest.java
@@ -0,0 +1,99 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.sql;
+
+import java.sql.Connection;
+import java.sql.Statement;
+import javax.sql.DataSource;
+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.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.sql.assembly.AbstractSQLEntityStoreAssembler;
+import org.apache.polygene.entitystore.sql.assembly.DerbySQLEntityStoreAssembler;
+import org.apache.polygene.library.sql.assembly.DataSourceAssembler;
+import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.test.entity.AbstractEntityStoreTest;
+
+import static org.apache.polygene.api.usecase.UsecaseBuilder.newUsecase;
+
+public class DerbySQLEntityStoreTest
+    extends AbstractEntityStoreTest
+{
+    @Override
+    // START SNIPPET: assembly
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        // END SNIPPET: assembly
+        super.assemble( module );
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().defaultServicesVisibleIn( Visibility.layer ).assemble( config );
+
+        // START SNIPPET: assembly
+        // 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" )
+            .visibleIn( Visibility.module )
+            .withCircuitBreaker()
+            .assemble( module );
+
+        // SQL EntityStore
+        new DerbySQLEntityStoreAssembler()
+            .visibleIn( Visibility.application )
+            .withConfig( config, Visibility.layer )
+            .assemble( module );
+    }
+    // END SNIPPET: assembly
+
+    @Override
+    public void tearDown()
+        throws Exception
+    {
+        UnitOfWork uow = this.unitOfWorkFactory.newUnitOfWork( newUsecase("Delete " + getClass().getSimpleName() + " test data" ) );
+        try
+        {
+            SqlEntityStoreConfiguration config = uow.get( SqlEntityStoreConfiguration.class,
+                                                          AbstractSQLEntityStoreAssembler.DEFAULT_ENTITYSTORE_IDENTITY );
+            Connection connection = serviceFinder.findService( DataSource.class ).get().getConnection();
+            connection.setAutoCommit( false );
+            try( Statement stmt = connection.createStatement() )
+            {
+                stmt.execute( String.format( "DROP DATABASE FROM %s", config.schemaName().get() ) );
+                connection.commit();
+            }
+        }
+        finally
+        {
+            uow.discard();
+            super.tearDown();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/DerbySQLEntityStoreTestSuite.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/DerbySQLEntityStoreTestSuite.java b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/DerbySQLEntityStoreTestSuite.java
new file mode 100644
index 0000000..cdfcd54
--- /dev/null
+++ b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/DerbySQLEntityStoreTestSuite.java
@@ -0,0 +1,94 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.sql;
+
+import java.sql.Connection;
+import java.sql.Statement;
+import javax.sql.DataSource;
+import org.apache.polygene.api.common.Visibility;
+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.ModuleAssembly;
+import org.apache.polygene.entitystore.sql.SqlEntityStoreConfiguration;
+import org.apache.polygene.entitystore.sql.assembly.AbstractSQLEntityStoreAssembler;
+import org.apache.polygene.entitystore.sql.assembly.DerbySQLEntityStoreAssembler;
+import org.apache.polygene.library.sql.assembly.DataSourceAssembler;
+import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
+import org.apache.polygene.test.entity.model.EntityStoreTestSuite;
+
+import static org.apache.polygene.entitystore.sql.assembly.DerbySQLEntityStoreAssembler.DEFAULT_ENTITYSTORE_IDENTITY;
+
+public class DerbySQLEntityStoreTestSuite extends EntityStoreTestSuite
+{
+    @Override
+    protected void defineStorageModule( ModuleAssembly module )
+    {
+        module.defaultServices();
+        // DataSourceService
+        new DBCPDataSourceServiceAssembler()
+            .identifiedBy( "derby-datasource-service" )
+            .visibleIn( Visibility.module )
+            .withConfig( configModule, Visibility.application )
+            .assemble( module );
+
+        // DataSource
+        new DataSourceAssembler()
+            .withDataSourceServiceIdentity( "derby-datasource-service" )
+            .identifiedBy( "derby-datasource" )
+            .visibleIn( Visibility.module )
+            .withCircuitBreaker()
+            .assemble( module );
+
+        // SQL EntityStore
+        new DerbySQLEntityStoreAssembler()
+            .visibleIn( Visibility.application )
+            .withConfig( configModule, Visibility.application )
+            .assemble( module );
+    }
+
+    @Override
+    public void tearDown()
+        throws Exception
+    {
+        Module storageModule = application.findModule( "Infrastructure Layer","Storage Module" );
+        UnitOfWorkFactory uowf = storageModule.unitOfWorkFactory();
+        UnitOfWork uow = uowf.newUnitOfWork( UsecaseBuilder.newUsecase(
+            "Delete " + getClass().getSimpleName() + " test data" ) );
+        try
+        {
+            SqlEntityStoreConfiguration config = uow.get( SqlEntityStoreConfiguration.class,
+                                                          AbstractSQLEntityStoreAssembler.DEFAULT_ENTITYSTORE_IDENTITY );
+            Connection connection = storageModule.serviceFinder().findService( DataSource.class ).get().getConnection();
+            connection.setAutoCommit( false );
+            try( Statement stmt = connection.createStatement() )
+            {
+                stmt.execute( String.format( "DROP DATABASE FROM %s", config.schemaName().get() ) );
+                connection.commit();
+            }
+        }
+        finally
+        {
+            uow.discard();
+            super.tearDown();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/H2SQLEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/H2SQLEntityStoreTest.java b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/H2SQLEntityStoreTest.java
new file mode 100644
index 0000000..4b4b759
--- /dev/null
+++ b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/H2SQLEntityStoreTest.java
@@ -0,0 +1,67 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.sql;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.sql.assembly.H2SQLEntityStoreAssembler;
+import org.apache.polygene.library.sql.assembly.DataSourceAssembler;
+import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.test.entity.AbstractEntityStoreTest;
+
+public class H2SQLEntityStoreTest
+    extends AbstractEntityStoreTest
+{
+    @Override
+    // START SNIPPET: assembly
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        // END SNIPPET: assembly
+        super.assemble( module );
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().defaultServicesVisibleIn( Visibility.layer ).assemble( config );
+
+        // START SNIPPET: assembly
+        // DataSourceService
+        new DBCPDataSourceServiceAssembler()
+            .identifiedBy( "h2-datasource-service" )
+            .visibleIn( Visibility.module )
+            .withConfig( config, Visibility.layer )
+            .assemble( module );
+
+        // DataSource
+        new DataSourceAssembler()
+            .withDataSourceServiceIdentity( "h2-datasource-service" )
+            .identifiedBy( "h2-datasource" )
+            .visibleIn( Visibility.module )
+            .withCircuitBreaker()
+            .assemble( module );
+
+        // SQL EntityStore
+        new H2SQLEntityStoreAssembler()
+            .visibleIn( Visibility.application )
+            .withConfig( config, Visibility.layer )
+            .assemble( module );
+    }
+    // END SNIPPET: assembly
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/H2SQLEntityStoreTestSuite.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/H2SQLEntityStoreTestSuite.java b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/H2SQLEntityStoreTestSuite.java
new file mode 100644
index 0000000..f763238
--- /dev/null
+++ b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/H2SQLEntityStoreTestSuite.java
@@ -0,0 +1,56 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.sql;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.sql.assembly.H2SQLEntityStoreAssembler;
+import org.apache.polygene.library.sql.assembly.DataSourceAssembler;
+import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
+import org.apache.polygene.test.entity.model.EntityStoreTestSuite;
+
+public class H2SQLEntityStoreTestSuite extends EntityStoreTestSuite
+{
+    @Override
+    protected void defineStorageModule( ModuleAssembly module )
+    {
+        module.defaultServices();
+        // DataSourceService
+        new DBCPDataSourceServiceAssembler()
+            .identifiedBy( "h2-datasource-service" )
+            .visibleIn( Visibility.module )
+            .withConfig( configModule, Visibility.application )
+            .assemble( module );
+
+        // DataSource
+        new DataSourceAssembler()
+            .withDataSourceServiceIdentity( "h2-datasource-service" )
+            .identifiedBy( "h2-datasource" )
+            .visibleIn( Visibility.module )
+            .withCircuitBreaker()
+            .assemble( module );
+
+        // SQL EntityStore
+        new H2SQLEntityStoreAssembler()
+            .visibleIn( Visibility.application )
+            .withConfig( configModule, Visibility.application )
+            .assemble( module );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/MySQLEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/MySQLEntityStoreTest.java b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/MySQLEntityStoreTest.java
new file mode 100644
index 0000000..fe8da9c
--- /dev/null
+++ b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/MySQLEntityStoreTest.java
@@ -0,0 +1,125 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.sql;
+
+import java.sql.Connection;
+import java.sql.Statement;
+import java.util.HashMap;
+import javax.sql.DataSource;
+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.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.sql.assembly.AbstractSQLEntityStoreAssembler;
+import org.apache.polygene.entitystore.sql.assembly.MySQLEntityStoreAssembler;
+import org.apache.polygene.library.sql.assembly.DataSourceAssembler;
+import org.apache.polygene.library.sql.datasource.DataSourceConfiguration;
+import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.test.docker.DockerRule;
+import org.apache.polygene.test.entity.AbstractEntityStoreTest;
+import org.junit.ClassRule;
+
+public class MySQLEntityStoreTest
+    extends AbstractEntityStoreTest
+{
+    @ClassRule
+    public static final DockerRule DOCKER = new DockerRule(
+        "mysql",
+        new HashMap<String, String>()
+        {{
+            put( "MYSQL_ROOT_PASSWORD", "" );
+            put( "MYSQL_ALLOW_EMPTY_PASSWORD", "yes" );
+            put( "MYSQL_DATABASE", "jdbc_test_db" );
+            put( "MYSQL_ROOT_HOST", "172.17.0.1" );
+        }},
+        30000L
+//        , "mysqld: ready for connections"   TODO: add this after next release of tdomzal/junit-docker-rule
+    );
+
+    @Override
+    // START SNIPPET: assembly
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        // END SNIPPET: assembly
+        super.assemble( module );
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().defaultServicesVisibleIn( Visibility.layer ).assemble( config );
+
+        // START SNIPPET: assembly
+        // DataSourceService
+        new DBCPDataSourceServiceAssembler()
+            .identifiedBy( "mysql-datasource-service" )
+            .visibleIn( Visibility.module )
+            .withConfig( config, Visibility.layer )
+            .assemble( module );
+
+        // DataSource
+        new DataSourceAssembler()
+            .withDataSourceServiceIdentity( "mysql-datasource-service" )
+            .identifiedBy( "mysql-datasource" )
+            .visibleIn( Visibility.module )
+            .withCircuitBreaker()
+            .assemble( module );
+
+        // SQL EntityStore
+        new MySQLEntityStoreAssembler()
+            .visibleIn( Visibility.application )
+            .withConfig( config, Visibility.layer )
+            .assemble( module );
+        // END SNIPPET: assembly
+        String mysqlHost = DOCKER.getDockerHost();
+        int mysqlPort = DOCKER.getExposedContainerPort( "3306/tcp" );
+        config.forMixin( DataSourceConfiguration.class ).declareDefaults()
+              .url().set( "jdbc:mysql://" + mysqlHost + ":" + mysqlPort
+                          + "/jdbc_test_db?profileSQL=false&useLegacyDatetimeCode=false&serverTimezone=UTC"
+                          + "&nullCatalogMeansCurrent=true&nullNamePatternMatchesAll=true" );
+        // START SNIPPET: assembly
+    }
+    // END SNIPPET: assembly
+
+    @Override
+    public void tearDown()
+        throws Exception
+    {
+        UnitOfWork uow = this.unitOfWorkFactory.newUnitOfWork(
+            UsecaseBuilder.newUsecase( "Delete " + getClass().getSimpleName() + " test data" )
+                                                             );
+        try
+        {
+            Connection connection = serviceFinder.findService( DataSource.class ).get().getConnection();
+            SqlEntityStoreConfiguration config = uow.get( SqlEntityStoreConfiguration.class,
+                                                          AbstractSQLEntityStoreAssembler.DEFAULT_ENTITYSTORE_IDENTITY );
+            connection.setAutoCommit( false );
+            try( Statement stmt = connection.createStatement() )
+            {
+                stmt.execute( String.format( "DROP DATABASE FROM %s", config.schemaName().get() ) );
+                connection.commit();
+            }
+        }
+        finally
+        {
+            uow.discard();
+            super.tearDown();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/MySQLEntityStoreTestSuite.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/MySQLEntityStoreTestSuite.java b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/MySQLEntityStoreTestSuite.java
new file mode 100644
index 0000000..f625317
--- /dev/null
+++ b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/MySQLEntityStoreTestSuite.java
@@ -0,0 +1,118 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.sql;
+
+import java.sql.Connection;
+import java.sql.Statement;
+import java.util.HashMap;
+import javax.sql.DataSource;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.service.ServiceFinder;
+import org.apache.polygene.api.structure.Module;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.sql.assembly.AbstractSQLEntityStoreAssembler;
+import org.apache.polygene.entitystore.sql.assembly.MySQLEntityStoreAssembler;
+import org.apache.polygene.library.sql.assembly.DataSourceAssembler;
+import org.apache.polygene.library.sql.datasource.DataSourceConfiguration;
+import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
+import org.apache.polygene.test.docker.DockerRule;
+import org.apache.polygene.test.entity.model.EntityStoreTestSuite;
+import org.junit.ClassRule;
+
+import static org.apache.polygene.api.usecase.UsecaseBuilder.newUsecase;
+
+public class MySQLEntityStoreTestSuite extends EntityStoreTestSuite
+{
+    @ClassRule
+    public static final DockerRule DOCKER = new DockerRule(
+        "mysql",
+        new HashMap<String, String>()
+        {{
+            put( "MYSQL_ROOT_PASSWORD", "" );
+            put( "MYSQL_ALLOW_EMPTY_PASSWORD", "yes" );
+            put( "MYSQL_DATABASE", "jdbc_test_db" );
+            put( "MYSQL_ROOT_HOST", "172.17.0.1" );
+        }},
+        30000L
+//        , "mysqld: ready for connections"   TODO: add this after next release of tdomzal/junit-docker-rule
+    );
+
+    @Override
+    protected void defineStorageModule( ModuleAssembly module )
+    {
+        module.defaultServices();
+        // DataSourceService
+        new DBCPDataSourceServiceAssembler()
+            .identifiedBy( "mysql-datasource-service" )
+            .visibleIn( Visibility.module )
+            .withConfig( configModule, Visibility.application )
+            .assemble( module );
+
+        // DataSource
+        new DataSourceAssembler()
+            .withDataSourceServiceIdentity( "mysql-datasource-service" )
+            .identifiedBy( "mysql-datasource" )
+            .visibleIn( Visibility.module )
+            .withCircuitBreaker()
+            .assemble( module );
+
+        // SQL EntityStore
+        new MySQLEntityStoreAssembler()
+            .visibleIn( Visibility.application )
+            .withConfig( configModule, Visibility.application )
+            .assemble( module );
+
+        String mysqlHost = DOCKER.getDockerHost();
+        int mysqlPort = DOCKER.getExposedContainerPort( "3306/tcp" );
+        configModule.forMixin( DataSourceConfiguration.class ).declareDefaults()
+                    .url().set( "jdbc:mysql://" + mysqlHost + ":" + mysqlPort
+                                + "/jdbc_test_db?profileSQL=false&useLegacyDatetimeCode=false&serverTimezone=UTC"
+                                + "&nullCatalogMeansCurrent=true&nullNamePatternMatchesAll=true" );
+    }
+
+    @Override
+    public void tearDown()
+        throws Exception
+    {
+        Module storageModule = application.findModule( "Infrastructure Layer", "Storage Module" );
+        UnitOfWorkFactory uowf = storageModule.unitOfWorkFactory();
+        ServiceFinder serviceFinder = storageModule.serviceFinder();
+        UnitOfWork uow = uowf.newUnitOfWork( newUsecase( "Delete " + getClass().getSimpleName() + " test data" ) );
+        try
+        {
+            Connection connection = serviceFinder.findService( DataSource.class ).get().getConnection();
+            SqlEntityStoreConfiguration config = uow.get( SqlEntityStoreConfiguration.class,
+                                                          AbstractSQLEntityStoreAssembler.DEFAULT_ENTITYSTORE_IDENTITY );
+            connection.setAutoCommit( false );
+            try( Statement stmt = connection.createStatement() )
+            {
+                stmt.execute( String.format( "DROP DATABASE FROM %s", config.schemaName().get() ) );
+                connection.commit();
+            }
+        }
+        finally
+        {
+            uow.discard();
+            super.tearDown();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTest.java b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTest.java
new file mode 100644
index 0000000..d193728
--- /dev/null
+++ b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTest.java
@@ -0,0 +1,114 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.sql;
+
+import java.sql.Connection;
+import java.sql.Statement;
+import javax.sql.DataSource;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.unitofwork.UnitOfWork;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.sql.assembly.AbstractSQLEntityStoreAssembler;
+import org.apache.polygene.entitystore.sql.assembly.PostgreSQLEntityStoreAssembler;
+import org.apache.polygene.library.sql.assembly.DataSourceAssembler;
+import org.apache.polygene.library.sql.common.SQLConfiguration;
+import org.apache.polygene.library.sql.datasource.DataSourceConfiguration;
+import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.test.docker.DockerRule;
+import org.apache.polygene.test.entity.AbstractEntityStoreTest;
+import org.junit.ClassRule;
+
+import static org.apache.polygene.api.usecase.UsecaseBuilder.newUsecase;
+
+public class PostgreSQLEntityStoreTest
+    extends AbstractEntityStoreTest
+{
+    @ClassRule
+    public static final DockerRule DOCKER = new DockerRule( "postgres",
+                                                            3000L,
+                                                            "PostgreSQL init process complete; ready for start up." );
+
+    @Override
+    // START SNIPPET: assembly
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        // END SNIPPET: assembly
+        super.assemble( module );
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().defaultServicesVisibleIn( Visibility.layer ).assemble( config );
+
+        // START SNIPPET: assembly
+        // 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" )
+            .visibleIn( Visibility.module )
+            .withCircuitBreaker()
+            .assemble( module );
+
+        // SQL EntityStore
+        new PostgreSQLEntityStoreAssembler()
+            .visibleIn( Visibility.application )
+            .withConfig( config, Visibility.layer )
+            .assemble( module );
+        // END SNIPPET: assembly
+        String host = DOCKER.getDockerHost();
+        int port = DOCKER.getExposedContainerPort( "5432/tcp" );
+        config.forMixin( DataSourceConfiguration.class ).declareDefaults()
+              .url().set( "jdbc:postgresql://" + host + ":" + port + "/jdbc_test_db" );
+        // START SNIPPET: assembly
+    }
+    // END SNIPPET: assembly
+
+    @Override
+    public void tearDown()
+        throws Exception
+    {
+        String usecaseName = "Delete " + getClass().getSimpleName() + " test data";
+        UnitOfWork uow = unitOfWorkFactory.newUnitOfWork( newUsecase( usecaseName ) );
+        try
+        {
+            SQLConfiguration config = uow.get( SQLConfiguration.class, AbstractSQLEntityStoreAssembler.DEFAULT_ENTITYSTORE_IDENTITY );
+            Connection connection = serviceFinder.findService( DataSource.class ).get().getConnection();
+            connection.setAutoCommit( false );
+            String schemaName = config.schemaName().get();
+            try( Statement stmt = connection.createStatement() )
+            {
+                stmt.execute( String.format( "DROP SCHEMA \"%s\" CASCADE", schemaName ) );
+                connection.commit();
+            }
+        }
+        finally
+        {
+            uow.discard();
+            super.tearDown();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTestSuite.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTestSuite.java b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTestSuite.java
new file mode 100644
index 0000000..d53c7d1
--- /dev/null
+++ b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/PostgreSQLEntityStoreTestSuite.java
@@ -0,0 +1,112 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.sql;
+
+import java.sql.Connection;
+import java.sql.Statement;
+import javax.sql.DataSource;
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.api.service.ServiceFinder;
+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.ModuleAssembly;
+import org.apache.polygene.entitystore.sql.assembly.AbstractSQLEntityStoreAssembler;
+import org.apache.polygene.entitystore.sql.assembly.PostgreSQLEntityStoreAssembler;
+import org.apache.polygene.library.sql.assembly.DataSourceAssembler;
+import org.apache.polygene.library.sql.common.SQLConfiguration;
+import org.apache.polygene.library.sql.datasource.DataSourceConfiguration;
+import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
+import org.apache.polygene.test.docker.DockerRule;
+import org.apache.polygene.test.entity.model.EntityStoreTestSuite;
+import org.junit.ClassRule;
+
+import static org.apache.polygene.entitystore.sql.assembly.PostgreSQLEntityStoreAssembler.DEFAULT_ENTITYSTORE_IDENTITY;
+
+public class PostgreSQLEntityStoreTestSuite extends EntityStoreTestSuite
+{
+    @ClassRule
+    public static final DockerRule DOCKER = new DockerRule( "postgres",
+                                                            3000L,
+                                                            "PostgreSQL init process complete; ready for start up." );
+
+    @Override
+    protected void defineStorageModule( ModuleAssembly module )
+    {
+        module.defaultServices();
+        // DataSourceService
+        new DBCPDataSourceServiceAssembler()
+            .identifiedBy( "postgresql-datasource-service" )
+            .visibleIn( Visibility.module )
+            .withConfig( configModule, Visibility.application )
+            .assemble( module );
+
+        // DataSource
+        new DataSourceAssembler()
+            .withDataSourceServiceIdentity( "postgresql-datasource-service" )
+            .identifiedBy( "postgresql-datasource" )
+            .visibleIn( Visibility.module )
+            .withCircuitBreaker()
+            .assemble( module );
+
+        // SQL EntityStore
+        new PostgreSQLEntityStoreAssembler()
+            .visibleIn( Visibility.application )
+            .withConfig( configModule, Visibility.application )
+            .assemble( module );
+
+        String host = DOCKER.getDockerHost();
+        int port = DOCKER.getExposedContainerPort( "5432/tcp" );
+        configModule.forMixin( DataSourceConfiguration.class ).declareDefaults()
+                    .url().set( "jdbc:postgresql://" + host + ":" + port + "/jdbc_test_db" );
+        // START SNIPPET: assembly
+    }
+    // END SNIPPET: assembly
+
+    @Override
+    public void tearDown()
+        throws Exception
+    {
+        Module storageModule = application.findModule( "Infrastructure Layer", "Storage Module" );
+        UnitOfWorkFactory uowf = storageModule.unitOfWorkFactory();
+        ServiceFinder serviceFinder = storageModule.serviceFinder();
+        UnitOfWork uow = uowf.newUnitOfWork(
+            UsecaseBuilder.newUsecase( "Delete " + getClass().getSimpleName() + " test data" )
+                                           );
+        try
+        {
+            SQLConfiguration config = uow.get( SQLConfiguration.class, AbstractSQLEntityStoreAssembler.DEFAULT_ENTITYSTORE_IDENTITY );
+            Connection connection = serviceFinder.findService( DataSource.class ).get().getConnection();
+            connection.setAutoCommit( false );
+            String schemaName = config.schemaName().get();
+            try( Statement stmt = connection.createStatement() )
+            {
+                stmt.execute( String.format( "DROP SCHEMA \"%s\" CASCADE", schemaName ) );
+                connection.commit();
+            }
+        }
+        finally
+        {
+            uow.discard();
+            super.tearDown();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/SQLiteEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/SQLiteEntityStoreTest.java b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/SQLiteEntityStoreTest.java
new file mode 100644
index 0000000..83e8a21
--- /dev/null
+++ b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/SQLiteEntityStoreTest.java
@@ -0,0 +1,75 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.sql;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.AssemblyException;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.sql.assembly.SQLiteEntityStoreAssembler;
+import org.apache.polygene.library.sql.assembly.DataSourceAssembler;
+import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
+import org.apache.polygene.test.EntityTestAssembler;
+import org.apache.polygene.test.entity.AbstractEntityStoreTest;
+import org.junit.BeforeClass;
+
+import static org.apache.polygene.test.util.Assume.assumeNoIbmJdk;
+
+public class SQLiteEntityStoreTest extends AbstractEntityStoreTest
+{
+    @BeforeClass
+    public static void beforeClass_IBMJDK()
+    {
+        assumeNoIbmJdk();
+    }
+
+    @Override
+    // START SNIPPET: assembly
+    public void assemble( ModuleAssembly module )
+        throws AssemblyException
+    {
+        // END SNIPPET: assembly
+        super.assemble( module );
+        ModuleAssembly config = module.layer().module( "config" );
+        new EntityTestAssembler().defaultServicesVisibleIn( Visibility.layer ).assemble( config );
+
+        // START SNIPPET: assembly
+        // DataSourceService
+        new DBCPDataSourceServiceAssembler()
+            .identifiedBy( "sqlite-datasource-service" )
+            .visibleIn( Visibility.module )
+            .withConfig( config, Visibility.layer )
+            .assemble( module );
+
+        // DataSource
+        new DataSourceAssembler()
+            .withDataSourceServiceIdentity( "sqlite-datasource-service" )
+            .identifiedBy( "sqlite-datasource" )
+            .visibleIn( Visibility.module )
+            .withCircuitBreaker()
+            .assemble( module );
+
+        // SQL EntityStore
+        new SQLiteEntityStoreAssembler()
+            .visibleIn( Visibility.application )
+            .withConfig( config, Visibility.layer )
+            .assemble( module );
+    }
+    // END SNIPPET: assembly
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/SQLiteEntityStoreTestSuite.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/SQLiteEntityStoreTestSuite.java b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/SQLiteEntityStoreTestSuite.java
new file mode 100644
index 0000000..6dc5fbe
--- /dev/null
+++ b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/SQLiteEntityStoreTestSuite.java
@@ -0,0 +1,65 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ *
+ */
+package org.apache.polygene.entitystore.sql;
+
+import org.apache.polygene.api.common.Visibility;
+import org.apache.polygene.bootstrap.ModuleAssembly;
+import org.apache.polygene.entitystore.sql.assembly.SQLiteEntityStoreAssembler;
+import org.apache.polygene.library.sql.assembly.DataSourceAssembler;
+import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
+import org.apache.polygene.test.entity.model.EntityStoreTestSuite;
+import org.junit.BeforeClass;
+
+import static org.apache.polygene.test.util.Assume.assumeNoIbmJdk;
+
+public class SQLiteEntityStoreTestSuite extends EntityStoreTestSuite
+{
+    @BeforeClass
+    public static void beforeClass_IBMJDK()
+    {
+        assumeNoIbmJdk();
+    }
+
+    @Override
+    protected void defineStorageModule( ModuleAssembly module )
+    {
+        module.defaultServices();
+        // DataSourceService
+        new DBCPDataSourceServiceAssembler()
+            .identifiedBy( "sqlite-datasource-service" )
+            .visibleIn( Visibility.module )
+            .withConfig( configModule, Visibility.application )
+            .assemble( module );
+
+        // DataSource
+        new DataSourceAssembler()
+            .withDataSourceServiceIdentity( "sqlite-datasource-service" )
+            .identifiedBy( "sqlite-datasource" )
+            .visibleIn( Visibility.module )
+            .withCircuitBreaker()
+            .assemble( module );
+
+        // SQL EntityStore
+        new SQLiteEntityStoreAssembler()
+            .visibleIn( Visibility.application )
+            .withConfig( configModule, Visibility.application )
+            .assemble( module );
+    }
+}

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/SqlEntityStoreTest.java
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/SqlEntityStoreTest.java b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/SqlEntityStoreTest.java
index d8f0d59..2a4ce95 100644
--- a/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/SqlEntityStoreTest.java
+++ b/extensions/entitystore-sql/src/test/java/org/apache/polygene/entitystore/sql/SqlEntityStoreTest.java
@@ -22,7 +22,8 @@ package org.apache.polygene.entitystore.sql;
 import org.apache.polygene.api.common.Visibility;
 import org.apache.polygene.bootstrap.AssemblyException;
 import org.apache.polygene.bootstrap.ModuleAssembly;
-import org.apache.polygene.entitystore.sql.assembly.SqlEntityStoreAssembler;
+import org.apache.polygene.entitystore.sql.assembly.AbstractSQLEntityStoreAssembler;
+import org.apache.polygene.entitystore.sql.assembly.H2SQLEntityStoreAssembler;
 import org.apache.polygene.library.sql.assembly.DataSourceAssembler;
 import org.apache.polygene.library.sql.datasource.DataSourceConfiguration;
 import org.apache.polygene.library.sql.dbcp.DBCPDataSourceServiceAssembler;
@@ -52,7 +53,7 @@ public class SqlEntityStoreTest extends AbstractEntityStoreTest
         // Assemble a DataSource
         new DataSourceAssembler()
             .withDataSourceServiceIdentity( "datasource" )
-            .identifiedBy( "ds-mysql" )
+            .identifiedBy( "ds-h2" )
             .visibleIn( Visibility.module )
             .assemble( module );
 
@@ -63,7 +64,7 @@ public class SqlEntityStoreTest extends AbstractEntityStoreTest
             .withConfig( config, Visibility.layer )
             .assemble( module );
 
-        new SqlEntityStoreAssembler()
+        new H2SQLEntityStoreAssembler()
             .withConfig( config, Visibility.layer )
             .identifiedBy( "sql-entitystore" )
             .assemble( module );

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/test/resources/derby-datasource.properties
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/resources/derby-datasource.properties b/extensions/entitystore-sql/src/test/resources/derby-datasource.properties
new file mode 100644
index 0000000..35261ab
--- /dev/null
+++ b/extensions/entitystore-sql/src/test/resources/derby-datasource.properties
@@ -0,0 +1,25 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+#
+#
+
+enabled=true
+url=jdbc:derby:memory:testdb;create=true
+driver=org.apache.derby.jdbc.EmbeddedDriver
+username=
+password=

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/test/resources/h2-datasource.properties
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/resources/h2-datasource.properties b/extensions/entitystore-sql/src/test/resources/h2-datasource.properties
new file mode 100644
index 0000000..74abf51
--- /dev/null
+++ b/extensions/entitystore-sql/src/test/resources/h2-datasource.properties
@@ -0,0 +1,25 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+#
+#
+
+enabled=true
+url=jdbc:h2:mem:test
+driver=org.h2.Driver
+username=
+password=

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/test/resources/logback.xml
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/resources/logback.xml b/extensions/entitystore-sql/src/test/resources/logback.xml
new file mode 100644
index 0000000..03fb4dd
--- /dev/null
+++ b/extensions/entitystore-sql/src/test/resources/logback.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one
+  ~  or more contributor license agreements.  See the NOTICE file
+  ~  distributed with this work for additional information
+  ~  regarding copyright ownership.  The ASF licenses this file
+  ~  to you under the Apache License, Version 2.0 (the
+  ~  "License"); you may not use this file except in compliance
+  ~  with the License.  You may obtain a copy of the License at
+  ~
+  ~       http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  ~
+  ~
+  -->
+<configuration>
+
+    <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
+        <layout class="ch.qos.logback.classic.PatternLayout">
+            <Pattern>[@%-10thread] %-5level %logger{42} - %msg%n</Pattern>
+        </layout>
+    </appender>
+
+    <root level="info">
+        <appender-ref ref="stdout" />
+    </root>
+
+    <logger name="org.apache.polygene.entitystore.sql" level="debug"/>
+
+</configuration>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/test/resources/mysql-datasource.properties
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/resources/mysql-datasource.properties b/extensions/entitystore-sql/src/test/resources/mysql-datasource.properties
new file mode 100644
index 0000000..a2f4175
--- /dev/null
+++ b/extensions/entitystore-sql/src/test/resources/mysql-datasource.properties
@@ -0,0 +1,25 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+#
+#
+
+enabled=true
+#url=jdbc:mysql://localhost:3306/jdbc_test_db?profileSQL=false&useLegacyDatetimeCode=false&serverTimezone=UTC&nullCatalogMeansCurrent=true&nullNamePatternMatchesAll=true
+driver=com.mysql.cj.jdbc.Driver
+username=root
+password=

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/test/resources/postgresql-datasource.properties
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/resources/postgresql-datasource.properties b/extensions/entitystore-sql/src/test/resources/postgresql-datasource.properties
new file mode 100644
index 0000000..bdda284
--- /dev/null
+++ b/extensions/entitystore-sql/src/test/resources/postgresql-datasource.properties
@@ -0,0 +1,24 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+#
+#
+
+enabled=true
+driver=org.postgresql.Driver
+username=jdbc_test_login
+password=password

http://git-wip-us.apache.org/repos/asf/polygene-java/blob/0f8f0b8d/extensions/entitystore-sql/src/test/resources/sqlite-datasource.properties
----------------------------------------------------------------------
diff --git a/extensions/entitystore-sql/src/test/resources/sqlite-datasource.properties b/extensions/entitystore-sql/src/test/resources/sqlite-datasource.properties
new file mode 100644
index 0000000..17e52b5
--- /dev/null
+++ b/extensions/entitystore-sql/src/test/resources/sqlite-datasource.properties
@@ -0,0 +1,25 @@
+#
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+#
+#
+
+enabled=true
+url=jdbc:sqlite::memory:
+driver=org.sqlite.JDBC
+username=
+password=


Mime
View raw message