Search in sources :

Example 21 with SampleUser

use of org.hyperledger.fabric.sdkintegration.SampleUser in project fabric-sdk-java by hyperledger.

the class HFCAClientIT method testMockEnrollWithMessages.

@Test
public void testMockEnrollWithMessages() throws Exception {
    MockHFCAClient mockClient = MockHFCAClient.createNewInstance(testConfig.getIntegrationTestsSampleOrg(TEST_WITH_INTEGRATION_ORG).getCALocation(), testConfig.getIntegrationTestsSampleOrg(TEST_WITH_INTEGRATION_ORG).getCAProperties());
    mockClient.setCryptoSuite(crypto);
    SampleUser user = getEnrolledUser(TEST_ADMIN_ORG);
    mockClient.setHttpPostResponse("{\"success\":true, \"result\":{\"Cert\":\"abc\"}, \"messages\":[{\"code\":123, \"message\":\"test message\"}]}");
    mockClient.enroll(user.getName(), user.getEnrollmentSecret());
}
Also used : MockHFCAClient(org.hyperledger.fabric_ca.sdk.MockHFCAClient) SampleUser(org.hyperledger.fabric.sdkintegration.SampleUser) Test(org.junit.Test)

Example 22 with SampleUser

use of org.hyperledger.fabric.sdkintegration.SampleUser in project fabric-sdk-java by hyperledger.

the class HFCAClientIT method testMockReenrollNoCert.

@Ignore
@Test
public void testMockReenrollNoCert() throws Exception {
    thrown.expect(EnrollmentException.class);
    thrown.expectMessage("failed re-enrollment for user");
    MockHFCAClient mockClient = MockHFCAClient.createNewInstance(testConfig.getIntegrationTestsSampleOrg(TEST_WITH_INTEGRATION_ORG).getCALocation(), testConfig.getIntegrationTestsSampleOrg(TEST_WITH_INTEGRATION_ORG).getCAProperties());
    mockClient.setCryptoSuite(crypto);
    SampleUser user = getEnrolledUser(TEST_ADMIN_ORG);
    mockClient.setHttpPostResponse("{\"success\":true}");
    mockClient.reenroll(user);
}
Also used : MockHFCAClient(org.hyperledger.fabric_ca.sdk.MockHFCAClient) SampleUser(org.hyperledger.fabric.sdkintegration.SampleUser) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

SampleUser (org.hyperledger.fabric.sdkintegration.SampleUser)22 Test (org.junit.Test)20 ASN1OctetString (org.bouncycastle.asn1.ASN1OctetString)9 RegistrationRequest (org.hyperledger.fabric_ca.sdk.RegistrationRequest)9 EnrollmentRequest (org.hyperledger.fabric_ca.sdk.EnrollmentRequest)8 MockHFCAClient (org.hyperledger.fabric_ca.sdk.MockHFCAClient)8 Attribute (org.hyperledger.fabric_ca.sdk.Attribute)7 Enrollment (org.hyperledger.fabric.sdk.Enrollment)4 Calendar (java.util.Calendar)3 Date (java.util.Date)3 File (java.io.File)2 SampleStore (org.hyperledger.fabric.sdkintegration.SampleStore)2 HFCAClient (org.hyperledger.fabric_ca.sdk.HFCAClient)2 HFCAIdentity (org.hyperledger.fabric_ca.sdk.HFCAIdentity)2 Ignore (org.junit.Ignore)2 BufferedInputStream (java.io.BufferedInputStream)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 CertificateFactory (java.security.cert.CertificateFactory)1 X509Certificate (java.security.cert.X509Certificate)1 HFCAAffiliation (org.hyperledger.fabric_ca.sdk.HFCAAffiliation)1