SessionSettings { public String getString(String key) throws ConfigError { return getString(DEFAULT_SESSION_ID, key); } SessionSettings();  SessionSettings(Properties variableValues);  SessionSettings(String filename, Properties variableValues);  SessionSettings(String filename);  SessionSettings(InputStream stream);  SessionSettings(InputStream stream, Properties variableValues); String getString(String key); String getString(SessionID sessionID, String key); Properties getSessionProperties(SessionID sessionID, boolean includeDefaults); Properties getSessionProperties(SessionID sessionID); Properties getDefaultProperties(); long getLong(String key); long getLong(SessionID sessionID, String key); int getInt(String key); int getInt(SessionID sessionID, String key); double getDouble(String key); double getDouble(SessionID sessionID, String key); boolean getBool(String key); boolean getBool(SessionID sessionID, String key); void setString(SessionID sessionID, String key, String value); void setLong(SessionID sessionID, String key, long value); void setDouble(SessionID sessionID, String key, double value); void setBool(SessionID sessionID, String key, boolean value); Iterator<SessionID> sectionIterator(); boolean isSetting(String key); boolean isSetting(SessionID sessionID, String key); void removeSetting(SessionID sessionID, String key); void setVariableValues(Properties variableValues); void set(Map<Object, Object> defaults); void setBool(String key, boolean value); void setDouble(String key, double value); void setLong(String key, long value); void setString(String key, String value); int size(); Dictionary get(SessionID sessionID); void set(SessionID sessionID, Dictionary dictionary); Dictionary get(); void set(Dictionary dictionary); void toString(PrintWriter writer); void toStream(OutputStream out); @Override String toString(); static int[] parseSettingReconnectInterval(String raw); static Set<InetAddress> parseRemoteAddresses(String raw); static final String BEGINSTRING; static final String SENDERCOMPID; static final String SENDERSUBID; static final String SENDERLOCID; static final String TARGETCOMPID; static final String TARGETSUBID; static final String TARGETLOCID; static final String SESSION_QUALIFIER; }
@Test public void testSpecialCharactersInKeys() throws Exception { final SessionSettings settings = setUpSession("$$$foo bar.baz@@@=value\n"); final SessionID sessionID2 = new SessionID("FIX.4.2", "TW", "CLIENT2"); assertEquals("value", settings.getString(sessionID2, "$$$foo bar.baz@@@")); }
@Test public void testStrangeCharactersInValues() throws Exception { final SessionSettings settings = setUpSession("label= This is a test? Yes, it is.\n"); final SessionID sessionID2 = new SessionID("FIX.4.2", "TW", "CLIENT2"); assertEquals("This is a test? Yes, it is.", settings.getString(sessionID2, "label")); }
@Test public void testFinalCommentWithoutTrailingNewline() throws Exception { final SessionSettings settings = setUpSession("label=no trailing newline\n# a comment without trailing newline"); final SessionID sessionID2 = new SessionID("FIX.4.2", "TW", "CLIENT2"); assertEquals("no trailing newline", settings.getString(sessionID2, "label")); }
@Test public void testVariableInterpolationInDefaultSection() throws Exception { System.setProperty("sender", "SENDER"); System.setProperty("target", "TARGET"); String settingsString = ""; settingsString += "[DEFAULT]\n"; settingsString += "SenderCompID=${sender}\n"; settingsString += "[SESSION]\n"; settingsString += "BeginString=FIX.4.2\n"; settingsString += "TargetCompID=${target}\n"; final SessionSettings settings = createSettingsFromString(settingsString); assertEquals("wrong value", "SENDER", settings.getString("SenderCompID")); final SessionID sessionID = new SessionID("FIX.4.2", "SENDER", "TARGET"); assertEquals("wrong value", "SENDER", settings.getString(sessionID, "SenderCompID")); assertEquals("wrong value", "TARGET", settings.getString(sessionID, "TargetCompID")); }