Search in sources :

Example 1 with CAInfo

use of org.hyperledger.fabric.sdk.NetworkConfig.CAInfo in project fabric-sdk-java by hyperledger.

the class NetworkConfigIT method doMainSetup.

@BeforeClass
public static void doMainSetup() throws Exception {
    out("\n\n\nRUNNING: NetworkConfigIT.\n");
    resetConfig();
    configHelper.customizeConfig();
    // Use the appropriate TLS/non-TLS network config file
    networkConfig = NetworkConfig.fromYamlFile(testConfig.getTestNetworkConfigFileYAML());
    // Check if we get access to defined CAs!
    CAInfo caInfo = networkConfig.getOrganizationInfo("Org1").getCertificateAuthorities().get(0);
    HFCAClient hfcaClient = HFCAClient.createNewInstance(caInfo);
    assertEquals(hfcaClient.getCAName(), caInfo.getCAName());
    // makes actual REST call.
    HFCAInfo info = hfcaClient.info();
    assertEquals(caInfo.getCAName(), info.getCAName());
    // with no caname or the default
    caInfo = networkConfig.getOrganizationInfo("Org2").getCertificateAuthorities().get(0);
    hfcaClient = HFCAClient.createNewInstance(caInfo);
    assertEquals(hfcaClient.getCAName(), caInfo.getCAName());
    assertNull(caInfo.getCAName());
    // makes actual REST call.
    info = hfcaClient.info();
    // means default
    assertEquals(info.getCAName(), "");
    // Ensure the chaincode required for these tests is deployed
    deployChaincodeIfRequired();
}
Also used : HFCAInfo(org.hyperledger.fabric_ca.sdk.HFCAInfo) CAInfo(org.hyperledger.fabric.sdk.NetworkConfig.CAInfo) HFCAClient(org.hyperledger.fabric_ca.sdk.HFCAClient) HFCAInfo(org.hyperledger.fabric_ca.sdk.HFCAInfo) BeforeClass(org.junit.BeforeClass)

Aggregations

CAInfo (org.hyperledger.fabric.sdk.NetworkConfig.CAInfo)1 HFCAClient (org.hyperledger.fabric_ca.sdk.HFCAClient)1 HFCAInfo (org.hyperledger.fabric_ca.sdk.HFCAInfo)1 BeforeClass (org.junit.BeforeClass)1