Skip to content

Commit 39918ed

Browse files
committed
ADAP-207: fixed tests
1 parent 2bfa54c commit 39918ed

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/main/java/com/openfin/desktop/demo/ChannelExample.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,15 @@ public void createChannelClient() {
119119
JSONObject payload = new JSONObject();
120120
payload.put("name", "java example");
121121
desktopConnection.getChannel(CHANNEL_NAME).connectAsync(false, payload).thenAccept(client -> {
122+
client.addChannelListener(new ChannelListener() {
123+
@Override
124+
public void onChannelConnect(ConnectionEvent connectionEvent) {
125+
}
126+
@Override
127+
public void onChannelDisconnect(ConnectionEvent connectionEvent) {
128+
logger.info("channel disconnected {}", connectionEvent.getChannelId());
129+
}
130+
});
122131
client.register("event", new ChannelAction() {
123132
@Override
124133
public JSONObject invoke(String action, Object payload, JSONObject senderIdentity) {

src/test/java/com/openfin/desktop/ChannelTest.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,7 @@
1616
import org.slf4j.LoggerFactory;
1717

1818
/**
19-
* JUnit tests for com.openfin.desktop.InterApplicationBus class
20-
*
21-
* Test cases in this class need to have access to an OpenFin HTML5 app to
22-
* verify sub/pub workflow. Sources for the app can be found in release
23-
* directory: PubSubExample.html. It is hosted by OpenFin at
24-
* https://cdn.openfin.co/examples/junit/PubSubExample.html
19+
* JUnit tests for OpenFin Channel API
2520
*
2621
* Created by wche on 1/27/16.
2722
*
@@ -321,16 +316,15 @@ public void onClientDisconnect(ChannelClientConnectEvent connectionEvent) {
321316
});
322317

323318
desktopConnection.getChannel(channelName).connectAsync().thenAccept(client -> {
324-
client.addChannelListener(new ChannelListener() {
319+
client.disconnect(new AckListener() {
325320
@Override
326-
public void onChannelConnect(ConnectionEvent connectionEvent) {
321+
public void onSuccess(Ack ack) {
322+
latch.countDown();
327323
}
328324
@Override
329-
public void onChannelDisconnect(ConnectionEvent connectionEvent) {
330-
latch.countDown();
325+
public void onError(Ack ack) {
331326
}
332327
});
333-
client.disconnect(null);
334328
});
335329
});
336330
latch.await(10, TimeUnit.SECONDS);

0 commit comments

Comments
 (0)