made findPrivacyGroup calls async (#1346)

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
pull/1354/head
Sally MacFarlane 4 years ago committed by GitHub
parent 183037a91d
commit fcd365bdec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      enclave/build.gradle
  2. 16
      enclave/src/integration-test/java/org/hyperledger/besu/enclave/EnclaveTest.java

@ -19,6 +19,7 @@ dependencies {
// integration test dependencies. // integration test dependencies.
integrationTestImplementation project(':testutil') integrationTestImplementation project(':testutil')
integrationTestImplementation 'org.bouncycastle:bcpkix-jdk15on' integrationTestImplementation 'org.bouncycastle:bcpkix-jdk15on'
integrationTestImplementation 'org.awaitility:awaitility'

@ -28,9 +28,11 @@ import org.hyperledger.orion.testutil.OrionTestHarnessFactory;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import io.vertx.core.Vertx; import io.vertx.core.Vertx;
import org.awaitility.Awaitility;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.ClassRule; import org.junit.ClassRule;
@ -148,20 +150,30 @@ public class EnclaveTest {
assertThat(privacyGroupResponse.getDescription()).isEqualTo(description); assertThat(privacyGroupResponse.getDescription()).isEqualTo(description);
assertThat(privacyGroupResponse.getType()).isEqualTo(PrivacyGroup.Type.PANTHEON); assertThat(privacyGroupResponse.getType()).isEqualTo(PrivacyGroup.Type.PANTHEON);
PrivacyGroup[] findPrivacyGroupResponse = enclave.findPrivacyGroup(publicKeys); Awaitility.await()
.atMost(5, TimeUnit.SECONDS)
.untilAsserted(
() -> {
final PrivacyGroup[] findPrivacyGroupResponse = enclave.findPrivacyGroup(publicKeys);
assertThat(findPrivacyGroupResponse.length).isEqualTo(1); assertThat(findPrivacyGroupResponse.length).isEqualTo(1);
assertThat(findPrivacyGroupResponse[0].getPrivacyGroupId()) assertThat(findPrivacyGroupResponse[0].getPrivacyGroupId())
.isEqualTo(privacyGroupResponse.getPrivacyGroupId()); .isEqualTo(privacyGroupResponse.getPrivacyGroupId());
});
final String response = final String response =
enclave.deletePrivacyGroup(privacyGroupResponse.getPrivacyGroupId(), publicKeys.get(0)); enclave.deletePrivacyGroup(privacyGroupResponse.getPrivacyGroupId(), publicKeys.get(0));
assertThat(privacyGroupResponse.getPrivacyGroupId()).isEqualTo(response); assertThat(privacyGroupResponse.getPrivacyGroupId()).isEqualTo(response);
findPrivacyGroupResponse = enclave.findPrivacyGroup(publicKeys); Awaitility.await()
.atMost(5, TimeUnit.SECONDS)
.untilAsserted(
() -> {
final PrivacyGroup[] findPrivacyGroupResponse = enclave.findPrivacyGroup(publicKeys);
assertThat(findPrivacyGroupResponse.length).isEqualTo(0); assertThat(findPrivacyGroupResponse.length).isEqualTo(0);
});
} }
@Test @Test

Loading…
Cancel
Save