Skip to content
This repository was archived by the owner on Feb 29, 2024. It is now read-only.

Commit b4b330e

Browse files
authored
Merge pull request #2335 from ianco/rc
Merge latest master, including indy node dockerfile updates
2 parents 114f43b + 76d02dd commit b4b330e

File tree

4 files changed

+79
-0
lines changed

4 files changed

+79
-0
lines changed

ci/indy-pool.dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,19 @@ ARG indy_node_ver=1.12.1~dev1172
3030
ARG python3_indy_crypto_ver=0.4.5
3131
ARG indy_crypto_ver=0.4.5
3232
ARG python3_pyzmq_ver=18.1.0
33+
ARG python3_orderedset_ver=2.0
34+
ARG python3_psutil_ver=5.4.3
35+
ARG python3_pympler_ver=0.5
3336

3437
RUN apt-get update -y && apt-get install -y \
3538
python3-pyzmq=${python3_pyzmq_ver} \
3639
indy-plenum=${indy_plenum_ver} \
3740
indy-node=${indy_node_ver} \
3841
python3-indy-crypto=${python3_indy_crypto_ver} \
3942
libindy-crypto=${indy_crypto_ver} \
43+
python3-orderedset=${python3_orderedset_ver} \
44+
python3-psutil=${python3_psutil_ver} \
45+
python3-pympler=${python3_pympler_ver} \
4046
vim
4147

4248
RUN echo "[supervisord]\n\

wrappers/java/src/main/java/org/hyperledger/indy/sdk/LibIndy.java

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public interface API extends Library {
3131
public int indy_close_pool_ledger(int command_handle, int handle, Callback cb);
3232
public int indy_delete_pool_ledger_config(int command_handle, String config_name, Callback cb);
3333
public int indy_set_protocol_version(int command_handle, int protocol_version, Callback cb);
34+
public int indy_list_pools(int command_handle, Callback cb);
3435

3536
// wallet.rs
3637

wrappers/java/src/main/java/org/hyperledger/indy/sdk/pool/Pool.java

+38
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,22 @@ public void callback(int xcommand_handle, int err) {
7373
future.complete(result);
7474
}
7575
};
76+
77+
/**
78+
* Callback used when listPools completes.
79+
*/
80+
private static Callback listPoolsCb = new Callback() {
81+
82+
@SuppressWarnings({"unused", "unchecked"})
83+
public void callback(int xcommand_handle, int err, String metadata) {
84+
85+
CompletableFuture<String> future = (CompletableFuture<String>) removeFuture(xcommand_handle);
86+
if (! checkResult(future, err)) return;
87+
88+
String result = metadata;
89+
future.complete(result);
90+
}
91+
};
7692

7793
/*
7894
* STATIC METHODS
@@ -259,6 +275,28 @@ public static CompletableFuture<Void> setProtocolVersion(
259275
return future;
260276
}
261277

278+
/**
279+
* Lists names of created pool ledgers
280+
*
281+
* @return A future resolving to a list of pools: [{
282+
* "pool": string - Name of pool ledger stored in the wallet.
283+
* }]
284+
* @throws IndyException Thrown if an error occurs when calling the underlying SDK.
285+
*/
286+
public static CompletableFuture<String> listPools() throws IndyException {
287+
288+
CompletableFuture<String> future = new CompletableFuture<String>();
289+
int commandHandle = addFuture(future);
290+
291+
int result = LibIndy.api.indy_list_pools(
292+
commandHandle,
293+
listPoolsCb);
294+
295+
checkResult(future, result);
296+
297+
return future;
298+
}
299+
262300
/*
263301
* INSTANCE METHODS
264302
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package org.hyperledger.indy.sdk.pool;
2+
3+
import org.hyperledger.indy.sdk.IndyIntegrationTest;
4+
import org.hyperledger.indy.sdk.utils.PoolUtils;
5+
6+
import org.junit.Test;
7+
import org.json.JSONArray;
8+
9+
import java.io.File;
10+
11+
import static org.junit.Assert.assertTrue;
12+
import static org.junit.Assert.assertEquals;
13+
14+
public class ListPoolsTest extends IndyIntegrationTest {
15+
16+
@Test
17+
public void testListPoolsWorks() throws Exception {
18+
File file = new File("testListPoolsWorks.txn");
19+
file.deleteOnExit();
20+
assertTrue(file.createNewFile());
21+
PoolUtils.writeTransactions(file);
22+
23+
String testPoolName = "testListPoolsWorks";
24+
25+
Pool.createPoolLedgerConfig(testPoolName, null).get();
26+
String listPoolsJson = Pool.listPools().get();
27+
28+
JSONArray listPools = new JSONArray(listPoolsJson);
29+
30+
assertEquals(1, listPools.length());
31+
assertEquals(testPoolName, listPools.getJSONObject(0).getString("pool"));
32+
}
33+
34+
}

0 commit comments

Comments
 (0)