Fix the build
This commit is contained in:
+15
-11
@@ -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,29 +73,32 @@ 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()) {
|
||||||
|
String text = sb.getText().trim();
|
||||||
|
if (!text.isEmpty()) {
|
||||||
|
screenContentRef.set(text);
|
||||||
screenLatch.countDown();
|
screenLatch.countDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
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");
|
||||||
|
|
||||||
|
String screenContent = screenContentRef.get();
|
||||||
|
if (screenContent == null || screenContent.isEmpty()) {
|
||||||
ScreenBuffer sb = client.getScreenBuffer();
|
ScreenBuffer sb = client.getScreenBuffer();
|
||||||
assertNotNull(sb);
|
if (sb != null) {
|
||||||
|
screenContent = sb.getText().trim();
|
||||||
StringBuilder fullText = new StringBuilder();
|
|
||||||
for (int i = 0; i < sb.getSize(); i++) {
|
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user