Skip to content

Commit 126a123

Browse files
authored
Merge branch 'master' into optimiseSessionReset
2 parents 6895019 + 9f8fb4b commit 126a123

File tree

10 files changed

+199
-35
lines changed

10 files changed

+199
-35
lines changed

.github/workflows/maven.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
steps:
4444
- uses: actions/checkout@v4
4545
- name: Configure pagefile
46-
uses: al-cheb/configure-pagefile-action@v1.3
46+
uses: al-cheb/configure-pagefile-action@v1.4
4747
with:
4848
minimum-size: 8GB
4949
maximum-size: 16GB

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@
6868
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
6969
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
7070
<jdkLevel>1.8</jdkLevel>
71-
<slf4j.version>2.0.10</slf4j.version>
71+
<slf4j.version>2.0.12</slf4j.version>
7272
<mockito-core.version>4.11.0</mockito-core.version>
7373
<hamcrest.version>2.2</hamcrest.version>
74-
<junit.jupiter.version>5.10.1</junit.jupiter.version>
74+
<junit.jupiter.version>5.10.2</junit.jupiter.version>
7575
<maven.compiler.source>8</maven.compiler.source>
7676
<maven.compiler.target>8</maven.compiler.target>
7777
<mainClass/>
@@ -81,7 +81,7 @@
8181
<maven-resources-plugin-version>3.3.1</maven-resources-plugin-version>
8282
<maven-compiler-plugin-version>3.12.1</maven-compiler-plugin-version>
8383
<maven-jar-plugin-version>3.3.0</maven-jar-plugin-version>
84-
<maven-surefire-plugin-version>3.2.3</maven-surefire-plugin-version>
84+
<maven-surefire-plugin-version>3.2.5</maven-surefire-plugin-version>
8585
<maven-pmd-plugin-version>3.21.2</maven-pmd-plugin-version>
8686
<maven-source-plugin-version>3.3.0</maven-source-plugin-version>
8787
<maven-javadoc-plugin-version>3.6.3</maven-javadoc-plugin-version>
@@ -94,7 +94,7 @@
9494
<build-helper-maven-plugin-version>3.5.0</build-helper-maven-plugin-version>
9595
<maven-shared-utils.version>3.4.2</maven-shared-utils.version>
9696
<file-management.version>3.0.0</file-management.version>
97-
<maven-plugin-annotations.version>3.10.2</maven-plugin-annotations.version>
97+
<maven-plugin-annotations.version>3.11.0</maven-plugin-annotations.version>
9898
<maven-plugin-testing-harness.version>3.3.0</maven-plugin-testing-harness.version>
9999
<plantuml-maven-plugin-version>1.2</plantuml-maven-plugin-version>
100100
<plantuml-version>8059</plantuml-version>
@@ -467,7 +467,7 @@
467467
</plugin>
468468
<plugin>
469469
<artifactId>maven-plugin-plugin</artifactId>
470-
<version>3.10.2</version>
470+
<version>3.11.0</version>
471471
</plugin>
472472
<plugin>
473473
<artifactId>maven-install-plugin</artifactId>

quickfixj-base/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@
229229
</plugin>
230230
<plugin>
231231
<artifactId>maven-jxr-plugin</artifactId>
232-
<version>3.3.1</version>
232+
<version>3.3.2</version>
233233
</plugin>
234234
</plugins>
235235
</reporting>

quickfixj-codegenerator/pom.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@
7878
</plugin>
7979
<plugin>
8080
<artifactId>maven-plugin-plugin</artifactId>
81-
<version>3.10.2</version>
81+
<version>3.11.0</version>
82+
<configuration>
83+
<goalPrefix>quickfixj-codegenerator</goalPrefix>
84+
</configuration>
8285
</plugin>
8386
</plugins>
8487
</build>

quickfixj-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@
234234
<plugin>
235235
<groupId>org.apache.maven.plugins</groupId>
236236
<artifactId>maven-jxr-plugin</artifactId>
237-
<version>3.3.1</version>
237+
<version>3.3.2</version>
238238
</plugin>
239239
</plugins>
240240
</reporting>

quickfixj-core/src/main/java/quickfix/SessionSettings.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,4 +877,22 @@ public static Set<InetAddress> parseRemoteAddresses(String raw) {
877877
return result;
878878
}
879879

880+
public void removeSection(final SessionID sessionID) throws ConfigError {
881+
Properties properties = getSessionProperties(sessionID);
882+
883+
if (properties == null) {
884+
throw new ConfigError("Session not found");
885+
}
886+
sections.remove(sessionID);
887+
}
888+
889+
public void removeSection(final String propertyKey, final String propertyValue) throws ConfigError {
890+
SessionID sessionIdToRemove = sections.entrySet().stream()
891+
.filter(entry -> propertyValue.equals(entry.getValue().get(propertyKey)))
892+
.map(Map.Entry::getKey)
893+
.findFirst()
894+
.orElseThrow(() -> new ConfigError("Session not found"));
895+
896+
sections.remove(sessionIdToRemove);
897+
}
880898
}

quickfixj-core/src/test/java/quickfix/JdbcLogTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ private void setUpJdbcLog(boolean filterHeartbeats, DataSource dataSource) throw
133133
if (filterHeartbeats) {
134134
settings.setBool(JdbcSetting.SETTING_JDBC_LOG_HEARTBEATS, false);
135135
}
136-
settings.setString(sessionID, JdbcSetting.SETTING_JDBC_CONNECTION_TEST_QUERY, "SELECT COUNT(1) FROM INFORMATION_SCHEMA.SYSTEM_USERS WHERE 1 = 0;");
137136
JdbcTestSupport.setHypersonicSettings(settings);
138137
initializeTableDefinitions(connection);
139138
logFactory = new JdbcLogFactory(settings);

quickfixj-core/src/test/java/quickfix/JdbcTestSupport.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ public static void setHypersonicSettings(SessionSettings settings) {
4343
settings.setString(JdbcSetting.SETTING_JDBC_CONNECTION_URL, HSQL_CONNECTION_URL);
4444
settings.setString(JdbcSetting.SETTING_JDBC_USER, HSQL_USER);
4545
settings.setString(JdbcSetting.SETTING_JDBC_PASSWORD, "");
46+
// HSQL doesn't support JDBC4 which means that test query has to be supplied to HikariCP
47+
settings.setString(JdbcSetting.SETTING_JDBC_CONNECTION_TEST_QUERY, "SELECT COUNT(1) FROM INFORMATION_SCHEMA.SYSTEM_USERS WHERE 1 = 0;");
4648
}
4749

4850
public static Connection getConnection() throws ClassNotFoundException, SQLException {

quickfixj-core/src/test/java/quickfix/SessionSettingsTest.java

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.util.Iterator;
3232
import java.util.Properties;
3333
import java.util.Set;
34+
import java.util.HashSet;
3435
import java.util.List;
3536
import java.util.Map;
3637
import java.util.HashMap;
@@ -610,6 +611,51 @@ public void testConcurrentAccess() throws ConfigError, InterruptedException {
610611
assertTrue(testHasPassed.get());
611612
}
612613

614+
@Test
615+
public void testRemoveSectionBySessionID() throws ConfigError {
616+
final Map<Object, Object> defaultSettings = createDefaultSettings();
617+
618+
final Map<Object, Object> pricingSection = createPricingSection();
619+
final SessionID pricingSessionID = new SessionID("FIX.4.2:FOOBAR_PRICING->*");
620+
621+
final Map<Object, Object> tradingSection = createTradingSection();
622+
final SessionID tradingSessionID = new SessionID("FIX.4.2:FOOBAR_TRADING->*");
623+
624+
final SessionSettings sessionSettings = new SessionSettings();
625+
sessionSettings.set(new Dictionary(null, defaultSettings));
626+
sessionSettings.set(pricingSessionID, new Dictionary("sessions", pricingSection));
627+
sessionSettings.set(tradingSessionID, new Dictionary("sessions", tradingSection));
628+
629+
while (sessionSettings.sectionIterator().hasNext()) {
630+
SessionID sessionID = sessionSettings.sectionIterator().next();
631+
sessionSettings.removeSection(sessionID);
632+
}
633+
634+
assertFalse(sessionSettings.sectionIterator().hasNext());
635+
}
636+
637+
@Test
638+
public void testRemoveSectionByPropertyKey() throws ConfigError {
639+
final Map<Object, Object> defaultSettings = createDefaultSettings();
640+
641+
final Map<Object, Object> tradingSection = createTradingSection();
642+
final SessionID tradingSessionID = new SessionID("FIX.4.2:FOOBAR_TRADING->*");
643+
644+
final SessionSettings sessionSettings = new SessionSettings();
645+
sessionSettings.set(new Dictionary(null, defaultSettings));
646+
sessionSettings.set(tradingSessionID, new Dictionary("sessions", tradingSection));
647+
648+
sessionSettings.removeSection("SocketAcceptPort", "7566");
649+
650+
Set<SessionID> expectedSessionIdSet = new HashSet<>();
651+
while (sessionSettings.sectionIterator().hasNext()) {
652+
SessionID sessionID = sessionSettings.sectionIterator().next();
653+
expectedSessionIdSet.add(sessionID);
654+
}
655+
656+
assertFalse(expectedSessionIdSet.contains(tradingSessionID));
657+
}
658+
613659
private Map<Object, Object> createTradingSection() {
614660
final Map<Object, Object> tradingSection = new HashMap<>();
615661
tradingSection.put("PersistMessages","Y");

0 commit comments

Comments
 (0)