success test
This commit is contained in:
parent
b07b6a530f
commit
dcca3eaf1e
|
@ -38,6 +38,7 @@ public class Config {
|
|||
//public static final String CHAINCODE_NAME = "mycc";
|
||||
public static final String CHAINCODE_NAME = "monnethic";
|
||||
//public static final String CHAINCODE_NAME = "monnethic-dev-4";
|
||||
public static final String CHAINCODE_PROD = "monnethic-prod";
|
||||
|
||||
//PEER 0
|
||||
public static final String ORG1_PEER_0 = "peer0.org1.example.com";
|
||||
|
|
|
@ -13,6 +13,10 @@ import org.hyperledger.fabric.sdk.ProposalResponse;
|
|||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.json.Json;
|
||||
import javax.json.JsonObject;
|
||||
import javax.json.JsonReader;
|
||||
import java.io.StringReader;
|
||||
import java.util.Collection;
|
||||
|
||||
@Ignore
|
||||
|
@ -31,20 +35,31 @@ public class ReadUserTest {
|
|||
ChannelClientWrapper channelClientWrapper = ChannelClientWrapper.setupChannel(fabricClientWrapper);
|
||||
|
||||
//String[] args1 = {"chef"};
|
||||
String[] args1 = {"user_test"};
|
||||
String[] args1 = {"bitman"};
|
||||
|
||||
Collection<ProposalResponse> responseQuery = channelClientWrapper.queryByChainCode(chaincode,"readUser",args1);
|
||||
logger.info("RESPONSE : "+responseQuery);
|
||||
logger.info("RESPONSE : "+responseQuery.size());
|
||||
|
||||
String response = null;
|
||||
|
||||
for(ProposalResponse pres : responseQuery){
|
||||
ChaincodeResponse.Status status = pres.getStatus();
|
||||
|
||||
if(status.getStatus()!=200){
|
||||
throw new Exception(pres.getMessage());
|
||||
}
|
||||
String stringResponse = new String(pres.getChaincodeActionResponsePayload());
|
||||
response = stringResponse;
|
||||
logger.info("RESPONSE : "+stringResponse);
|
||||
}
|
||||
|
||||
JsonReader reader = Json.createReader(new StringReader(response));
|
||||
JsonObject userInfo = reader.readObject();
|
||||
logger.info("userAssociation : "+userInfo.getString("userAssociation"));
|
||||
logger.info("userFirstName : "+userInfo.getString("userFirstName"));
|
||||
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue