Fix the build
Build and Test j3270 / Build JAR & Run Tests (Java 17) (push) Successful in 25s
Build and Test j3270 / Build JAR & Run Tests (Java 11) (push) Successful in 59s
Build and Test j3270 / Build JAR & Run Tests (Java 21) (push) Successful in 23s

This commit is contained in:
2026-09-07 20:31:18 -04:00
parent dbcb0aa1b6
commit f8fc0e4b22
@@ -54,11 +54,12 @@ public class LiveHostHeadlessTest {
CountDownLatch connectedLatch = new CountDownLatch(1); CountDownLatch connectedLatch = new CountDownLatch(1);
CountDownLatch screenLatch = new CountDownLatch(1); CountDownLatch screenLatch = new CountDownLatch(1);
java.util.concurrent.atomic.AtomicReference<String> screenContentRef = new java.util.concurrent.atomic.AtomicReference<>();
client.addConnectionListener(new ConnectionListener() { client.addConnectionListener(new ConnectionListener() {
@Override @Override
public void onConnectionStateChanged(ConnectionState oldState, ConnectionState newState) { public void onConnectionStateChanged(ConnectionState oldState, ConnectionState newState) {
if (newState == ConnectionState.CONNECTED_3270) { if (newState.is3270()) {
connectedLatch.countDown(); connectedLatch.countDown();
} }
} }
@@ -72,7 +73,11 @@ public class LiveHostHeadlessTest {
public void onScreenUpdated() { public void onScreenUpdated() {
ScreenBuffer sb = client.getScreenBuffer(); ScreenBuffer sb = client.getScreenBuffer();
if (sb != null && sb.isFormatted()) { if (sb != null && sb.isFormatted()) {
screenLatch.countDown(); String text = sb.getText().trim();
if (!text.isEmpty()) {
screenContentRef.set(text);
screenLatch.countDown();
}
} }
} }
}); });
@@ -80,21 +85,20 @@ public class LiveHostHeadlessTest {
try { try {
client.connect(); client.connect();
boolean connected = connectedLatch.await(5, TimeUnit.SECONDS); boolean connected = connectedLatch.await(8, TimeUnit.SECONDS);
assertTrue(connected, "Client must establish CONNECTED_3270 state"); assertTrue(connected, "Client must establish 3270 connected state");
boolean screenReceived = screenLatch.await(5, TimeUnit.SECONDS); boolean screenReceived = screenLatch.await(8, TimeUnit.SECONDS);
assertTrue(screenReceived, "Client must receive formatted screen from live MVS host"); assertTrue(screenReceived, "Client must receive formatted screen from live MVS host");
ScreenBuffer sb = client.getScreenBuffer(); String screenContent = screenContentRef.get();
assertNotNull(sb); if (screenContent == null || screenContent.isEmpty()) {
ScreenBuffer sb = client.getScreenBuffer();
StringBuilder fullText = new StringBuilder(); if (sb != null) {
for (int i = 0; i < sb.getSize(); i++) { screenContent = sb.getText().trim();
char c = sb.getCell(i).ucs4; }
fullText.append(c > ' ' ? c : ' ');
} }
String screenContent = fullText.toString().trim(); assertNotNull(screenContent, "Screen content should not be null");
assertFalse(screenContent.isEmpty(), "Screen buffer text should not be empty"); assertFalse(screenContent.isEmpty(), "Screen buffer text should not be empty");
// Verify headless graphics plane is initialized without AWT // Verify headless graphics plane is initialized without AWT