Skip to content

Commit 1c63bdb

Browse files
committed
ADAP-56: Add Application.getGroups
1 parent 69fb5d9 commit 1c63bdb

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import org.slf4j.Logger;
88
import org.slf4j.LoggerFactory;
99

10+
import java.util.List;
1011
import java.util.concurrent.CountDownLatch;
1112
import java.util.concurrent.TimeUnit;
1213

@@ -173,6 +174,7 @@ public void onError(Ack ack) {
173174
joinLatch.await(3, TimeUnit.SECONDS);
174175
assertEquals(joinLatch.getCount(), 0);
175176

177+
// get group info for a window
176178
CountDownLatch groupInfoLatch = new CountDownLatch(2);
177179
application1.getWindow().getGroup(result -> {
178180
for (Window window : result) {
@@ -194,6 +196,31 @@ public void onError(Ack ack) {
194196
groupInfoLatch.await(3, TimeUnit.SECONDS);
195197
assertEquals(groupInfoLatch.getCount(), 0);
196198

199+
// get group info for an application
200+
CountDownLatch appGroupInfoLatch = new CountDownLatch(2);
201+
application1.getGroups(result -> {
202+
for (List<Window> list: result) {
203+
for (Window window : list) {
204+
if (window.getUuid().equals(application1.getWindow().getUuid()) && window.getName().equals(application1.getWindow().getName())) {
205+
appGroupInfoLatch.countDown();
206+
} else if (window.getUuid().equals(application2.getWindow().getUuid()) && window.getName().equals(application2.getWindow().getName())) {
207+
appGroupInfoLatch.countDown();
208+
}
209+
}
210+
}
211+
}, new AckListener() {
212+
@Override
213+
public void onSuccess(Ack ack) {
214+
}
215+
@Override
216+
public void onError(Ack ack) {
217+
logger.error(String.format("onError %s", ack.getReason()));
218+
}
219+
}
220+
);
221+
appGroupInfoLatch.await(3, TimeUnit.SECONDS);
222+
assertEquals(appGroupInfoLatch.getCount(), 0);
223+
197224
int leftBy = 20, topBy = 30;
198225
TestUtils.moveWindowBy(application1.getWindow(), leftBy, topBy);
199226
// child window sohuld move with main window since they are docked

0 commit comments

Comments
 (0)