use of org.hyperledger.fabric.sdk.testutils.TestUtils.MockUser in project fabric-sdk-java by hyperledger.
the class NetworkConfigIT method getAdminUser.
private static User getAdminUser(String orgName) throws Exception {
NetworkConfig.UserInfo userInfo = networkConfig.getPeerAdmin(orgName);
// NetworkConfig.UserInfo userInfo = networkConfig.getPeerAdmin();
String userName = userInfo.getEnrollId();
String mspId = userInfo.getMspId();
PrivateKey privateKey = userInfo.getPrivateKey();
String signedCert = userInfo.getSignedCert();
MockUser admin = TestUtils.getMockUser(userName, mspId);
admin.setEnrollment(TestUtils.getMockEnrollment(privateKey, signedCert));
return admin;
}
use of org.hyperledger.fabric.sdk.testutils.TestUtils.MockUser in project fabric-sdk-java by hyperledger.
the class ClientTest method testCryptoFactory.
// (expected = InvalidArgumentException.class)
@Test
@Ignore
public void testCryptoFactory() throws Exception {
try {
resetConfig();
Assert.assertNotNull(Config.getConfig().getDefaultCryptoSuiteFactory());
HFClient client = HFClient.createNewInstance();
client.setCryptoSuite(CryptoSuite.Factory.getCryptoSuite());
MockUser mockUser = TestUtils.getMockUser(USER_NAME, USER_MSP_ID);
MockEnrollment mockEnrollment = TestUtils.getMockEnrollment(null, "mockCert");
mockUser.setEnrollment(mockEnrollment);
client.setUserContext(mockUser);
} finally {
System.getProperties().remove("org.hyperledger.fabric.sdk.crypto.default_crypto_suite_factory");
}
}
use of org.hyperledger.fabric.sdk.testutils.TestUtils.MockUser in project fabric-sdk-java by hyperledger.
the class ClientTest method testBadUserMSPIDNull.
@Test(expected = InvalidArgumentException.class)
public void testBadUserMSPIDNull() throws Exception {
HFClient client = HFClient.createNewInstance();
client.setCryptoSuite(CryptoSuite.Factory.getCryptoSuite());
MockUser mockUser = TestUtils.getMockUser(USER_NAME, null);
client.setUserContext(mockUser);
}
use of org.hyperledger.fabric.sdk.testutils.TestUtils.MockUser in project fabric-sdk-java by hyperledger.
the class ClientTest method testBadEnrollmentBadCert.
@Test(expected = InvalidArgumentException.class)
public void testBadEnrollmentBadCert() throws Exception {
HFClient client = HFClient.createNewInstance();
client.setCryptoSuite(CryptoSuite.Factory.getCryptoSuite());
MockUser mockUser = TestUtils.getMockUser(USER_NAME, USER_MSP_ID);
MockEnrollment mockEnrollment = TestUtils.getMockEnrollment(null);
mockUser.setEnrollment(mockEnrollment);
client.setUserContext(mockUser);
}
Aggregations