You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by aa...@apache.org on 2014/02/15 11:33:09 UTC
svn commit: r1568608 - in /cayenne/main/trunk/cayenne-server/src:
main/java/org/apache/cayenne/configuration/server/ServerModule.java
test/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilderTest.java
Author: aadamchik
Date: Sat Feb 15 10:33:08 2014
New Revision: 1568608
URL: http://svn.apache.org/r1568608
Log:
Config-free ServerRuntime
Modified:
cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
cayenne/main/trunk/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilderTest.java
Modified: cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java?rev=1568608&r1=1568607&r2=1568608&view=diff
==============================================================================
--- cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java (original)
+++ cayenne/main/trunk/cayenne-server/src/main/java/org/apache/cayenne/configuration/server/ServerModule.java Sat Feb 15 10:33:08 2014
@@ -113,11 +113,7 @@ public class ServerModule implements Mod
public ServerModule(String... configurationLocations) {
if (configurationLocations == null) {
- throw new NullPointerException("Null configurationLocations");
- }
-
- if (configurationLocations.length < 1) {
- throw new IllegalArgumentException("Empty configurationLocations");
+ configurationLocations = new String[0];
}
this.configurationLocations = configurationLocations;
Modified: cayenne/main/trunk/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilderTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilderTest.java?rev=1568608&r1=1568607&r2=1568608&view=diff
==============================================================================
--- cayenne/main/trunk/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilderTest.java (original)
+++ cayenne/main/trunk/cayenne-server/src/test/java/org/apache/cayenne/configuration/server/ServerRuntimeBuilderTest.java Sat Feb 15 10:33:08 2014
@@ -31,6 +31,22 @@ import org.apache.cayenne.di.Module;
public class ServerRuntimeBuilderTest extends TestCase {
+ public void test_NoLocation() {
+
+ // this is meaningless (no DataSource), but should work...
+ ServerRuntime runtime = new ServerRuntimeBuilder().build();
+
+ List<?> locations = runtime.getInjector().getInstance(
+ Key.get(List.class, Constants.SERVER_PROJECT_LOCATIONS_LIST));
+
+ assertEquals(Arrays.asList(), locations);
+
+ assertEquals(1, runtime.getModules().length);
+
+ Module m0 = runtime.getModules()[0];
+ assertTrue(m0 instanceof ServerModule);
+ }
+
public void test_SingleLocation() {
ServerRuntime runtime = new ServerRuntimeBuilder("xxxx").build();