Skip to content

Commit 92b957c

Browse files
authored
Merge branch 'master' into dependabot/maven/org.apache.maven.shared-maven-shared-utils-3.4.2
2 parents c34d3a1 + b37e6b4 commit 92b957c

File tree

9 files changed

+58
-55
lines changed

9 files changed

+58
-55
lines changed

.github/workflows/maven.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ jobs:
5858
- name: Test with Maven on Windows
5959
env:
6060
MAVEN_OPTS: "-Xms3g -Xmx5g -Djdk.xml.xpathExprGrpLimit=500 -Djdk.xml.xpathExprOpLimit=500"
61-
run: mvn install -B -V -D"maven.javadoc.skip"="true" -P"skipBundlePlugin,minimal-fix-latest" -D"java.util.logging.config.file"="logging.properties" -D"http.keepAlive"="false" -D"maven.wagon.http.pool"="false" -D"maven.wagon.httpconnectionManager.ttlSeconds"="120"
61+
run: mvn install -B -V -D"maven.javadoc.skip"="true" -P"skipBundlePlugin,minimal-fix-latest" -D"java.util.logging.config.file"="logging.properties" -D"http.keepAlive"="false" -D"maven.wagon.http.pool"="false" -D"maven.wagon.httpconnectionManager.ttlSeconds"="120"

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
<mainClass/>
7878
<maven.version>3.8.7</maven.version>
7979
<maven-libs-version>3.9.6</maven-libs-version>
80-
<maven-plugin-api-version>3.9.5</maven-plugin-api-version>
80+
<maven-plugin-api-version>3.9.6</maven-plugin-api-version>
8181
<maven-resources-plugin-version>3.3.1</maven-resources-plugin-version>
8282
<maven-compiler-plugin-version>3.11.0</maven-compiler-plugin-version>
8383
<maven-jar-plugin-version>3.3.0</maven-jar-plugin-version>
@@ -104,7 +104,7 @@
104104
<docgen.version>1.6.8</docgen.version>
105105
<jaxb.version>4.0.1</jaxb.version>
106106
<apache.mina.version>2.2.3</apache.mina.version>
107-
<commons.io.version>2.11.0</commons.io.version>
107+
<commons.io.version>2.15.1</commons.io.version>
108108
<orchestra.file>OrchestraFIXLatest.xml</orchestra.file>
109109
<org.quickfixj.orchestra.tools.version>1.0.2</org.quickfixj.orchestra.tools.version>
110110
<proxool.version>0.9.1</proxool.version>
@@ -229,7 +229,7 @@
229229
<dependency>
230230
<groupId>org.codehaus.plexus</groupId>
231231
<artifactId>plexus-xml</artifactId>
232-
<version>4.0.0</version>
232+
<version>4.0.2</version>
233233
</dependency>
234234
<dependency>
235235
<groupId>com.sleepycat</groupId>
@@ -463,7 +463,7 @@
463463
</plugin>
464464
<plugin>
465465
<artifactId>maven-invoker-plugin</artifactId>
466-
<version>3.2.2</version>
466+
<version>3.6.0</version>
467467
</plugin>
468468
<plugin>
469469
<artifactId>maven-plugin-plugin</artifactId>

quickfixj-codegenerator/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<dependency>
4141
<groupId>net.sf.saxon</groupId>
4242
<artifactId>Saxon-HE</artifactId>
43-
<version>12.3</version>
43+
<version>12.4</version>
4444
</dependency>
4545
<dependency>
4646
<groupId>org.junit.vintage</groupId>

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import static org.junit.Assert.assertNull;
4747
import static org.junit.Assert.assertTrue;
4848
import static org.junit.Assert.fail;
49+
import quickfix.test.util.StackTraceUtil;
4950

5051
/**
5152
* QFJ-643: Unable to restart a stopped acceptor (SocketAcceptor)
@@ -326,7 +327,11 @@ public void waitForLogon() {
326327

327328
public void waitForLogout() {
328329
try {
329-
assertTrue("Logout timed out", logoutLatch.await(10, TimeUnit.SECONDS));
330+
final boolean await = logoutLatch.await(10, TimeUnit.SECONDS);
331+
if (!await) {
332+
StackTraceUtil.dumpStackTraces(log);
333+
}
334+
assertTrue("Logout timed out", await);
330335
} catch (InterruptedException e) {
331336
fail(e.getMessage());
332337
}

quickfixj-core/src/test/java/quickfix/test/acceptance/ATApplication.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package quickfix.test.acceptance;
2121

22+
import java.util.concurrent.atomic.AtomicBoolean;
2223
import org.junit.Assert;
2324

2425
import quickfix.Application;
@@ -36,17 +37,19 @@
3637
public class ATApplication implements Application {
3738
private final ATMessageCracker inboundCracker = new ATMessageCracker();
3839
private final MessageCracker outboundCracker = new MessageCracker(new Object());
39-
private boolean isLoggedOn;
40+
private final AtomicBoolean isLoggedOn = new AtomicBoolean(false);
4041

42+
@Override
4143
public void onCreate(SessionID sessionID) {
4244
assertNoSessionLock(sessionID);
4345
Session.lookupSession(sessionID).reset();
4446
}
4547

46-
public synchronized void onLogon(SessionID sessionID) {
48+
@Override
49+
public void onLogon(SessionID sessionID) {
4750
assertNoSessionLock(sessionID);
48-
Assert.assertFalse("Already logged on", isLoggedOn);
49-
isLoggedOn = true;
51+
Assert.assertFalse("Already logged on", isLoggedOn.get());
52+
isLoggedOn.set(true);
5053
}
5154

5255
private void assertNoSessionLock(SessionID sessionID) {
@@ -56,17 +59,20 @@ private void assertNoSessionLock(SessionID sessionID) {
5659
Thread.holdsLock(session));
5760
}
5861

59-
public synchronized void onLogout(SessionID sessionID) {
62+
@Override
63+
public void onLogout(SessionID sessionID) {
6064
assertNoSessionLock(sessionID);
6165
inboundCracker.reset();
62-
Assert.assertTrue("No logged on when logout is received", isLoggedOn);
63-
isLoggedOn = false;
66+
Assert.assertTrue("Not logged on when logout is received", isLoggedOn.get());
67+
isLoggedOn.set(false);
6468
}
6569

70+
@Override
6671
public void toAdmin(Message message, SessionID sessionID) {
6772
assertNoSessionLock(sessionID);
6873
}
6974

75+
@Override
7076
public void toApp(Message message, SessionID sessionID) throws DoNotSend {
7177
assertNoSessionLock(sessionID);
7278
try {
@@ -78,11 +84,13 @@ public void toApp(Message message, SessionID sessionID) throws DoNotSend {
7884
}
7985
}
8086

87+
@Override
8188
public void fromAdmin(Message message, SessionID sessionID) throws FieldNotFound,
8289
IncorrectDataFormat, IncorrectTagValue, RejectLogon {
8390
assertNoSessionLock(sessionID);
8491
}
8592

93+
@Override
8694
public void fromApp(Message message, SessionID sessionID) throws FieldNotFound,
8795
IncorrectDataFormat, IncorrectTagValue, UnsupportedMessageType {
8896
assertNoSessionLock(sessionID);

quickfixj-core/src/test/java/quickfix/test/acceptance/ATServer.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import quickfix.FixVersions;
3030
import quickfix.MemoryStoreFactory;
3131
import quickfix.MessageStoreFactory;
32-
import quickfix.RuntimeError;
3332
import quickfix.SLF4JLogFactory;
3433
import quickfix.SessionID;
3534
import quickfix.SessionSettings;
@@ -43,7 +42,6 @@
4342
import java.lang.management.ManagementFactory;
4443
import java.lang.management.ThreadInfo;
4544
import java.lang.management.ThreadMXBean;
46-
import java.net.BindException;
4745
import java.util.ArrayList;
4846
import java.util.Enumeration;
4947
import java.util.HashMap;
@@ -116,6 +114,7 @@ public void run() {
116114
defaults.put("SocketTcpNoDelay", "Y");
117115
defaults.put("StartTime", "00:00:00");
118116
defaults.put("EndTime", "00:00:00");
117+
defaults.put("NonStopSession", "Y");
119118
defaults.put("SenderCompID", "ISLD");
120119
defaults.put("TargetCompID", "TW");
121120
defaults.put("JdbcDriver", "com.mysql.jdbc.Driver");
@@ -189,19 +188,12 @@ public void run() {
189188
assertSessionIds();
190189

191190
acceptor.setIoFilterChainBuilder(ioFilterChainBuilder);
192-
try {
193-
acceptor.start();
194-
} catch (RuntimeError e) {
195-
if (e.getCause() instanceof BindException) {
196-
log.warn("Acceptor port {} is still bound! Waiting 60 seconds and trying again...", port);
197-
Thread.sleep(60000);
198-
acceptor.start();
199-
}
200-
}
191+
acceptor.start();
201192

202193
assertSessionIds();
203194

204195
initializationLatch.countDown();
196+
205197
CountDownLatch shutdownLatch = new CountDownLatch(1);
206198
try {
207199
// running all acceptance tests should hopefully not take longer than 30 mins

quickfixj-core/src/test/java/quickfix/test/acceptance/AcceptanceTestSuite.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class AcceptanceTestSuite extends TestSuite {
3838
private static final String acceptanceTestBaseDir = AcceptanceTestSuite.class.getClassLoader().getResource(acceptanceTestResourcePath).getPath();
3939

4040
private static int transportType = ProtocolFactory.SOCKET;
41-
private static int port = 9887;
41+
private static int port = AvailablePortFinder.getNextAvailable();
4242

4343
private final boolean skipSlowTests;
4444
private final boolean multithreaded;
@@ -111,9 +111,7 @@ protected void printDatabasePoolingStatistics() {
111111
private List<TestStep> load(String filename) throws IOException {
112112
ArrayList<TestStep> steps = new ArrayList<>();
113113
log.info("load test: " + filename);
114-
BufferedReader in = null;
115-
try {
116-
in = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "ISO8859_1"));
114+
try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "ISO8859_1"))) {
117115
String line = in.readLine();
118116
while (line != null) {
119117
if (line.matches("^[ \t]*#.*")) {
@@ -131,14 +129,6 @@ private List<TestStep> load(String filename) throws IOException {
131129
}
132130
line = in.readLine();
133131
}
134-
} finally {
135-
if (in != null) {
136-
try {
137-
in.close();
138-
} catch (IOException e1) {
139-
e1.printStackTrace();
140-
}
141-
}
142132
}
143133
return steps;
144134
}
@@ -220,7 +210,6 @@ private boolean isTestSkipped(File file) {
220210
private static final class AcceptanceTestServerSetUp extends TestSetup {
221211
private final boolean threaded;
222212
private final Map<Object, Object> overridenProperties;
223-
// private Thread serverThread;
224213
private final ExecutorService executor = Executors.newSingleThreadExecutor();
225214

226215
private ATServer server;
@@ -249,7 +238,6 @@ protected void tearDown() throws Exception {
249238

250239
public static Test suite() {
251240
transportType = ProtocolFactory.getTransportType(System.getProperty(ATEST_TRANSPORT_KEY, ProtocolFactory.getTypeString(ProtocolFactory.SOCKET)));
252-
port = AvailablePortFinder.getNextAvailable(port);
253241
TestSuite acceptanceTests = new TestSuite(AcceptanceTestSuite.class.getSimpleName());
254242
// default server
255243
acceptanceTests.addTest(new AcceptanceTestServerSetUp(new AcceptanceTestSuite("server", false)));

quickfixj-core/src/test/java/quickfix/test/acceptance/TestConnection.java

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,27 @@
4444
import java.util.ArrayList;
4545
import java.util.HashMap;
4646
import java.util.List;
47+
import java.util.Map;
4748
import java.util.concurrent.BlockingQueue;
49+
import java.util.concurrent.ConcurrentHashMap;
50+
import java.util.concurrent.ConcurrentMap;
4851
import java.util.concurrent.CountDownLatch;
4952
import java.util.concurrent.LinkedBlockingQueue;
5053
import java.util.concurrent.TimeUnit;
5154
import quickfix.mina.SessionConnector;
5255

5356
public class TestConnection {
54-
private static final HashMap<String, IoConnector> connectors = new HashMap<>();
57+
private static final Map<Integer, IoConnector> connectors = new HashMap<>();
58+
private final ConcurrentMap<Integer, TestIoHandler> ioHandlers = new ConcurrentHashMap<>();
5559
private final Logger log = LoggerFactory.getLogger(getClass());
56-
private final HashMap<Integer, TestIoHandler> ioHandlers = new HashMap<>();
5760

5861
public void sendMessage(int clientId, String message) throws IOException {
5962
TestIoHandler handler = getIoHandler(clientId);
6063
handler.getSession().write(message);
6164
}
6265

6366
private TestIoHandler getIoHandler(int clientId) {
64-
synchronized (ioHandlers) {
65-
return ioHandlers.get(clientId);
66-
}
67+
return ioHandlers.get(clientId);
6768
}
6869

6970
public void tearDown() {
@@ -87,7 +88,7 @@ public void waitForClientDisconnect(int clientId) throws IOException, Interrupte
8788

8889
public void connect(int clientId, int transportType, int port)
8990
throws IOException {
90-
IoConnector connector = connectors.get(Integer.toString(clientId));
91+
IoConnector connector = connectors.get(clientId);
9192
if (connector != null) {
9293
SessionConnector.closeManagedSessionsAndDispose(connector, true, log);
9394
}
@@ -102,16 +103,16 @@ public void connect(int clientId, int transportType, int port)
102103
} else {
103104
throw new RuntimeException("Unsupported transport type: " + transportType);
104105
}
105-
connectors.put(Integer.toString(clientId), connector);
106+
connectors.put(clientId, connector);
106107

107108
TestIoHandler testIoHandler = new TestIoHandler();
108-
synchronized (ioHandlers) {
109-
ioHandlers.put(clientId, testIoHandler);
110-
connector.setHandler(testIoHandler);
111-
ConnectFuture future = connector.connect(address);
112-
future.awaitUninterruptibly(5000L);
113-
Assert.assertTrue("connection to server failed", future.isConnected());
114-
}
109+
ioHandlers.put(clientId, testIoHandler);
110+
connector.setHandler(testIoHandler);
111+
ConnectFuture future = connector.connect(address);
112+
future.awaitUninterruptibly(5000L);
113+
Throwable exception = future.getException();
114+
String failedMessage = "connection to server failed: " + (exception != null ? exception.getMessage() : "");
115+
Assert.assertTrue(failedMessage, future.isConnected());
115116
}
116117

117118
private class TestIoHandler extends IoHandlerAdapter {
@@ -144,7 +145,7 @@ public void messageReceived(IoSession session, Object message) throws Exception
144145

145146
public IoSession getSession() {
146147
try {
147-
boolean await = sessionCreatedLatch.await(70, TimeUnit.SECONDS); // 10 seconds more than retry time in ATServer.run()
148+
boolean await = sessionCreatedLatch.await(5, TimeUnit.SECONDS);
148149
if (!await) {
149150
log.error("sessionCreatedLatch timed out. Dumping threads...");
150151
StackTraceUtil.dumpStackTraces(log);
@@ -179,7 +180,10 @@ public String getNextMessage(long timeout) throws InterruptedException {
179180
}
180181

181182
public void waitForDisconnect() throws InterruptedException {
182-
if (!disconnectLatch.await(500000L, TimeUnit.MILLISECONDS)) {
183+
/* Please note that this timeout should not be too little because
184+
there is at least one acceptance test (6_SendTestRequest) expecting
185+
the connection to timeout after a TestRequest. */
186+
if (!disconnectLatch.await(20000, TimeUnit.MILLISECONDS)) {
183187
Assert.fail("client not disconnected");
184188
}
185189
}

quickfixj-core/src/test/resources/quickfix/test/acceptance/definitions/validateChecksum/fix50/QFJ973-ProcessMessageWithInvalidChecksum.def

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,11 @@ I8=FIXT.1.135=034=249=TW52=<TIME>56=ISLD10=256
1010
I8=FIXT.1.135=034=349=TW52=<TIME>56=ISLD
1111
# Incorrect checksum
1212
I8=FIXT.1.135=D34=449=TW52=<TIME>56=ISLD60=<TIME>11=ID21=340=154=155=INTC10=256
13+
E8=FIXT.1.135=D34=249=ISLD52=00000000-00:00:00.00056=TW60=00000000-00:00:00.00011=ID21=340=154=155=INTC10=0
1314
# correct checksum
1415
I8=FIXT.1.135=034=549=TW52=<TIME>56=ISLD
16+
17+
# logout message and response
18+
I8=FIXT.1.135=534=649=TW52=<TIME>56=ISLD
19+
E8=FIXT.1.19=4935=534=349=ISLD52=00000000-00:00:00.00056=TW10=0
20+
eDISCONNECT

0 commit comments

Comments
 (0)