cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject [2/3] cayenne git commit: Java 8 - lambdas for Module anonymous inner classes
Date Sat, 23 Sep 2017 19:53:51 GMT
http://git-wip-us.apache.org/repos/asf/cayenne/blob/3fc09431/cayenne-di/src/test/java/org/apache/cayenne/di/spi/DefaultInjectorTest.java
----------------------------------------------------------------------
diff --git a/cayenne-di/src/test/java/org/apache/cayenne/di/spi/DefaultInjectorTest.java b/cayenne-di/src/test/java/org/apache/cayenne/di/spi/DefaultInjectorTest.java
index 23a000c..6bead00 100644
--- a/cayenne-di/src/test/java/org/apache/cayenne/di/spi/DefaultInjectorTest.java
+++ b/cayenne-di/src/test/java/org/apache/cayenne/di/spi/DefaultInjectorTest.java
@@ -18,15 +18,12 @@
  ****************************************************************/
 package org.apache.cayenne.di.spi;
 
-import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.Module;
 import org.apache.cayenne.di.mock.MockImplementation1_EventAnnotations;
 import org.apache.cayenne.di.mock.MockInterface1;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 
 public class DefaultInjectorTest {
 
@@ -40,12 +37,7 @@ public class DefaultInjectorTest {
     public void testConstructor_SingleModule() {
         final boolean[] configureCalled = new boolean[1];
 
-        Module module = new Module() {
-
-            public void configure(Binder binder) {
-                configureCalled[0] = true;
-            }
-        };
+        Module module = binder -> configureCalled[0] = true;
 
         new DefaultInjector(module);
         assertTrue(configureCalled[0]);
@@ -56,19 +48,9 @@ public class DefaultInjectorTest {
 
         final boolean[] configureCalled = new boolean[2];
 
-        Module module1 = new Module() {
-
-            public void configure(Binder binder) {
-                configureCalled[0] = true;
-            }
-        };
+        Module module1 = binder -> configureCalled[0] = true;
 
-        Module module2 = new Module() {
-
-            public void configure(Binder binder) {
-                configureCalled[1] = true;
-            }
-        };
+        Module module2 = binder -> configureCalled[1] = true;
 
         new DefaultInjector(module1, module2);
         assertTrue(configureCalled[0]);
@@ -80,13 +62,10 @@ public class DefaultInjectorTest {
 
         MockImplementation1_EventAnnotations.reset();
 
-        Module module = new Module() {
-
-            public void configure(Binder binder) {
-                binder.bind(MockInterface1.class).to(
-                        MockImplementation1_EventAnnotations.class).inSingletonScope();
-            }
-        };
+        Module module = binder -> binder
+                .bind(MockInterface1.class)
+                .to(MockImplementation1_EventAnnotations.class)
+                .inSingletonScope();
 
         DefaultInjector injector = new DefaultInjector(module);
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3fc09431/cayenne-jcache/src/test/java/org/apache/cayenne/jcache/unit/JCacheCase.java
----------------------------------------------------------------------
diff --git a/cayenne-jcache/src/test/java/org/apache/cayenne/jcache/unit/JCacheCase.java b/cayenne-jcache/src/test/java/org/apache/cayenne/jcache/unit/JCacheCase.java
index d87ff26..1b43c80 100644
--- a/cayenne-jcache/src/test/java/org/apache/cayenne/jcache/unit/JCacheCase.java
+++ b/cayenne-jcache/src/test/java/org/apache/cayenne/jcache/unit/JCacheCase.java
@@ -20,10 +20,8 @@
 package org.apache.cayenne.jcache.unit;
 
 import org.apache.cayenne.configuration.server.ServerRuntime;
-import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
-import org.apache.cayenne.di.Module;
 import org.apache.cayenne.di.spi.DefaultScope;
 import org.apache.cayenne.unit.di.DICase;
 import org.apache.cayenne.unit.di.server.SchemaBuilder;
@@ -42,12 +40,7 @@ public class JCacheCase extends DICase {
         final DefaultScope testScope = new DefaultScope();
         injector = DIBootstrap.createInjector(
                 new ServerCaseModule(testScope),
-                new Module() {
-                    @Override
-                    public void configure(Binder binder) {
-                        binder.bind(ServerRuntime.class).toProvider(CacheServerRuntimeProvider.class).in(testScope);
-                    }
-                }
+                binder -> binder.bind(ServerRuntime.class).toProvider(CacheServerRuntimeProvider.class).in(testScope)
         );
         injector.getInstance(SchemaBuilder.class).rebuildSchema();
     }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3fc09431/cayenne-project/src/test/java/org/apache/cayenne/project/DataChannelProjectLoaderTest.java
----------------------------------------------------------------------
diff --git a/cayenne-project/src/test/java/org/apache/cayenne/project/DataChannelProjectLoaderTest.java b/cayenne-project/src/test/java/org/apache/cayenne/project/DataChannelProjectLoaderTest.java
index 1274732..ba67490 100644
--- a/cayenne-project/src/test/java/org/apache/cayenne/project/DataChannelProjectLoaderTest.java
+++ b/cayenne-project/src/test/java/org/apache/cayenne/project/DataChannelProjectLoaderTest.java
@@ -31,7 +31,6 @@ import org.apache.cayenne.configuration.xml.XMLDataChannelDescriptorLoader;
 import org.apache.cayenne.configuration.xml.XMLDataMapLoader;
 import org.apache.cayenne.configuration.xml.XMLReaderProvider;
 import org.apache.cayenne.di.AdhocObjectFactory;
-import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.ClassLoaderManager;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
@@ -45,9 +44,7 @@ import org.xml.sax.XMLReader;
 
 import java.net.URL;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
+import static org.junit.Assert.*;
 
 public class DataChannelProjectLoaderTest {
 
@@ -56,20 +53,16 @@ public class DataChannelProjectLoaderTest {
 
         DataChannelProjectLoader loader = new DataChannelProjectLoader();
 
-        Module testModule = new Module() {
+        Module testModule = binder -> {
+            binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
+            binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
 
-            @Override
-            public void configure(Binder binder) {
-                binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
-                binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
-
-                binder.bind(DataMapLoader.class).to(XMLDataMapLoader.class);
-                binder.bind(DataChannelDescriptorLoader.class).to(XMLDataChannelDescriptorLoader.class);
-                binder.bind(ConfigurationNameMapper.class).to(DefaultConfigurationNameMapper.class);
-                binder.bind(HandlerFactory.class).to(DefaultHandlerFactory.class);
-                binder.bind(DataChannelMetaData.class).to(NoopDataChannelMetaData.class);
-                binder.bind(XMLReader.class).toProviderInstance(new XMLReaderProvider(false)).withoutScope();
-            }
+            binder.bind(DataMapLoader.class).to(XMLDataMapLoader.class);
+            binder.bind(DataChannelDescriptorLoader.class).to(XMLDataChannelDescriptorLoader.class);
+            binder.bind(ConfigurationNameMapper.class).to(DefaultConfigurationNameMapper.class);
+            binder.bind(HandlerFactory.class).to(DefaultHandlerFactory.class);
+            binder.bind(DataChannelMetaData.class).to(NoopDataChannelMetaData.class);
+            binder.bind(XMLReader.class).toProviderInstance(new XMLReaderProvider(false)).withoutScope();
         };
 
         Injector injector = DIBootstrap.createInjector(testModule);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3fc09431/cayenne-project/src/test/java/org/apache/cayenne/project/DataChannelProjectSaverTest.java
----------------------------------------------------------------------
diff --git a/cayenne-project/src/test/java/org/apache/cayenne/project/DataChannelProjectSaverTest.java b/cayenne-project/src/test/java/org/apache/cayenne/project/DataChannelProjectSaverTest.java
index 0908d0d..30044aa 100644
--- a/cayenne-project/src/test/java/org/apache/cayenne/project/DataChannelProjectSaverTest.java
+++ b/cayenne-project/src/test/java/org/apache/cayenne/project/DataChannelProjectSaverTest.java
@@ -31,7 +31,6 @@ import org.apache.cayenne.configuration.xml.XMLDataChannelDescriptorLoader;
 import org.apache.cayenne.configuration.xml.XMLDataMapLoader;
 import org.apache.cayenne.configuration.xml.XMLReaderProvider;
 import org.apache.cayenne.di.AdhocObjectFactory;
-import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.ClassLoaderManager;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
@@ -50,9 +49,7 @@ import java.io.PrintWriter;
 import java.net.URL;
 import java.util.Collections;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
 
 public class DataChannelProjectSaverTest extends Project2Case {
 
@@ -61,21 +58,17 @@ public class DataChannelProjectSaverTest extends Project2Case {
 
         FileProjectSaver saver = new FileProjectSaver(Collections.<ProjectExtension>emptyList());
 
-        Module testModule = new Module() {
-
-            @Override
-            public void configure(Binder binder) {
-                binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
-                binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
-
-                binder.bind(DataMapLoader.class).to(XMLDataMapLoader.class);
-                binder.bind(DataChannelDescriptorLoader.class).to(XMLDataChannelDescriptorLoader.class);
-                binder.bind(ProjectLoader.class).to(DataChannelProjectLoader.class);
-                binder.bind(ConfigurationNameMapper.class).to(DefaultConfigurationNameMapper.class);
-                binder.bind(HandlerFactory.class).to(DefaultHandlerFactory.class);
-                binder.bind(DataChannelMetaData.class).to(NoopDataChannelMetaData.class);
-                binder.bind(XMLReader.class).toProviderInstance(new XMLReaderProvider(false)).withoutScope();
-            }
+        Module testModule = binder -> {
+            binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
+            binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
+
+            binder.bind(DataMapLoader.class).to(XMLDataMapLoader.class);
+            binder.bind(DataChannelDescriptorLoader.class).to(XMLDataChannelDescriptorLoader.class);
+            binder.bind(ProjectLoader.class).to(DataChannelProjectLoader.class);
+            binder.bind(ConfigurationNameMapper.class).to(DefaultConfigurationNameMapper.class);
+            binder.bind(HandlerFactory.class).to(DefaultHandlerFactory.class);
+            binder.bind(DataChannelMetaData.class).to(NoopDataChannelMetaData.class);
+            binder.bind(XMLReader.class).toProviderInstance(new XMLReaderProvider(false)).withoutScope();
         };
 
         Injector injector = DIBootstrap.createInjector(testModule);
@@ -117,20 +110,16 @@ public class DataChannelProjectSaverTest extends Project2Case {
             }
         };
 
-        Module testModule = new Module() {
-
-            @Override
-            public void configure(Binder binder) {
-                binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
-                binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
-                binder.bind(DataMapLoader.class).to(XMLDataMapLoader.class);
-                binder.bind(DataChannelDescriptorLoader.class).to(XMLDataChannelDescriptorLoader.class);
-                binder.bind(ProjectLoader.class).to(DataChannelProjectLoader.class);
-                binder.bind(ConfigurationNameMapper.class).to(DefaultConfigurationNameMapper.class);
-                binder.bind(HandlerFactory.class).to(DefaultHandlerFactory.class);
-                binder.bind(DataChannelMetaData.class).to(NoopDataChannelMetaData.class);
-                binder.bind(XMLReader.class).toProviderInstance(new XMLReaderProvider(false)).withoutScope();
-            }
+        Module testModule = binder -> {
+            binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
+            binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
+            binder.bind(DataMapLoader.class).to(XMLDataMapLoader.class);
+            binder.bind(DataChannelDescriptorLoader.class).to(XMLDataChannelDescriptorLoader.class);
+            binder.bind(ProjectLoader.class).to(DataChannelProjectLoader.class);
+            binder.bind(ConfigurationNameMapper.class).to(DefaultConfigurationNameMapper.class);
+            binder.bind(HandlerFactory.class).to(DefaultHandlerFactory.class);
+            binder.bind(DataChannelMetaData.class).to(NoopDataChannelMetaData.class);
+            binder.bind(XMLReader.class).toProviderInstance(new XMLReaderProvider(false)).withoutScope();
         };
 
         Injector injector = DIBootstrap.createInjector(testModule);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3fc09431/cayenne-project/src/test/java/org/apache/cayenne/project/FileProjectSaverTest.java
----------------------------------------------------------------------
diff --git a/cayenne-project/src/test/java/org/apache/cayenne/project/FileProjectSaverTest.java b/cayenne-project/src/test/java/org/apache/cayenne/project/FileProjectSaverTest.java
index 747b101..2bf22cd 100644
--- a/cayenne-project/src/test/java/org/apache/cayenne/project/FileProjectSaverTest.java
+++ b/cayenne-project/src/test/java/org/apache/cayenne/project/FileProjectSaverTest.java
@@ -23,7 +23,6 @@ import org.apache.cayenne.configuration.ConfigurationTree;
 import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.configuration.DataNodeDescriptor;
 import org.apache.cayenne.configuration.DefaultConfigurationNameMapper;
-import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
 import org.apache.cayenne.di.Module;
@@ -53,13 +52,9 @@ public class FileProjectSaverTest extends Project2Case {
 
     @Before
     public void setUp() throws Exception {
-        Module testModule = new Module() {
-
-            public void configure(Binder binder) {
-                binder.bind(ConfigurationNameMapper.class).to(
-                        DefaultConfigurationNameMapper.class);
-            }
-        };
+        Module testModule = binder -> binder
+                .bind(ConfigurationNameMapper.class)
+                .to(DefaultConfigurationNameMapper.class);
 
         saver = new FileProjectSaver(Collections.<ProjectExtension>emptyList());
         Injector injector = DIBootstrap.createInjector(testModule);
@@ -142,6 +137,7 @@ public class FileProjectSaverTest extends Project2Case {
     /**
      * Method test fix for CAY-1780. If specify related fragments (for example ./../)
      * in target file path then file must be created successfully.
+     *
      * @throws Exception
      */
     @Test

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3fc09431/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerRuntime.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerRuntime.java b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerRuntime.java
index 756cbc7..b8c55f6 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerRuntime.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerRuntime.java
@@ -21,7 +21,6 @@ package org.apache.cayenne.configuration.server;
 import org.apache.cayenne.access.DataDomain;
 import org.apache.cayenne.access.DataNode;
 import org.apache.cayenne.configuration.CayenneRuntime;
-import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.ListBuilder;
 import org.apache.cayenne.di.Module;
 import org.apache.cayenne.tx.TransactionListener;
@@ -72,13 +71,10 @@ public class ServerRuntime extends CayenneRuntime {
         modules.add(new ServerModule());
 
         if (configurationLocations.length > 0) {
-            modules.add(new Module() {
-                @Override
-                public void configure(Binder binder) {
-                    ListBuilder<String> locationsBinder = ServerModule.contributeProjectLocations(binder);
-                    for (String c : configurationLocations) {
-                        locationsBinder.add(c);
-                    }
+            modules.add(binder -> {
+                ListBuilder<String> locationsBinder = ServerModule.contributeProjectLocations(binder);
+                for (String c : configurationLocations) {
+                    locationsBinder.add(c);
                 }
             });
         }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3fc09431/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilder.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilder.java b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilder.java
index acf1245..c9ac8a3 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilder.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilder.java
@@ -21,14 +21,18 @@ package org.apache.cayenne.configuration.server;
 import org.apache.cayenne.access.DataDomain;
 import org.apache.cayenne.configuration.Constants;
 import org.apache.cayenne.datasource.DataSourceBuilder;
-import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.ListBuilder;
 import org.apache.cayenne.di.MapBuilder;
 import org.apache.cayenne.di.Module;
 import org.apache.cayenne.di.spi.ModuleLoader;
 
 import javax.sql.DataSource;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashSet;
+import java.util.List;
 
 /**
  * A convenience class to assemble custom ServerRuntime. It allows to easily
@@ -247,13 +251,10 @@ public class ServerRuntimeBuilder {
         Collection<Module> modules = new ArrayList<>();
 
         if (!configs.isEmpty()) {
-            modules.add(new Module() {
-                @Override
-                public void configure(Binder binder) {
-                    ListBuilder<String> locationsBinder = ServerModule.contributeProjectLocations(binder);
-                    for (String c : configs) {
-                        locationsBinder.add(c);
-                    }
+            modules.add(binder -> {
+                ListBuilder<String> locationsBinder = ServerModule.contributeProjectLocations(binder);
+                for (String c : configs) {
+                    locationsBinder.add(c);
                 }
             });
         }
@@ -269,57 +270,46 @@ public class ServerRuntimeBuilder {
         if (nameOverride != null) {
 
             final String finalNameOverride = nameOverride;
-            modules.add(new Module() {
-                @Override
-                public void configure(Binder binder) {
-                    ServerModule.contributeProperties(binder).put(Constants.SERVER_DOMAIN_NAME_PROPERTY, finalNameOverride);
-                }
-            });
+            modules.add(binder -> ServerModule.contributeProperties(binder).put(Constants.SERVER_DOMAIN_NAME_PROPERTY, finalNameOverride));
         }
 
         if (dataSourceFactory != null) {
 
-            modules.add(new Module() {
-                @Override
-                public void configure(Binder binder) {
-                    binder.bind(DataDomain.class).toProvider(SyntheticNodeDataDomainProvider.class);
-                    binder.bind(DataSourceFactory.class).toInstance(dataSourceFactory);
-                }
+            modules.add(binder -> {
+                binder.bind(DataDomain.class).toProvider(SyntheticNodeDataDomainProvider.class);
+                binder.bind(DataSourceFactory.class).toInstance(dataSourceFactory);
             });
 
         }
         // URL and driver are the minimal requirement for DelegatingDataSourceFactory to work
         else if (jdbcUrl != null && jdbcDriver != null) {
-            modules.add(new Module() {
-                @Override
-                public void configure(Binder binder) {
-                    binder.bind(DataDomain.class).toProvider(SyntheticNodeDataDomainProvider.class);
-                    MapBuilder<String> props = ServerModule.contributeProperties(binder)
-                            .put(Constants.JDBC_DRIVER_PROPERTY, jdbcDriver).put(Constants.JDBC_URL_PROPERTY, jdbcUrl);
-
-                    if (jdbcUser != null) {
-                        props.put(Constants.JDBC_USERNAME_PROPERTY, jdbcUser);
-                    }
-
-                    if (jdbcPassword != null) {
-                        props.put(Constants.JDBC_PASSWORD_PROPERTY, jdbcPassword);
-                    }
-
-                    if (jdbcMinConnections > 0) {
-                        props.put(Constants.JDBC_MIN_CONNECTIONS_PROPERTY, Integer.toString(jdbcMinConnections));
-                    }
-
-                    if (jdbcMaxConnections > 0) {
-                        props.put(Constants.JDBC_MAX_CONNECTIONS_PROPERTY, Integer.toString(jdbcMaxConnections));
-                    }
-
-                    if (maxQueueWaitTime > 0) {
-                        props.put(Constants.JDBC_MAX_QUEUE_WAIT_TIME, Long.toString(maxQueueWaitTime));
-                    }
-
-                    if (validationQuery != null) {
-                        props.put(Constants.JDBC_VALIDATION_QUERY_PROPERTY, validationQuery);
-                    }
+            modules.add(binder -> {
+                binder.bind(DataDomain.class).toProvider(SyntheticNodeDataDomainProvider.class);
+                MapBuilder<String> props = ServerModule.contributeProperties(binder)
+                        .put(Constants.JDBC_DRIVER_PROPERTY, jdbcDriver).put(Constants.JDBC_URL_PROPERTY, jdbcUrl);
+
+                if (jdbcUser != null) {
+                    props.put(Constants.JDBC_USERNAME_PROPERTY, jdbcUser);
+                }
+
+                if (jdbcPassword != null) {
+                    props.put(Constants.JDBC_PASSWORD_PROPERTY, jdbcPassword);
+                }
+
+                if (jdbcMinConnections > 0) {
+                    props.put(Constants.JDBC_MIN_CONNECTIONS_PROPERTY, Integer.toString(jdbcMinConnections));
+                }
+
+                if (jdbcMaxConnections > 0) {
+                    props.put(Constants.JDBC_MAX_CONNECTIONS_PROPERTY, Integer.toString(jdbcMaxConnections));
+                }
+
+                if (maxQueueWaitTime > 0) {
+                    props.put(Constants.JDBC_MAX_QUEUE_WAIT_TIME, Long.toString(maxQueueWaitTime));
+                }
+
+                if (validationQuery != null) {
+                    props.put(Constants.JDBC_VALIDATION_QUERY_PROPERTY, validationQuery);
                 }
             });
         }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3fc09431/cayenne-server/src/test/java/org/apache/cayenne/BaseContextTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/BaseContextTest.java b/cayenne-server/src/test/java/org/apache/cayenne/BaseContextTest.java
index f8582df..21efa9f 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/BaseContextTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/BaseContextTest.java
@@ -20,7 +20,6 @@ package org.apache.cayenne;
 
 import org.apache.cayenne.cache.QueryCache;
 import org.apache.cayenne.configuration.CayenneRuntime;
-import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
 import org.apache.cayenne.di.Module;
@@ -28,12 +27,7 @@ import org.junit.Test;
 
 import java.util.Map;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
 import static org.mockito.Mockito.mock;
 
 public class BaseContextTest {
@@ -54,12 +48,9 @@ public class BaseContextTest {
         final DataChannel channel = mock(DataChannel.class);
         final QueryCache cache = mock(QueryCache.class);
 
-        Module testModule = new Module() {
-
-            public void configure(Binder binder) {
-                binder.bind(DataChannel.class).toInstance(channel);
-                binder.bind(QueryCache.class).toInstance(cache);
-            }
+        Module testModule = binder -> {
+            binder.bind(DataChannel.class).toInstance(channel);
+            binder.bind(QueryCache.class).toInstance(cache);
         };
 
         Injector injector = DIBootstrap.createInjector(testModule);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3fc09431/cayenne-server/src/test/java/org/apache/cayenne/access/DefaultDataRowStoreFactoryIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/access/DefaultDataRowStoreFactoryIT.java b/cayenne-server/src/test/java/org/apache/cayenne/access/DefaultDataRowStoreFactoryIT.java
index c46c04f..0134770 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/access/DefaultDataRowStoreFactoryIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/access/DefaultDataRowStoreFactoryIT.java
@@ -23,18 +23,17 @@ import org.apache.cayenne.configuration.DefaultRuntimeProperties;
 import org.apache.cayenne.configuration.RuntimeProperties;
 import org.apache.cayenne.configuration.server.ServerModule;
 import org.apache.cayenne.configuration.server.ServerRuntime;
-import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
 import org.apache.cayenne.di.Module;
 import org.apache.cayenne.event.DefaultEventManager;
 import org.apache.cayenne.event.EventBridge;
-import org.apache.cayenne.event.NoopEventBridgeProvider;
 import org.apache.cayenne.event.EventManager;
 import org.apache.cayenne.event.MockEventBridge;
 import org.apache.cayenne.event.MockEventBridgeProvider;
-import org.apache.cayenne.log.Slf4jJdbcEventLogger;
+import org.apache.cayenne.event.NoopEventBridgeProvider;
 import org.apache.cayenne.log.JdbcEventLogger;
+import org.apache.cayenne.log.Slf4jJdbcEventLogger;
 import org.apache.cayenne.tx.DefaultTransactionFactory;
 import org.apache.cayenne.tx.DefaultTransactionManager;
 import org.apache.cayenne.tx.TransactionFactory;
@@ -65,18 +64,16 @@ public class DefaultDataRowStoreFactoryIT extends ServerCase {
         final EventManager EVENT_MANAGER = new DefaultEventManager();
         final int CACHE_SIZE = 500;
 
-        Module testModule = new Module() {
-            public void configure(Binder binder) {
-                binder.bind(DataDomain.class).toInstance(DOMAIN);
-                binder.bind(EventManager.class).toInstance(EVENT_MANAGER);
-                binder.bind(TransactionManager.class).to(DefaultTransactionManager.class);
-                binder.bind(TransactionFactory.class).to(DefaultTransactionFactory.class);
-                binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
-                binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class);
-                binder.bind(EventBridge.class).toProvider(NoopEventBridgeProvider.class);
-                binder.bind(DataRowStoreFactory.class).to(DefaultDataRowStoreFactory.class);
-                ServerModule.setSnapshotCacheSize(binder, CACHE_SIZE);
-            }
+        Module testModule = binder -> {
+            binder.bind(DataDomain.class).toInstance(DOMAIN);
+            binder.bind(EventManager.class).toInstance(EVENT_MANAGER);
+            binder.bind(TransactionManager.class).to(DefaultTransactionManager.class);
+            binder.bind(TransactionFactory.class).to(DefaultTransactionFactory.class);
+            binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
+            binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class);
+            binder.bind(EventBridge.class).toProvider(NoopEventBridgeProvider.class);
+            binder.bind(DataRowStoreFactory.class).to(DefaultDataRowStoreFactory.class);
+            ServerModule.setSnapshotCacheSize(binder, CACHE_SIZE);
         };
 
         Injector injector = DIBootstrap.createInjector(testModule);
@@ -92,18 +89,16 @@ public class DefaultDataRowStoreFactoryIT extends ServerCase {
         final DataDomain DOMAIN = new DataDomain("test");
         final EventManager EVENT_MANAGER = new DefaultEventManager();
 
-        Module testModule = new Module() {
-            public void configure(Binder binder) {
-                binder.bind(DataDomain.class).toInstance(DOMAIN);
-                binder.bind(EventManager.class).toInstance(EVENT_MANAGER);
-                binder.bind(TransactionManager.class).to(DefaultTransactionManager.class);
-                binder.bind(TransactionFactory.class).to(DefaultTransactionFactory.class);
-                binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
-                binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class);
-                binder.bind(EventBridge.class).toProvider(MockEventBridgeProvider.class);
-                binder.bind(DataRowStoreFactory.class).to(DefaultDataRowStoreFactory.class);
-                ServerModule.contributeProperties(binder);
-            }
+        Module testModule = binder -> {
+            binder.bind(DataDomain.class).toInstance(DOMAIN);
+            binder.bind(EventManager.class).toInstance(EVENT_MANAGER);
+            binder.bind(TransactionManager.class).to(DefaultTransactionManager.class);
+            binder.bind(TransactionFactory.class).to(DefaultTransactionFactory.class);
+            binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
+            binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class);
+            binder.bind(EventBridge.class).toProvider(MockEventBridgeProvider.class);
+            binder.bind(DataRowStoreFactory.class).to(DefaultDataRowStoreFactory.class);
+            ServerModule.contributeProperties(binder);
         };
 
         Injector injector = DIBootstrap.createInjector(testModule);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3fc09431/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DataContextFactoryTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DataContextFactoryTest.java b/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DataContextFactoryTest.java
index cde7125..d92ca62 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DataContextFactoryTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DataContextFactoryTest.java
@@ -30,16 +30,15 @@ import org.apache.cayenne.configuration.DefaultObjectStoreFactory;
 import org.apache.cayenne.configuration.DefaultRuntimeProperties;
 import org.apache.cayenne.configuration.ObjectStoreFactory;
 import org.apache.cayenne.configuration.RuntimeProperties;
-import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
 import org.apache.cayenne.di.Module;
-import org.apache.cayenne.event.NoopEventBridgeProvider;
 import org.apache.cayenne.event.EventBridge;
 import org.apache.cayenne.event.EventManager;
 import org.apache.cayenne.event.MockEventManager;
-import org.apache.cayenne.log.Slf4jJdbcEventLogger;
+import org.apache.cayenne.event.NoopEventBridgeProvider;
 import org.apache.cayenne.log.JdbcEventLogger;
+import org.apache.cayenne.log.Slf4jJdbcEventLogger;
 import org.apache.cayenne.tx.DefaultTransactionFactory;
 import org.apache.cayenne.tx.DefaultTransactionManager;
 import org.apache.cayenne.tx.TransactionFactory;
@@ -48,11 +47,7 @@ import org.junit.Test;
 
 import java.util.Collections;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 
 public class DataContextFactoryTest {
 
@@ -64,24 +59,21 @@ public class DataContextFactoryTest {
 
         domain.setSharedCacheEnabled(false);
 
-        Module testModule = new Module() {
-
-            public void configure(Binder binder) {
-                binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
-                binder.bind(DataDomain.class).toInstance(domain);
-                binder.bind(EventManager.class).toInstance(eventManager);
-                binder.bind(QueryCache.class).toInstance(new MapQueryCache(5));
-                binder.bind(RuntimeProperties.class).toInstance(
-                        new DefaultRuntimeProperties(Collections.<String, String>emptyMap()));
-                binder.bind(ObjectMapRetainStrategy.class).to(
-                        DefaultObjectMapRetainStrategy.class);
-                binder.bind(ObjectStoreFactory.class).to(DefaultObjectStoreFactory.class);
-                binder.bind(TransactionFactory.class).to(DefaultTransactionFactory.class);
-                binder.bind(TransactionManager.class).to(DefaultTransactionManager.class);
-                binder.bind(DataRowStoreFactory.class).to(DefaultDataRowStoreFactory.class);
-                binder.bind(EventBridge.class).toProvider(NoopEventBridgeProvider.class);
-                binder.bind(DataRowStoreFactory.class).to(DefaultDataRowStoreFactory.class);
-            }
+        Module testModule = binder -> {
+            binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
+            binder.bind(DataDomain.class).toInstance(domain);
+            binder.bind(EventManager.class).toInstance(eventManager);
+            binder.bind(QueryCache.class).toInstance(new MapQueryCache(5));
+            binder.bind(RuntimeProperties.class).toInstance(
+                    new DefaultRuntimeProperties(Collections.<String, String>emptyMap()));
+            binder.bind(ObjectMapRetainStrategy.class).to(
+                    DefaultObjectMapRetainStrategy.class);
+            binder.bind(ObjectStoreFactory.class).to(DefaultObjectStoreFactory.class);
+            binder.bind(TransactionFactory.class).to(DefaultTransactionFactory.class);
+            binder.bind(TransactionManager.class).to(DefaultTransactionManager.class);
+            binder.bind(DataRowStoreFactory.class).to(DefaultDataRowStoreFactory.class);
+            binder.bind(EventBridge.class).toProvider(NoopEventBridgeProvider.class);
+            binder.bind(DataRowStoreFactory.class).to(DefaultDataRowStoreFactory.class);
         };
 
         Injector injector = DIBootstrap.createInjector(testModule);
@@ -104,23 +96,20 @@ public class DataContextFactoryTest {
 
         domain.setValidatingObjectsOnCommit(true);
 
-        Module testModule = new Module() {
-
-            public void configure(Binder binder) {
-                binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
-                binder.bind(DataDomain.class).toInstance(domain);
-                binder.bind(EventManager.class).toInstance(eventManager);
-                binder.bind(QueryCache.class).toInstance(new MapQueryCache(5));
-                binder.bind(RuntimeProperties.class).toInstance(
-                        new DefaultRuntimeProperties(Collections.<String, String>emptyMap()));
-                binder.bind(ObjectMapRetainStrategy.class).to(
-                        DefaultObjectMapRetainStrategy.class);
-                binder.bind(ObjectStoreFactory.class).to(DefaultObjectStoreFactory.class);
-                binder.bind(TransactionFactory.class).to(DefaultTransactionFactory.class);
-                binder.bind(TransactionManager.class).to(DefaultTransactionManager.class);
-                binder.bind(EventBridge.class).toProvider(NoopEventBridgeProvider.class);
-                binder.bind(DataRowStoreFactory.class).to(DefaultDataRowStoreFactory.class);
-            }
+        Module testModule = binder -> {
+            binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
+            binder.bind(DataDomain.class).toInstance(domain);
+            binder.bind(EventManager.class).toInstance(eventManager);
+            binder.bind(QueryCache.class).toInstance(new MapQueryCache(5));
+            binder.bind(RuntimeProperties.class).toInstance(
+                    new DefaultRuntimeProperties(Collections.<String, String>emptyMap()));
+            binder.bind(ObjectMapRetainStrategy.class).to(
+                    DefaultObjectMapRetainStrategy.class);
+            binder.bind(ObjectStoreFactory.class).to(DefaultObjectStoreFactory.class);
+            binder.bind(TransactionFactory.class).to(DefaultTransactionFactory.class);
+            binder.bind(TransactionManager.class).to(DefaultTransactionManager.class);
+            binder.bind(EventBridge.class).toProvider(NoopEventBridgeProvider.class);
+            binder.bind(DataRowStoreFactory.class).to(DefaultDataRowStoreFactory.class);
         };
 
         Injector injector = DIBootstrap.createInjector(testModule);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3fc09431/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DataDomainProviderTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DataDomainProviderTest.java b/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DataDomainProviderTest.java
index d13724c..f9a54cb 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DataDomainProviderTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DataDomainProviderTest.java
@@ -69,7 +69,6 @@ import org.apache.cayenne.dba.sqlite.SQLiteSniffer;
 import org.apache.cayenne.dba.sqlserver.SQLServerSniffer;
 import org.apache.cayenne.dba.sybase.SybaseSniffer;
 import org.apache.cayenne.di.AdhocObjectFactory;
-import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.ClassLoaderManager;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
@@ -78,11 +77,11 @@ import org.apache.cayenne.di.Module;
 import org.apache.cayenne.di.spi.DefaultAdhocObjectFactory;
 import org.apache.cayenne.di.spi.DefaultClassLoaderManager;
 import org.apache.cayenne.event.EventBridge;
-import org.apache.cayenne.event.NoopEventBridgeProvider;
 import org.apache.cayenne.event.EventManager;
 import org.apache.cayenne.event.MockEventManager;
-import org.apache.cayenne.log.Slf4jJdbcEventLogger;
+import org.apache.cayenne.event.NoopEventBridgeProvider;
 import org.apache.cayenne.log.JdbcEventLogger;
+import org.apache.cayenne.log.Slf4jJdbcEventLogger;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.EntitySorter;
 import org.apache.cayenne.map.LifecycleEvent;
@@ -97,181 +96,178 @@ import java.util.Collections;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import static org.junit.Assert.*;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
 
 public class DataDomainProviderTest {
 
-	@Test
-	public void testGet() {
-
-		// create dependencies
-		final String testConfigName = "testConfig";
-		final DataChannelDescriptor testDescriptor = new DataChannelDescriptor();
-
-		DataMap map1 = new DataMap("map1");
-		testDescriptor.getDataMaps().add(map1);
-
-		DataMap map2 = new DataMap("map2");
-		testDescriptor.getDataMaps().add(map2);
-
-		DataNodeDescriptor nodeDescriptor1 = new DataNodeDescriptor();
-		nodeDescriptor1.setName("node1");
-		nodeDescriptor1.getDataMapNames().add("map1");
-		nodeDescriptor1.setAdapterType(OracleAdapter.class.getName());
-		nodeDescriptor1.setDataSourceFactoryType(MockDataSourceFactory.class.getName());
-		nodeDescriptor1.setParameters("jdbc/testDataNode1");
-		nodeDescriptor1.setSchemaUpdateStrategyType(ThrowOnPartialOrCreateSchemaStrategy.class.getName());
-		testDescriptor.getNodeDescriptors().add(nodeDescriptor1);
-
-		DataNodeDescriptor nodeDescriptor2 = new DataNodeDescriptor();
-		nodeDescriptor2.setName("node2");
-		nodeDescriptor2.getDataMapNames().add("map2");
-		nodeDescriptor2.setParameters("testDataNode2.driver.xml");
-		testDescriptor.getNodeDescriptors().add(nodeDescriptor2);
-
-		final DataChannelDescriptorLoader testLoader = new DataChannelDescriptorLoader() {
-
-			@Override
-			public ConfigurationTree<DataChannelDescriptor> load(Resource configurationResource)
-					throws ConfigurationException {
-				return new ConfigurationTree<>(testDescriptor, null);
-			}
-		};
-
-		final EventManager eventManager = new MockEventManager();
-		final TestListener mockListener = new TestListener();
-
-		Module testModule = new Module() {
-
-			@Override
-			public void configure(Binder binder) {
-				final ClassLoaderManager classLoaderManager = new DefaultClassLoaderManager();
-				binder.bind(ClassLoaderManager.class).toInstance(classLoaderManager);
-				binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
-
-				ServerModule.contributeProperties(binder);
-
-				ServerModule.contributeAdapterDetectors(binder).add(FirebirdSniffer.class)
-						.add(OpenBaseSniffer.class).add(FrontBaseSniffer.class).add(IngresSniffer.class)
-						.add(SQLiteSniffer.class).add(DB2Sniffer.class).add(H2Sniffer.class).add(HSQLDBSniffer.class)
-						.add(SybaseSniffer.class).add(DerbySniffer.class).add(SQLServerSniffer.class)
-						.add(OracleSniffer.class).add(PostgresSniffer.class).add(MySQLSniffer.class);
-				ServerModule.contributeDomainFilters(binder);
-				ServerModule.contributeDomainListeners(binder).add(mockListener);
-				ServerModule.contributeProjectLocations(binder).add(testConfigName);
-
-				// configure extended types
-				ServerModule.contributeDefaultTypes(binder);
-				ServerModule.contributeUserTypes(binder);
-				ServerModule.contributeTypeFactories(binder);
-
-				binder.bind(EventManager.class).toInstance(eventManager);
-				binder.bind(EntitySorter.class).toInstance(new AshwoodEntitySorter());
-				binder.bind(SchemaUpdateStrategyFactory.class).to(DefaultSchemaUpdateStrategyFactory.class);
-
-				final ResourceLocator locator = new ClassLoaderResourceLocator(classLoaderManager) {
-
-					public Collection<Resource> findResources(String name) {
-						// ResourceLocator also used by JdbcAdapter to locate types.xml...
-						// if this is the request we are getting, just let it go through..
-						if (name.endsWith("types.xml")) {
-							return super.findResources(name);
-						}
-
-						assertEquals(testConfigName, name);
-						return Collections.<Resource> singleton(new MockResource());
-					}
-				};
-
-				binder.bind(ResourceLocator.class).toInstance(locator);
-				binder.bind(Key.get(ResourceLocator.class, Constants.SERVER_RESOURCE_LOCATOR)).toInstance(locator);
-				binder.bind(ConfigurationNameMapper.class).to(DefaultConfigurationNameMapper.class);
-				binder.bind(DataChannelDescriptorMerger.class).to(DefaultDataChannelDescriptorMerger.class);
-				binder.bind(DataChannelDescriptorLoader.class).toInstance(testLoader);
-				binder.bind(DbAdapterFactory.class).to(DefaultDbAdapterFactory.class);
-				binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class);
-				binder.bind(BatchTranslatorFactory.class).to(DefaultBatchTranslatorFactory.class);
-				binder.bind(SelectTranslatorFactory.class).to(DefaultSelectTranslatorFactory.class);
-
-				binder.bind(DataSourceFactory.class).toInstance(new MockDataSourceFactory());
-				binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
-				binder.bind(QueryCache.class).toInstance(mock(QueryCache.class));
-				binder.bind(RowReaderFactory.class).toInstance(mock(RowReaderFactory.class));
-				binder.bind(DataNodeFactory.class).to(DefaultDataNodeFactory.class);
-				binder.bind(SQLTemplateProcessor.class).toInstance(mock(SQLTemplateProcessor.class));
-
-                binder.bind(EventBridge.class).toProvider(NoopEventBridgeProvider.class);
-                binder.bind(DataRowStoreFactory.class).to(DefaultDataRowStoreFactory.class);
-
-				ServerModule.contributeValueObjectTypes(binder);
-				binder.bind(ValueObjectTypeRegistry.class).to(DefaultValueObjectTypeRegistry.class);
-			}
-		};
-
-		Injector injector = DIBootstrap.createInjector(testModule);
-
-		// create and initialize provide instance to test
-		DataDomainProvider provider = new DataDomainProvider();
-		injector.injectMembers(provider);
-
-		DataChannel channel = provider.get();
-		assertNotNull(channel);
-
-		assertTrue(channel instanceof DataDomain);
-
-		DataDomain domain = (DataDomain) channel;
-		assertSame(eventManager, domain.getEventManager());
-		assertEquals(2, domain.getDataMaps().size());
-		assertTrue(domain.getDataMaps().contains(map1));
-		assertTrue(domain.getDataMaps().contains(map2));
-
-		assertEquals(2, domain.getDataNodes().size());
-		DataNode node1 = domain.getDataNode("node1");
-		assertNotNull(node1);
-		assertEquals(1, node1.getDataMaps().size());
-		assertSame(map1, node1.getDataMaps().iterator().next());
-		assertSame(node1, domain.lookupDataNode(map1));
-		assertEquals(nodeDescriptor1.getDataSourceFactoryType(), node1.getDataSourceFactory());
-		assertNotNull(node1.getDataSource());
-		assertEquals(nodeDescriptor1.getParameters(), node1.getDataSourceLocation());
-
-		assertNotNull(node1.getSchemaUpdateStrategy());
-		assertEquals(nodeDescriptor1.getSchemaUpdateStrategyType(), node1.getSchemaUpdateStrategy().getClass()
-				.getName());
-
-		assertNotNull(node1.getAdapter());
-		assertEquals(OracleAdapter.class, node1.getAdapter().getClass());
-
-		DataNode node2 = domain.getDataNode("node2");
-		assertNotNull(node2);
-		assertEquals(1, node2.getDataMaps().size());
-		assertSame(map2, node2.getDataMaps().iterator().next());
-		assertSame(node2, domain.lookupDataNode(map2));
-		assertNull(node2.getDataSourceFactory());
-		assertNotNull(node2.getDataSource());
-		assertEquals(nodeDescriptor2.getParameters(), node2.getDataSourceLocation());
-		assertNotNull(node2.getSchemaUpdateStrategy());
-		assertEquals(SkipSchemaUpdateStrategy.class.getName(), node2.getSchemaUpdateStrategy().getClass().getName());
-
-		assertNotNull(node2.getAdapter());
-
-		// check that we have mock listener passed correctly
-		Persistent mockPersistent = mock(Persistent.class);
-		ObjectId mockObjectId = mock(ObjectId.class);
-		when(mockObjectId.getEntityName()).thenReturn("mock-entity-name");
-		when(mockPersistent.getObjectId()).thenReturn(mockObjectId);
-		domain.getEntityResolver().getCallbackRegistry().performCallbacks(LifecycleEvent.POST_LOAD, mockPersistent);
-
-		assertEquals("Should call postLoadCallback() method", 1, TestListener.counter.get());
-	}
-
-	static class TestListener {
-
-		static private AtomicInteger counter = new AtomicInteger();
-
-		@PostLoad
-		public void postLoadCallback(Object object) {
-			counter.incrementAndGet();
-		}
-	}
+    @Test
+    public void testGet() {
+
+        // create dependencies
+        final String testConfigName = "testConfig";
+        final DataChannelDescriptor testDescriptor = new DataChannelDescriptor();
+
+        DataMap map1 = new DataMap("map1");
+        testDescriptor.getDataMaps().add(map1);
+
+        DataMap map2 = new DataMap("map2");
+        testDescriptor.getDataMaps().add(map2);
+
+        DataNodeDescriptor nodeDescriptor1 = new DataNodeDescriptor();
+        nodeDescriptor1.setName("node1");
+        nodeDescriptor1.getDataMapNames().add("map1");
+        nodeDescriptor1.setAdapterType(OracleAdapter.class.getName());
+        nodeDescriptor1.setDataSourceFactoryType(MockDataSourceFactory.class.getName());
+        nodeDescriptor1.setParameters("jdbc/testDataNode1");
+        nodeDescriptor1.setSchemaUpdateStrategyType(ThrowOnPartialOrCreateSchemaStrategy.class.getName());
+        testDescriptor.getNodeDescriptors().add(nodeDescriptor1);
+
+        DataNodeDescriptor nodeDescriptor2 = new DataNodeDescriptor();
+        nodeDescriptor2.setName("node2");
+        nodeDescriptor2.getDataMapNames().add("map2");
+        nodeDescriptor2.setParameters("testDataNode2.driver.xml");
+        testDescriptor.getNodeDescriptors().add(nodeDescriptor2);
+
+        final DataChannelDescriptorLoader testLoader = new DataChannelDescriptorLoader() {
+
+            @Override
+            public ConfigurationTree<DataChannelDescriptor> load(Resource configurationResource)
+                    throws ConfigurationException {
+                return new ConfigurationTree<>(testDescriptor, null);
+            }
+        };
+
+        final EventManager eventManager = new MockEventManager();
+        final TestListener mockListener = new TestListener();
+
+        Module testModule = binder -> {
+            final ClassLoaderManager classLoaderManager = new DefaultClassLoaderManager();
+            binder.bind(ClassLoaderManager.class).toInstance(classLoaderManager);
+            binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
+
+            ServerModule.contributeProperties(binder);
+
+            ServerModule.contributeAdapterDetectors(binder).add(FirebirdSniffer.class)
+                    .add(OpenBaseSniffer.class).add(FrontBaseSniffer.class).add(IngresSniffer.class)
+                    .add(SQLiteSniffer.class).add(DB2Sniffer.class).add(H2Sniffer.class).add(HSQLDBSniffer.class)
+                    .add(SybaseSniffer.class).add(DerbySniffer.class).add(SQLServerSniffer.class)
+                    .add(OracleSniffer.class).add(PostgresSniffer.class).add(MySQLSniffer.class);
+            ServerModule.contributeDomainFilters(binder);
+            ServerModule.contributeDomainListeners(binder).add(mockListener);
+            ServerModule.contributeProjectLocations(binder).add(testConfigName);
+
+            // configure extended types
+            ServerModule.contributeDefaultTypes(binder);
+            ServerModule.contributeUserTypes(binder);
+            ServerModule.contributeTypeFactories(binder);
+
+            binder.bind(EventManager.class).toInstance(eventManager);
+            binder.bind(EntitySorter.class).toInstance(new AshwoodEntitySorter());
+            binder.bind(SchemaUpdateStrategyFactory.class).to(DefaultSchemaUpdateStrategyFactory.class);
+
+            final ResourceLocator locator = new ClassLoaderResourceLocator(classLoaderManager) {
+
+                public Collection<Resource> findResources(String name) {
+                    // ResourceLocator also used by JdbcAdapter to locate types.xml...
+                    // if this is the request we are getting, just let it go through..
+                    if (name.endsWith("types.xml")) {
+                        return super.findResources(name);
+                    }
+
+                    assertEquals(testConfigName, name);
+                    return Collections.<Resource>singleton(new MockResource());
+                }
+            };
+
+            binder.bind(ResourceLocator.class).toInstance(locator);
+            binder.bind(Key.get(ResourceLocator.class, Constants.SERVER_RESOURCE_LOCATOR)).toInstance(locator);
+            binder.bind(ConfigurationNameMapper.class).to(DefaultConfigurationNameMapper.class);
+            binder.bind(DataChannelDescriptorMerger.class).to(DefaultDataChannelDescriptorMerger.class);
+            binder.bind(DataChannelDescriptorLoader.class).toInstance(testLoader);
+            binder.bind(DbAdapterFactory.class).to(DefaultDbAdapterFactory.class);
+            binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class);
+            binder.bind(BatchTranslatorFactory.class).to(DefaultBatchTranslatorFactory.class);
+            binder.bind(SelectTranslatorFactory.class).to(DefaultSelectTranslatorFactory.class);
+
+            binder.bind(DataSourceFactory.class).toInstance(new MockDataSourceFactory());
+            binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
+            binder.bind(QueryCache.class).toInstance(mock(QueryCache.class));
+            binder.bind(RowReaderFactory.class).toInstance(mock(RowReaderFactory.class));
+            binder.bind(DataNodeFactory.class).to(DefaultDataNodeFactory.class);
+            binder.bind(SQLTemplateProcessor.class).toInstance(mock(SQLTemplateProcessor.class));
+
+            binder.bind(EventBridge.class).toProvider(NoopEventBridgeProvider.class);
+            binder.bind(DataRowStoreFactory.class).to(DefaultDataRowStoreFactory.class);
+
+            ServerModule.contributeValueObjectTypes(binder);
+            binder.bind(ValueObjectTypeRegistry.class).to(DefaultValueObjectTypeRegistry.class);
+        };
+
+        Injector injector = DIBootstrap.createInjector(testModule);
+
+        // create and initialize provide instance to test
+        DataDomainProvider provider = new DataDomainProvider();
+        injector.injectMembers(provider);
+
+        DataChannel channel = provider.get();
+        assertNotNull(channel);
+
+        assertTrue(channel instanceof DataDomain);
+
+        DataDomain domain = (DataDomain) channel;
+        assertSame(eventManager, domain.getEventManager());
+        assertEquals(2, domain.getDataMaps().size());
+        assertTrue(domain.getDataMaps().contains(map1));
+        assertTrue(domain.getDataMaps().contains(map2));
+
+        assertEquals(2, domain.getDataNodes().size());
+        DataNode node1 = domain.getDataNode("node1");
+        assertNotNull(node1);
+        assertEquals(1, node1.getDataMaps().size());
+        assertSame(map1, node1.getDataMaps().iterator().next());
+        assertSame(node1, domain.lookupDataNode(map1));
+        assertEquals(nodeDescriptor1.getDataSourceFactoryType(), node1.getDataSourceFactory());
+        assertNotNull(node1.getDataSource());
+        assertEquals(nodeDescriptor1.getParameters(), node1.getDataSourceLocation());
+
+        assertNotNull(node1.getSchemaUpdateStrategy());
+        assertEquals(nodeDescriptor1.getSchemaUpdateStrategyType(), node1.getSchemaUpdateStrategy().getClass()
+                .getName());
+
+        assertNotNull(node1.getAdapter());
+        assertEquals(OracleAdapter.class, node1.getAdapter().getClass());
+
+        DataNode node2 = domain.getDataNode("node2");
+        assertNotNull(node2);
+        assertEquals(1, node2.getDataMaps().size());
+        assertSame(map2, node2.getDataMaps().iterator().next());
+        assertSame(node2, domain.lookupDataNode(map2));
+        assertNull(node2.getDataSourceFactory());
+        assertNotNull(node2.getDataSource());
+        assertEquals(nodeDescriptor2.getParameters(), node2.getDataSourceLocation());
+        assertNotNull(node2.getSchemaUpdateStrategy());
+        assertEquals(SkipSchemaUpdateStrategy.class.getName(), node2.getSchemaUpdateStrategy().getClass().getName());
+
+        assertNotNull(node2.getAdapter());
+
+        // check that we have mock listener passed correctly
+        Persistent mockPersistent = mock(Persistent.class);
+        ObjectId mockObjectId = mock(ObjectId.class);
+        when(mockObjectId.getEntityName()).thenReturn("mock-entity-name");
+        when(mockPersistent.getObjectId()).thenReturn(mockObjectId);
+        domain.getEntityResolver().getCallbackRegistry().performCallbacks(LifecycleEvent.POST_LOAD, mockPersistent);
+
+        assertEquals("Should call postLoadCallback() method", 1, TestListener.counter.get());
+    }
+
+    static class TestListener {
+
+        static private AtomicInteger counter = new AtomicInteger();
+
+        @PostLoad
+        public void postLoadCallback(Object object) {
+            counter.incrementAndGet();
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3fc09431/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DefaultDataSourceFactoryLoaderTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DefaultDataSourceFactoryLoaderTest.java b/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DefaultDataSourceFactoryLoaderTest.java
index b592753..b502b82 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DefaultDataSourceFactoryLoaderTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DefaultDataSourceFactoryLoaderTest.java
@@ -25,7 +25,6 @@ import org.apache.cayenne.configuration.RuntimeProperties;
 import org.apache.cayenne.configuration.mock.MockDataSourceFactory1;
 import org.apache.cayenne.conn.DataSourceInfo;
 import org.apache.cayenne.di.AdhocObjectFactory;
-import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.ClassLoaderManager;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
@@ -33,17 +32,14 @@ import org.apache.cayenne.di.Key;
 import org.apache.cayenne.di.Module;
 import org.apache.cayenne.di.spi.DefaultAdhocObjectFactory;
 import org.apache.cayenne.di.spi.DefaultClassLoaderManager;
-import org.apache.cayenne.log.Slf4jJdbcEventLogger;
 import org.apache.cayenne.log.JdbcEventLogger;
+import org.apache.cayenne.log.Slf4jJdbcEventLogger;
 import org.apache.cayenne.resource.ResourceLocator;
 import org.apache.cayenne.resource.mock.MockResourceLocator;
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
@@ -52,18 +48,14 @@ public class DefaultDataSourceFactoryLoaderTest {
     private Injector injector;
 
     @Before
-    public void setUp() throws Exception {
-        Module testModule = new Module() {
-
-            @Override
-            public void configure(Binder binder) {
-                binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
-                binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
-                binder.bind(ResourceLocator.class).to(MockResourceLocator.class);
-                binder.bind(Key.get(ResourceLocator.class, Constants.SERVER_RESOURCE_LOCATOR)).to(MockResourceLocator.class);
-                binder.bind(RuntimeProperties.class).toInstance(mock(RuntimeProperties.class));
-                binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
-            }
+    public void setUp() {
+        Module testModule = binder -> {
+            binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
+            binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
+            binder.bind(ResourceLocator.class).to(MockResourceLocator.class);
+            binder.bind(Key.get(ResourceLocator.class, Constants.SERVER_RESOURCE_LOCATOR)).to(MockResourceLocator.class);
+            binder.bind(RuntimeProperties.class).toInstance(mock(RuntimeProperties.class));
+            binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
         };
 
         this.injector = DIBootstrap.createInjector(testModule);
@@ -115,16 +107,13 @@ public class DefaultDataSourceFactoryLoaderTest {
         nodeDescriptor.setDataSourceFactoryType(MockDataSourceFactory1.class.getName());
         nodeDescriptor.setDataChannelDescriptor(channelDescriptor);
 
-        Module testModule = new Module() {
-
-            public void configure(Binder binder) {
-                binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
-                binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
-                binder.bind(ResourceLocator.class).to(MockResourceLocator.class);
-                binder.bind(Key.get(ResourceLocator.class, Constants.SERVER_RESOURCE_LOCATOR)).to(MockResourceLocator.class);
-                binder.bind(RuntimeProperties.class).toInstance(properties);
-                binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
-            }
+        Module testModule = binder -> {
+            binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
+            binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
+            binder.bind(ResourceLocator.class).to(MockResourceLocator.class);
+            binder.bind(Key.get(ResourceLocator.class, Constants.SERVER_RESOURCE_LOCATOR)).to(MockResourceLocator.class);
+            binder.bind(RuntimeProperties.class).toInstance(properties);
+            binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
         };
 
         Injector injector = DIBootstrap.createInjector(testModule);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3fc09431/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactoryTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactoryTest.java b/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactoryTest.java
index 54151d6..1e80301 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactoryTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/DefaultDbAdapterFactoryTest.java
@@ -31,7 +31,6 @@ import org.apache.cayenne.dba.AutoAdapter;
 import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.dba.sybase.SybaseAdapter;
 import org.apache.cayenne.di.AdhocObjectFactory;
-import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.ClassLoaderManager;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
@@ -39,8 +38,8 @@ import org.apache.cayenne.di.Key;
 import org.apache.cayenne.di.Module;
 import org.apache.cayenne.di.spi.DefaultAdhocObjectFactory;
 import org.apache.cayenne.di.spi.DefaultClassLoaderManager;
-import org.apache.cayenne.log.Slf4jJdbcEventLogger;
 import org.apache.cayenne.log.JdbcEventLogger;
+import org.apache.cayenne.log.Slf4jJdbcEventLogger;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.resource.ClassLoaderResourceLocator;
 import org.apache.cayenne.resource.ResourceLocator;
@@ -51,9 +50,7 @@ import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.List;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
@@ -79,16 +76,13 @@ public class DefaultDbAdapterFactoryTest {
         MockDataSource dataSource = new MockDataSource();
         dataSource.setupConnection(connection);
 
-        Module testModule = new Module() {
+        Module testModule = binder -> {
+            ServerModule.contributeProperties(binder);
 
-            public void configure(Binder binder) {
-                ServerModule.contributeProperties(binder);
-
-                binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
-                binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
-                binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
-                binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class);
-            }
+            binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
+            binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
+            binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
+            binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class);
         };
 
         Injector injector = DIBootstrap.createInjector(testModule);
@@ -106,25 +100,22 @@ public class DefaultDbAdapterFactoryTest {
 
         List<DbAdapterDetector> detectors = new ArrayList<DbAdapterDetector>();
 
-        Module testModule = new Module() {
-
-            public void configure(Binder binder) {
-                ServerModule.contributeProperties(binder);
-                ServerModule.contributeDefaultTypes(binder);
-                ServerModule.contributeUserTypes(binder);
-                ServerModule.contributeTypeFactories(binder);
-
-                binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
-                binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
-                binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
-                binder.bind(ResourceLocator.class).to(ClassLoaderResourceLocator.class);
-                binder.bind(Key.get(ResourceLocator.class, Constants.SERVER_RESOURCE_LOCATOR)).to(ClassLoaderResourceLocator.class);
-                binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class);
-                binder.bind(BatchTranslatorFactory.class).toInstance(mock(BatchTranslatorFactory.class));
-
-                ServerModule.contributeValueObjectTypes(binder);
-                binder.bind(ValueObjectTypeRegistry.class).to(DefaultValueObjectTypeRegistry.class);
-            }
+        Module testModule = binder -> {
+            ServerModule.contributeProperties(binder);
+            ServerModule.contributeDefaultTypes(binder);
+            ServerModule.contributeUserTypes(binder);
+            ServerModule.contributeTypeFactories(binder);
+
+            binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
+            binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
+            binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
+            binder.bind(ResourceLocator.class).to(ClassLoaderResourceLocator.class);
+            binder.bind(Key.get(ResourceLocator.class, Constants.SERVER_RESOURCE_LOCATOR)).to(ClassLoaderResourceLocator.class);
+            binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class);
+            binder.bind(BatchTranslatorFactory.class).toInstance(mock(BatchTranslatorFactory.class));
+
+            ServerModule.contributeValueObjectTypes(binder);
+            binder.bind(ValueObjectTypeRegistry.class).to(DefaultValueObjectTypeRegistry.class);
         };
 
         Injector injector = DIBootstrap.createInjector(testModule);
@@ -146,25 +137,22 @@ public class DefaultDbAdapterFactoryTest {
 
         List<DbAdapterDetector> detectors = new ArrayList<DbAdapterDetector>();
 
-        Module testModule = new Module() {
-
-            public void configure(Binder binder) {
-                ServerModule.contributeProperties(binder);
-                ServerModule.contributeDefaultTypes(binder);
-                ServerModule.contributeUserTypes(binder);
-                ServerModule.contributeTypeFactories(binder);
-
-                binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
-                binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
-                binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
-                binder.bind(ResourceLocator.class).to(ClassLoaderResourceLocator.class);
-                binder.bind(Key.get(ResourceLocator.class, Constants.SERVER_RESOURCE_LOCATOR)).to(ClassLoaderResourceLocator.class);
-                binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class);
-                binder.bind(BatchTranslatorFactory.class).toInstance(mock(BatchTranslatorFactory.class));
-
-                ServerModule.contributeValueObjectTypes(binder);
-                binder.bind(ValueObjectTypeRegistry.class).to(DefaultValueObjectTypeRegistry.class);
-            }
+        Module testModule = binder -> {
+            ServerModule.contributeProperties(binder);
+            ServerModule.contributeDefaultTypes(binder);
+            ServerModule.contributeUserTypes(binder);
+            ServerModule.contributeTypeFactories(binder);
+
+            binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
+            binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
+            binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
+            binder.bind(ResourceLocator.class).to(ClassLoaderResourceLocator.class);
+            binder.bind(Key.get(ResourceLocator.class, Constants.SERVER_RESOURCE_LOCATOR)).to(ClassLoaderResourceLocator.class);
+            binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class);
+            binder.bind(BatchTranslatorFactory.class).toInstance(mock(BatchTranslatorFactory.class));
+
+            ServerModule.contributeValueObjectTypes(binder);
+            binder.bind(ValueObjectTypeRegistry.class).to(DefaultValueObjectTypeRegistry.class);
         };
 
         Injector injector = DIBootstrap.createInjector(testModule);
@@ -196,16 +184,13 @@ public class DefaultDbAdapterFactoryTest {
         MockDataSource dataSource = new MockDataSource();
         dataSource.setupConnection(connection);
 
-        Module testModule = new Module() {
-
-            public void configure(Binder binder) {
-                ServerModule.contributeProperties(binder);
+        Module testModule = binder -> {
+            ServerModule.contributeProperties(binder);
 
-                binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
-                binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
-                binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
-                binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class);
-            }
+            binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
+            binder.bind(JdbcEventLogger.class).to(Slf4jJdbcEventLogger.class);
+            binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
+            binder.bind(RuntimeProperties.class).to(DefaultRuntimeProperties.class);
         };
 
         Injector injector = DIBootstrap.createInjector(testModule);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3fc09431/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/ServerRuntimeTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/ServerRuntimeTest.java b/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/ServerRuntimeTest.java
index ff097be..e422a94 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/ServerRuntimeTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/ServerRuntimeTest.java
@@ -24,7 +24,6 @@ import org.apache.cayenne.QueryResponse;
 import org.apache.cayenne.access.DataContext;
 import org.apache.cayenne.configuration.Constants;
 import org.apache.cayenne.configuration.ObjectContextFactory;
-import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.Key;
 import org.apache.cayenne.di.Module;
 import org.apache.cayenne.event.EventManager;
@@ -54,12 +53,7 @@ public class ServerRuntimeTest {
         final TransactionFactory txFactory = mock(TransactionFactory.class);
         when(txFactory.createTransaction()).thenReturn(tx);
 
-        Module module = new Module() {
-
-            public void configure(Binder binder) {
-                binder.bind(TransactionFactory.class).toInstance(txFactory);
-            }
-        };
+        Module module = binder -> binder.bind(TransactionFactory.class).toInstance(txFactory);
 
         ServerRuntime runtime = ServerRuntime.builder().addConfig("xxxx").addModule(module).build();
         try {
@@ -117,19 +111,9 @@ public class ServerRuntimeTest {
 
         final boolean[] configured = new boolean[2];
 
-        Module m1 = new Module() {
-
-            public void configure(Binder binder) {
-                configured[0] = true;
-            }
-        };
+        Module m1 = binder -> configured[0] = true;
 
-        Module m2 = new Module() {
-
-            public void configure(Binder binder) {
-                configured[1] = true;
-            }
-        };
+        Module m2 = binder -> configured[1] = true;
 
         ServerRuntime runtime = new ServerRuntime(asList(m1, m2));
 
@@ -162,12 +146,7 @@ public class ServerRuntimeTest {
             }
         };
 
-        Module module = new Module() {
-
-            public void configure(Binder binder) {
-                binder.bind(DataChannel.class).toInstance(channel);
-            }
-        };
+        Module module = binder -> binder.bind(DataChannel.class).toInstance(channel);
 
         ServerRuntime runtime = new ServerRuntime("Yuis", module);
         assertSame(channel, runtime.getChannel());
@@ -188,12 +167,7 @@ public class ServerRuntimeTest {
             }
         };
 
-        Module module = new Module() {
-
-            public void configure(Binder binder) {
-                binder.bind(ObjectContextFactory.class).toInstance(factory);
-            }
-        };
+        Module module = binder -> binder.bind(ObjectContextFactory.class).toInstance(factory);
 
         ServerRuntime runtime = new ServerRuntime("mnYw", module);
         assertSame(context, runtime.newContext());

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3fc09431/cayenne-server/src/test/java/org/apache/cayenne/configuration/web/ServletContextHandlerTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/configuration/web/ServletContextHandlerTest.java b/cayenne-server/src/test/java/org/apache/cayenne/configuration/web/ServletContextHandlerTest.java
index c160ae8..2c3905a 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/configuration/web/ServletContextHandlerTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/configuration/web/ServletContextHandlerTest.java
@@ -26,16 +26,12 @@ import org.apache.cayenne.DataChannel;
 import org.apache.cayenne.MockDataChannel;
 import org.apache.cayenne.ObjectContext;
 import org.apache.cayenne.configuration.ObjectContextFactory;
-import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
 import org.apache.cayenne.di.Module;
 import org.junit.Test;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
 import static org.mockito.Mockito.mock;
 
 public class ServletContextHandlerTest {
@@ -43,23 +39,20 @@ public class ServletContextHandlerTest {
     @Test
     public void testRequestStart_bindContext() {
 
-        Module module = new Module() {
+        Module module = binder -> {
 
-            public void configure(Binder binder) {
+            binder.bind(DataChannel.class).to(MockDataChannel.class);
+            binder.bind(ObjectContextFactory.class).toInstance(
+                    new ObjectContextFactory() {
 
-                binder.bind(DataChannel.class).to(MockDataChannel.class);
-                binder.bind(ObjectContextFactory.class).toInstance(
-                        new ObjectContextFactory() {
+                        public ObjectContext createContext(DataChannel parent) {
+                            return mock(ObjectContext.class);
+                        }
 
-                            public ObjectContext createContext(DataChannel parent) {
-                                return mock(ObjectContext.class);
-                            }
-
-                            public ObjectContext createContext() {
-                                return mock(ObjectContext.class);
-                            }
-                        });
-            }
+                        public ObjectContext createContext() {
+                            return mock(ObjectContext.class);
+                        }
+                    });
         };
         Injector injector = DIBootstrap.createInjector(module);
         SessionContextRequestHandler handler = new SessionContextRequestHandler();

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3fc09431/cayenne-server/src/test/java/org/apache/cayenne/configuration/web/WebConfigurationTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/configuration/web/WebConfigurationTest.java b/cayenne-server/src/test/java/org/apache/cayenne/configuration/web/WebConfigurationTest.java
index 0183163..95c9fc3 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/configuration/web/WebConfigurationTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/configuration/web/WebConfigurationTest.java
@@ -20,7 +20,6 @@ package org.apache.cayenne.configuration.web;
 
 import com.mockrunner.mock.web.MockFilterConfig;
 import com.mockrunner.mock.web.MockServletConfig;
-import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.Module;
 import org.junit.Test;
 
@@ -28,10 +27,7 @@ import java.util.Collection;
 import java.util.Iterator;
 import java.util.Map;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 
 public class WebConfigurationTest {
 
@@ -41,16 +37,10 @@ public class WebConfigurationTest {
         MockFilterConfig config = new MockFilterConfig();
         WebConfiguration configuration = new WebConfiguration(config);
 
-        Module m1 = new Module() {
-
-            public void configure(Binder binder) {
-            }
+        Module m1 = binder -> {
         };
 
-        Module m2 = new Module() {
-
-            public void configure(Binder binder) {
-            }
+        Module m2 = binder -> {
         };
 
         Collection<Module> modules = configuration.createModules(m1, m2);
@@ -73,16 +63,10 @@ public class WebConfigurationTest {
 
         WebConfiguration configuration = new WebConfiguration(config);
 
-        Module m1 = new Module() {
-
-            public void configure(Binder binder) {
-            }
+        Module m1 = binder -> {
         };
 
-        Module m2 = new Module() {
-
-            public void configure(Binder binder) {
-            }
+        Module m2 = binder -> {
         };
 
         Collection<Module> modules = configuration.createModules(m1, m2);
@@ -107,16 +91,10 @@ public class WebConfigurationTest {
 
         WebConfiguration configuration = new WebConfiguration(config);
 
-        Module m1 = new Module() {
-
-            public void configure(Binder binder) {
-            }
+        Module m1 = binder -> {
         };
 
-        Module m2 = new Module() {
-
-            public void configure(Binder binder) {
-            }
+        Module m2 = binder -> {
         };
 
         Collection<Module> modules = configuration.createModules(m1, m2);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3fc09431/cayenne-server/src/test/java/org/apache/cayenne/configuration/xml/XMLDataChannelDescriptorLoaderTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/configuration/xml/XMLDataChannelDescriptorLoaderTest.java b/cayenne-server/src/test/java/org/apache/cayenne/configuration/xml/XMLDataChannelDescriptorLoaderTest.java
index 020c015..8800df5 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/configuration/xml/XMLDataChannelDescriptorLoaderTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/configuration/xml/XMLDataChannelDescriptorLoaderTest.java
@@ -26,7 +26,6 @@ import org.apache.cayenne.configuration.DataMapLoader;
 import org.apache.cayenne.configuration.DataNodeDescriptor;
 import org.apache.cayenne.configuration.DefaultConfigurationNameMapper;
 import org.apache.cayenne.di.AdhocObjectFactory;
-import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.ClassLoaderManager;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
@@ -50,18 +49,15 @@ public class XMLDataChannelDescriptorLoaderTest {
     private Injector injector;
 
     @Before
-    public void setUp() throws Exception {
-        Module testModule = new Module() {
-
-            public void configure(Binder binder) {
-                binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
-                binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
-                binder.bind(DataMapLoader.class).to(XMLDataMapLoader.class);
-                binder.bind(ConfigurationNameMapper.class).to(DefaultConfigurationNameMapper.class);
-                binder.bind(HandlerFactory.class).to(DefaultHandlerFactory.class);
-                binder.bind(DataChannelMetaData.class).to(NoopDataChannelMetaData.class);
-                binder.bind(XMLReader.class).toProviderInstance(new XMLReaderProvider(false)).withoutScope();
-            }
+    public void setUp() {
+        Module testModule = binder -> {
+            binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
+            binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
+            binder.bind(DataMapLoader.class).to(XMLDataMapLoader.class);
+            binder.bind(ConfigurationNameMapper.class).to(DefaultConfigurationNameMapper.class);
+            binder.bind(HandlerFactory.class).to(DefaultHandlerFactory.class);
+            binder.bind(DataChannelMetaData.class).to(NoopDataChannelMetaData.class);
+            binder.bind(XMLReader.class).toProviderInstance(new XMLReaderProvider(false)).withoutScope();
         };
 
         this.injector = DIBootstrap.createInjector(testModule);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3fc09431/cayenne-server/src/test/java/org/apache/cayenne/configuration/xml/XMLDataMapLoaderTest.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/configuration/xml/XMLDataMapLoaderTest.java b/cayenne-server/src/test/java/org/apache/cayenne/configuration/xml/XMLDataMapLoaderTest.java
index a0cffd5..d41b636 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/configuration/xml/XMLDataMapLoaderTest.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/configuration/xml/XMLDataMapLoaderTest.java
@@ -18,14 +18,11 @@
  ****************************************************************/
 package org.apache.cayenne.configuration.xml;
 
-import java.net.URL;
-
 import org.apache.cayenne.CayenneRuntimeException;
 import org.apache.cayenne.configuration.ConfigurationNameMapper;
 import org.apache.cayenne.configuration.DataMapLoader;
 import org.apache.cayenne.configuration.DefaultConfigurationNameMapper;
 import org.apache.cayenne.di.AdhocObjectFactory;
-import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.ClassLoaderManager;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
@@ -40,6 +37,8 @@ import org.junit.Before;
 import org.junit.Test;
 import org.xml.sax.XMLReader;
 
+import java.net.URL;
+
 import static org.junit.Assert.*;
 
 public class XMLDataMapLoaderTest {
@@ -50,17 +49,14 @@ public class XMLDataMapLoaderTest {
 
     @Before
     public void setUp() throws Exception {
-        Module testModule = new Module() {
-
-            public void configure(Binder binder) {
-                binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
-                binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
-                binder.bind(DataMapLoader.class).to(XMLDataMapLoader.class);
-                binder.bind(ConfigurationNameMapper.class).to(DefaultConfigurationNameMapper.class);
-                binder.bind(HandlerFactory.class).to(DefaultHandlerFactory.class);
-                binder.bind(DataChannelMetaData.class).to(NoopDataChannelMetaData.class);
-                binder.bind(XMLReader.class).toProviderInstance(new XMLReaderProvider(false)).withoutScope();
-            }
+        Module testModule = binder -> {
+            binder.bind(ClassLoaderManager.class).to(DefaultClassLoaderManager.class);
+            binder.bind(AdhocObjectFactory.class).to(DefaultAdhocObjectFactory.class);
+            binder.bind(DataMapLoader.class).to(XMLDataMapLoader.class);
+            binder.bind(ConfigurationNameMapper.class).to(DefaultConfigurationNameMapper.class);
+            binder.bind(HandlerFactory.class).to(DefaultHandlerFactory.class);
+            binder.bind(DataChannelMetaData.class).to(NoopDataChannelMetaData.class);
+            binder.bind(XMLReader.class).toProviderInstance(new XMLReaderProvider(false)).withoutScope();
         };
 
         injector = DIBootstrap.createInjector(testModule);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/3fc09431/cayenne-server/src/test/java/org/apache/cayenne/unit/di/DICaseSelfIT.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/DICaseSelfIT.java b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/DICaseSelfIT.java
index 2bcf064..50a74de 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/unit/di/DICaseSelfIT.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/unit/di/DICaseSelfIT.java
@@ -18,7 +18,6 @@
  ****************************************************************/
 package org.apache.cayenne.unit.di;
 
-import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.di.Injector;
@@ -27,30 +26,25 @@ import org.apache.cayenne.di.Module;
 import org.apache.cayenne.di.spi.DefaultScope;
 import org.junit.Test;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertSame;
+import static org.junit.Assert.*;
 
 public class DICaseSelfIT extends DICase {
 
     private static final Injector injector;
 
     static {
-        Module selfTestModule = new Module() {
-
-            public void configure(Binder binder) {
-                DefaultScope testScope = new DefaultScope();
-
-                binder.bind(UnitTestLifecycleManager.class).toInstance(
-                        new DefaultUnitTestLifecycleManager(testScope));
-
-                binder.bind(Key.get(Object.class, "test-scope")).to(Object.class).in(
-                        testScope);
-                binder
-                        .bind(Key.get(Object.class, "singleton-scope"))
-                        .to(Object.class)
-                        .inSingletonScope();
-            }
+        Module selfTestModule = binder -> {
+            DefaultScope testScope = new DefaultScope();
+
+            binder.bind(UnitTestLifecycleManager.class).toInstance(
+                    new DefaultUnitTestLifecycleManager(testScope));
+
+            binder.bind(Key.get(Object.class, "test-scope")).to(Object.class).in(
+                    testScope);
+            binder
+                    .bind(Key.get(Object.class, "singleton-scope"))
+                    .to(Object.class)
+                    .inSingletonScope();
         };
 
         injector = DIBootstrap.createInjector(selfTestModule);


Mime
View raw message