Skip to content

Commit

Permalink
Add build.yml process try fix async test restore isDone
Browse files Browse the repository at this point in the history
  • Loading branch information
vharseko committed Mar 11, 2024
1 parent 23c4da1 commit 45205a3
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.concurrent.TimeUnit;

import org.forgerock.openicf.framework.AsyncConnectorInfoManagerTestBase;
import org.forgerock.openicf.framework.ConnectorFramework;
Expand Down Expand Up @@ -106,6 +105,7 @@ public void handleException(RuntimeException error) {
Assert.fail("Key search should succeed", error);
}
});
Assert.assertTrue(keyRangePromise.isDone());

keyRangePromise.thenOnResult(new ResultHandler<ConnectorInfo>() {
public void handleResult(ConnectorInfo result) {
Expand All @@ -116,8 +116,6 @@ public void handleException(RuntimeException error) {
Assert.fail("KeyRange search should succeed", error);
}
});
keyRangePromise.getOrThrow(10, TimeUnit.SECONDS);
Assert.assertTrue(keyRangePromise.isDone());
} finally {
connectorFramework.release();
}
Expand Down Expand Up @@ -167,6 +165,8 @@ public void testConnectorBundleRange() throws Exception {

manager.addConnectorBundle(bundle10);

Assert.assertTrue(keyRangePromise.isDone());

keyRangePromise.thenOnResult(new ResultHandler<ConnectorInfo>() {
public void handleResult(ConnectorInfo result) {
Assert.assertEquals(result.getConnectorKey().getBundleVersion(), "1.0.0.0");
Expand All @@ -176,15 +176,15 @@ public void handleException(RuntimeException error) {
Assert.fail("KeyRange search should succeed", error);
}
});
keyRangePromise.getOrThrow(10, TimeUnit.SECONDS);
Assert.assertTrue(keyRangePromise.isDone());

keyRangePromise =
manager.findConnectorInfoAsync(ConnectorKeyRange.newBuilder().setBundleName(
"testbundlev2").setConnectorName(
"org.identityconnectors.testconnector.TstConnector").setBundleVersion(
"[1.0,2.0)").build());

Assert.assertTrue(keyRangePromise.isDone());

keyRangePromise.thenOnResult(new ResultHandler<ConnectorInfo>() {
public void handleResult(ConnectorInfo result) {
Assert.assertEquals(result.getConnectorKey().getBundleVersion(), "1.0.0.0");
Expand All @@ -194,8 +194,6 @@ public void handleException(RuntimeException error) {
Assert.fail("KeyRange search should succeed", error);
}
});
keyRangePromise.getOrThrow(10, TimeUnit.SECONDS);
Assert.assertTrue(keyRangePromise.isDone());

manager.addConnectorBundle(bundle11);

Expand All @@ -205,6 +203,8 @@ public void handleException(RuntimeException error) {
"org.identityconnectors.testconnector.TstConnector").setBundleVersion(
"[1.0,2.0)").build());

Assert.assertTrue(keyRangePromise.isDone());

keyRangePromise.thenOnResult(new ResultHandler<ConnectorInfo>() {
public void handleResult(ConnectorInfo result) {
Assert.assertEquals(result.getConnectorKey().getBundleVersion(), "1.1.0.0");
Expand All @@ -214,8 +214,6 @@ public void handleException(RuntimeException error) {
Assert.fail("KeyRange search should succeed", error);
}
});
keyRangePromise.getOrThrow(10, TimeUnit.SECONDS);
Assert.assertTrue(keyRangePromise.isDone());

} finally {
connectorFramework.release();
Expand Down

0 comments on commit 45205a3

Please sign in to comment.