|
From: <ste...@us...> - 2010-08-13 15:58:37
|
Revision: 1383
http://rails.svn.sourceforge.net/rails/?rev=1383&view=rev
Author: stefanfrey
Date: 2010-08-13 15:58:30 +0000 (Fri, 13 Aug 2010)
Log Message:
-----------
Fixed problems with TestGame integration tests
Modified Paths:
--------------
trunk/18xx/data/profiles/test.profile
trunk/18xx/rails/util/Config.java
trunk/18xx/rails/util/LocalText.java
trunk/18xx/test/TestGame.java
Modified: trunk/18xx/data/profiles/test.profile
===================================================================
--- trunk/18xx/data/profiles/test.profile 2010-08-13 15:57:46 UTC (rev 1382)
+++ trunk/18xx/data/profiles/test.profile 2010-08-13 15:58:30 UTC (rev 1383)
@@ -17,7 +17,7 @@
# (implying a language variant of that country; no default).
# Locale: concatenation of the above. If present, overrides any of the above.
# Examples: en, en_US, en_UK, fr_FR, fr_CA.
-locale=te_st
+locale=te_ST
#language=
#country=
@@ -25,7 +25,7 @@
# Each game has a specific format for monetary amounts (e.g. $100, 100M).
# An overriding format can be specified here, but then applies to all games.
# The @ character must be present and is replaced by the amount.
-# Example: \xA3@ to specify a pound sign prefix: \xA3100.
+# Example: �@ to specify a pound sign prefix: �100.
#money_format=$@
### Save file directory
Modified: trunk/18xx/rails/util/Config.java
===================================================================
--- trunk/18xx/rails/util/Config.java 2010-08-13 15:57:46 UTC (rev 1382)
+++ trunk/18xx/rails/util/Config.java 2010-08-13 15:58:30 UTC (rev 1383)
@@ -51,8 +51,8 @@
private static String userProfilesFile = "user.profiles";
private static Properties userProfiles = new Properties();
private static boolean profilesLoaded = false;
- private static final String TEST_PROFILE_SELECTION = ".test";
- private static final String DEFAULT_PROFILE_SELECTION = "default";
+ private static String DEFAULT_PROFILE_SELECTION = "default"; // can be overwritten
+ private static final String TEST_PROFILE_SELECTION = ".test"; // used as default profile for integration tests
private static final String STANDARD_PROFILE_SELECTION = "user";
private static final String DEFAULTPROFILE_PROPERTY = "default.profile";
private static final String PROFILENAME_PROPERTY = "profile.name";
@@ -329,8 +329,11 @@
// delayed setting of logger
log = Logger.getLogger(Config.class.getPackage().getName());
+ // define settings for testing
legacyConfigFile = false;
- selectedProfile = TEST_PROFILE_SELECTION;
+ DEFAULT_PROFILE_SELECTION = TEST_PROFILE_SELECTION;
+ selectedProfile = null;
+
initialLoad();
}
@@ -447,19 +450,23 @@
userProperties = new Properties();
defaultProperties = new Properties();
- // check if the profile is already defined under userProfiles
- String userConfigFile = userProfiles.getProperty(userProfile);
- if (Util.hasValue(userConfigFile) && // load user profile
- loadPropertyFile(userProperties, userConfigFile, false)) {
- // do nothing, only side effects
- } else { // if not defined or loadable, define userprofile with file association
- userProfiles.setProperty(userProfile, "");
+ String userConfigFile = null;
+ if (Util.hasValue(userProfile)) {
+ // check if the profile is already defined under userProfiles
+ userConfigFile = userProfiles.getProperty(userProfile);
+ if (Util.hasValue(userConfigFile) && // load user profile
+ loadPropertyFile(userProperties, userConfigFile, false)) {
+ // do nothing, only side effects
+ } else { // if not defined or loadable, define userprofile with file association
+ userProfiles.setProperty(userProfile, "");
+ }
+
+ // check if profilename is defined in user properties
+ if (!Util.hasValue(userProfiles.getProperty(PROFILENAME_PROPERTY))) {
+ userProperties.setProperty(PROFILENAME_PROPERTY, userProfile);
+ }
}
- // check if profilename is defined in user properties
- if (!Util.hasValue(userProfiles.getProperty(PROFILENAME_PROPERTY))) {
- userProperties.setProperty(PROFILENAME_PROPERTY, userProfile);
- }
loadDefaultProfile();
setSaveDirDefaults();
}
Modified: trunk/18xx/rails/util/LocalText.java
===================================================================
--- trunk/18xx/rails/util/LocalText.java 2010-08-13 15:57:46 UTC (rev 1382)
+++ trunk/18xx/rails/util/LocalText.java 2010-08-13 15:58:30 UTC (rev 1383)
@@ -11,6 +11,8 @@
public class LocalText extends ResourceBundle {
+ private static final String TEST_LOCALE = "te_ST";
+
protected static String language = "en";
protected static String country = "";
@@ -92,8 +94,8 @@
}
}
- // special treatment for te_ST (test)
- if (localeCode.equals("te_ST")) {
+ // special treatment for test locale
+ if (localeCode.equals(TEST_LOCALE)) {
StringBuffer s = new StringBuffer(key);
if (parameters != null)
for (Object o:parameters)
Modified: trunk/18xx/test/TestGame.java
===================================================================
--- trunk/18xx/test/TestGame.java 2010-08-13 15:57:46 UTC (rev 1382)
+++ trunk/18xx/test/TestGame.java 2010-08-13 15:58:30 UTC (rev 1383)
@@ -2,7 +2,6 @@
import java.io.File;
import java.io.FileReader;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|