Search in sources :

Example 1 with ChaincodeInfo

use of org.hyperledger.fabric.protos.peer.Query.ChaincodeInfo in project fabric-sdk-java by hyperledger.

the class End2endAndBackAgainIT method checkInstantiatedChaincode.

private static boolean checkInstantiatedChaincode(Channel channel, Peer peer, String ccName, String ccPath, String ccVersion) throws InvalidArgumentException, ProposalException {
    out("Checking instantiated chaincode: %s, at version: %s, on peer: %s", ccName, ccVersion, peer.getName());
    List<ChaincodeInfo> ccinfoList = channel.queryInstantiatedChaincodes(peer);
    boolean found = false;
    for (ChaincodeInfo ccifo : ccinfoList) {
        if (ccPath != null) {
            found = ccName.equals(ccifo.getName()) && ccPath.equals(ccifo.getPath()) && ccVersion.equals(ccifo.getVersion());
            if (found) {
                break;
            }
        }
        found = ccName.equals(ccifo.getName()) && ccVersion.equals(ccifo.getVersion());
        if (found) {
            break;
        }
    }
    return found;
}
Also used : ChaincodeInfo(org.hyperledger.fabric.protos.peer.Query.ChaincodeInfo)

Example 2 with ChaincodeInfo

use of org.hyperledger.fabric.protos.peer.Query.ChaincodeInfo in project fabric-sdk-java by hyperledger.

the class End2endAndBackAgainIT method checkInstalledChaincode.

// @After
// public void clearConfig() {
// try {
// //           configHelper.clearConfig();
// } catch (Exception e) {
// }
// }
private static boolean checkInstalledChaincode(HFClient client, Peer peer, String ccName, String ccPath, String ccVersion) throws InvalidArgumentException, ProposalException {
    out("Checking installed chaincode: %s, at version: %s, on peer: %s", ccName, ccVersion, peer.getName());
    List<ChaincodeInfo> ccinfoList = client.queryInstalledChaincodes(peer);
    boolean found = false;
    for (ChaincodeInfo ccifo : ccinfoList) {
        if (ccPath != null) {
            found = ccName.equals(ccifo.getName()) && ccPath.equals(ccifo.getPath()) && ccVersion.equals(ccifo.getVersion());
            if (found) {
                break;
            }
        }
        found = ccName.equals(ccifo.getName()) && ccVersion.equals(ccifo.getVersion());
        if (found) {
            break;
        }
    }
    return found;
}
Also used : ChaincodeInfo(org.hyperledger.fabric.protos.peer.Query.ChaincodeInfo)

Example 3 with ChaincodeInfo

use of org.hyperledger.fabric.protos.peer.Query.ChaincodeInfo in project fabric-sdk-java by hyperledger.

the class NetworkConfigIT method checkInstantiatedChaincode.

// Determines if the specified chaincode has been instantiated on the channel
private static boolean checkInstantiatedChaincode(Channel channel, Peer peer, String ccName, String ccPath, String ccVersion) throws InvalidArgumentException, ProposalException {
    out("Checking instantiated chaincode: %s, at version: %s, on peer: %s", ccName, ccVersion, peer.getName());
    List<ChaincodeInfo> ccinfoList = channel.queryInstantiatedChaincodes(peer);
    boolean found = false;
    for (ChaincodeInfo ccifo : ccinfoList) {
        found = ccName.equals(ccifo.getName()) && ccPath.equals(ccifo.getPath()) && ccVersion.equals(ccifo.getVersion());
        if (found) {
            break;
        }
    }
    return found;
}
Also used : ChaincodeInfo(org.hyperledger.fabric.protos.peer.Query.ChaincodeInfo)

Aggregations

ChaincodeInfo (org.hyperledger.fabric.protos.peer.Query.ChaincodeInfo)3