mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
Fix java fabcar queryAllCars (#239)
Java chaincode still does not support open ended range queries Signed-off-by: James Taylor <jamest@uk.ibm.com>
This commit is contained in:
parent
df727853c8
commit
5fe1387a89
2 changed files with 3 additions and 3 deletions
|
|
@ -143,8 +143,8 @@ public final class FabCar implements ContractInterface {
|
|||
public String queryAllCars(final Context ctx) {
|
||||
ChaincodeStub stub = ctx.getStub();
|
||||
|
||||
final String startKey = "";
|
||||
final String endKey = "";
|
||||
final String startKey = "CAR1";
|
||||
final String endKey = "CAR99";
|
||||
List<CarQueryResult> queryResults = new ArrayList<CarQueryResult>();
|
||||
|
||||
QueryResultsIterator<KeyValue> results = stub.getStateByRange(startKey, endKey);
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ public final class FabCarTest {
|
|||
Context ctx = mock(Context.class);
|
||||
ChaincodeStub stub = mock(ChaincodeStub.class);
|
||||
when(ctx.getStub()).thenReturn(stub);
|
||||
when(stub.getStateByRange("", "")).thenReturn(new MockCarResultsIterator());
|
||||
when(stub.getStateByRange("CAR1", "CAR99")).thenReturn(new MockCarResultsIterator());
|
||||
|
||||
String cars = contract.queryAllCars(ctx);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue