cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject [22/30] cayenne git commit: CAY-2377. Cleanup cayenne-client and ServerModule
Date Thu, 07 Dec 2017 10:09:51 GMT
CAY-2377. Cleanup cayenne-client and ServerModule


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/97a51886
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/97a51886
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/97a51886

Branch: refs/heads/master
Commit: 97a518866d7d32bc401c9bc274cd045810622c99
Parents: 2849f5c
Author: Arseni Bulatski <ancarseni@gmail.com>
Authored: Tue Nov 14 09:56:46 2017 +0300
Committer: Arseni Bulatski <ancarseni@gmail.com>
Committed: Wed Nov 15 10:27:48 2017 +0300

----------------------------------------------------------------------
 .../rop/client/ClientRuntimeBuilderTest.java    |  1 +
 .../configuration/server/ServerModule.java      | 28 --------------------
 .../apache/cayenne/unit/jira/CAY_743Test.java   |  9 ++++++-
 docs/doc/src/main/resources/UPGRADE.txt         |  1 +
 .../java/org/apache/cayenne/modeler/Main.java   |  9 ++++++-
 5 files changed, 18 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/97a51886/cayenne-client/src/test/java/org/apache/cayenne/configuration/rop/client/ClientRuntimeBuilderTest.java
----------------------------------------------------------------------
diff --git a/cayenne-client/src/test/java/org/apache/cayenne/configuration/rop/client/ClientRuntimeBuilderTest.java
b/cayenne-client/src/test/java/org/apache/cayenne/configuration/rop/client/ClientRuntimeBuilderTest.java
index 3213c40..d5298a1 100644
--- a/cayenne-client/src/test/java/org/apache/cayenne/configuration/rop/client/ClientRuntimeBuilderTest.java
+++ b/cayenne-client/src/test/java/org/apache/cayenne/configuration/rop/client/ClientRuntimeBuilderTest.java
@@ -28,6 +28,7 @@ import org.apache.cayenne.DataChannel;
 import org.apache.cayenne.configuration.Constants;
 import org.apache.cayenne.configuration.server.ServerModule;
 import org.apache.cayenne.di.*;
+import org.apache.cayenne.di.Module;
 import org.apache.cayenne.remote.ClientChannel;
 import org.apache.cayenne.remote.ClientConnection;
 import org.apache.cayenne.remote.MockClientConnection;

http://git-wip-us.apache.org/repos/asf/cayenne/blob/97a51886/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
index 9dd4001..8992f44 100644
--- a/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
+++ b/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
@@ -137,9 +137,6 @@ public class ServerModule implements Module {
 
     private static final int DEFAULT_MAX_ID_QUALIFIER_SIZE = 10000;
 
-    @Deprecated
-    protected String[] configurationLocations;
-
     /**
      * Sets transaction management to either external or internal transactions. Default is
internally-managed transactions.
      *
@@ -275,28 +272,6 @@ public class ServerModule implements Module {
      * @since 4.0
      */
     public ServerModule() {
-        this.configurationLocations = new String[0];
-    }
-
-    /**
-     * Creates a ServerModule with at least one configuration location. For multi-module
projects additional locations
-     * can be specified as well.
-     *
-     * @deprecated since 4.0 use {@link ServerRuntimeBuilder#addConfig(String)} and/or
-     * {@link ServerModule#contributeProjectLocations(Binder)} to specify locations.
-     */
-    @Deprecated
-    public ServerModule(String firstConfigLocation, String... configurationLocations) {
-        if (configurationLocations == null) {
-            configurationLocations = new String[0];
-        }
-
-        this.configurationLocations = new String[configurationLocations.length + 1];
-        this.configurationLocations[0] = firstConfigLocation;
-
-        if (configurationLocations.length > 0) {
-            System.arraycopy(configurationLocations, 0, this.configurationLocations, 1, configurationLocations.length);
-        }
     }
 
     public void configure(Binder binder) {
@@ -350,9 +325,6 @@ public class ServerModule implements Module {
 
         // configure explicit configurations
         ListBuilder<String> locationsListBuilder = contributeProjectLocations(binder);
-        for (String location : configurationLocations) {
-            locationsListBuilder.add(location);
-        }
 
         binder.bind(ConfigurationNameMapper.class).to(DefaultConfigurationNameMapper.class);
 

http://git-wip-us.apache.org/repos/asf/cayenne/blob/97a51886/cayenne-server/src/test/java/org/apache/cayenne/unit/jira/CAY_743Test.java
----------------------------------------------------------------------
diff --git a/cayenne-server/src/test/java/org/apache/cayenne/unit/jira/CAY_743Test.java b/cayenne-server/src/test/java/org/apache/cayenne/unit/jira/CAY_743Test.java
index ffea9c6..3b3d928 100644
--- a/cayenne-server/src/test/java/org/apache/cayenne/unit/jira/CAY_743Test.java
+++ b/cayenne-server/src/test/java/org/apache/cayenne/unit/jira/CAY_743Test.java
@@ -20,6 +20,7 @@ package org.apache.cayenne.unit.jira;
 
 import org.apache.cayenne.access.DataDomain;
 import org.apache.cayenne.configuration.server.ServerModule;
+import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
 import org.apache.cayenne.map.DataMap;
@@ -35,7 +36,13 @@ public class CAY_743Test {
     public void testLoad2MapsWithCrossMapInheritance() throws Exception {
 
         Injector injector = DIBootstrap.createInjector(new ServerModule(
-                "cay743/cayenne-domain.xml"));
+                ){
+            @Override
+            public void configure(Binder binder) {
+                super.configure(binder);
+                ServerModule.contributeProjectLocations(binder).add("cay743/cayenne-domain.xml");
+            }
+        });
 
         try {
             DataDomain domain = injector.getInstance(DataDomain.class);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/97a51886/docs/doc/src/main/resources/UPGRADE.txt
----------------------------------------------------------------------
diff --git a/docs/doc/src/main/resources/UPGRADE.txt b/docs/doc/src/main/resources/UPGRADE.txt
index 4c80f33..7a94e9e 100644
--- a/docs/doc/src/main/resources/UPGRADE.txt
+++ b/docs/doc/src/main/resources/UPGRADE.txt
@@ -273,6 +273,7 @@ UPGRADING TO 4.1.M2
       Collection<Module> collectModules(Map<String, String> properties, Module...
extraModules), Collection<Module> collectModules(Map<String, String> properties,
Collection<Module> extraModules)
       from org.apache.cayenne.configuration.rop.client.ClientRuntime;
       - removed ClientModule(Map<String, String> properties) in org.apache.cayenne.configuration.rop.client.ClientModule;
+      - removed ConfigurationLocations from org.apache.cayenne.configuration.ServerModule;
 
 
 UPGRADING TO 4.1.M1

http://git-wip-us.apache.org/repos/asf/cayenne/blob/97a51886/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/Main.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/Main.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/Main.java
index ff5f225..460d374 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/Main.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/Main.java
@@ -21,6 +21,7 @@ package org.apache.cayenne.modeler;
 
 import org.apache.cayenne.configuration.server.ServerModule;
 import org.apache.cayenne.dbsync.DbSyncModule;
+import org.apache.cayenne.di.Binder;
 import org.apache.cayenne.di.DIBootstrap;
 import org.apache.cayenne.di.Injector;
 import org.apache.cayenne.di.Module;
@@ -107,7 +108,13 @@ public class Main {
     protected Collection<Module> appendModules(Collection<Module> modules) {
         // TODO: this is dirty... "CayenneModeler" is not a project name, and ServerModule
is out of place inside
         // the Modeler... If we need ServerRuntime for certain operations, those should start
their own stack...
-        modules.add(new ServerModule("CayenneModeler"));
+        modules.add(new ServerModule(){
+            @Override
+            public void configure(Binder binder) {
+                super.configure(binder);
+                ServerModule.contributeProjectLocations(binder).add("CayenneModeler");
+            }
+        });
 
         modules.add(new ProjectModule());
         modules.add(new DbSyncModule());


Mime
View raw message