HFCAClient { public static HFCAClient createNewInstance(String url, Properties properties) throws MalformedURLException { return new HFCAClient(null, url, properties); } HFCAClient(String caName, String url, Properties properties); String getCAName(); int getStatusCode(); static HFCAClient createNewInstance(String url, Properties properties); static HFCAClient createNewInstance(String name, String url, Properties properties); void setCryptoSuite(CryptoSuite cryptoSuite); CryptoSuite getCryptoSuite(); String register(RegistrationRequest request, User registrar); Enrollment enroll(String user, String secret); Enrollment enroll(String user, String secret, EnrollmentRequest req); HFCAInfo info(); Enrollment reenroll(User user); Enrollment reenroll(User user, EnrollmentRequest req); void revoke(User revoker, Enrollment enrollment, String reason); String revoke(User revoker, Enrollment enrollment, String reason, boolean genCRL); void revoke(User revoker, String revokee, String reason); String revoke(User revoker, String revokee, String reason, boolean genCRL); String generateCRL(User registrar, Date revokedBefore, Date revokedAfter, Date expireBefore, Date expireAfter); HFCAIdentity newHFCAIdentity(String enrollmentID); Collection<HFCAIdentity> getHFCAIdentities(User registrar); HFCAAffiliation newHFCAAffiliation(String name); HFCAAffiliation getHFCAAffiliations(User registrar); static final String DEFAULT_PROFILE_NAME; static final String HFCA_TYPE_PEER; static final String HFCA_TYPE_ORDERER; static final String HFCA_TYPE_CLIENT; static final String HFCA_TYPE_USER; static final String HFCA_ATTRIBUTE_HFREGISTRARROLES; static final String HFCA_ATTRIBUTE_HFREGISTRARDELEGATEROLES; static final String HFCA_ATTRIBUTE_HFREGISTRARATTRIBUTES; static final String HFCA_ATTRIBUTE_HFINTERMEDIATECA; static final String HFCA_ATTRIBUTE_HFREVOKER; static final String HFCA_ATTRIBUTE_HFAFFILIATIONMGR; static final String HFCA_ATTRIBUTE_HFGENCRL; }
@Test public void testNewInstance() throws Exception { HFCAClient memberServices = HFCAClient.createNewInstance("http: Assert.assertNotNull(memberServices); Assert.assertSame(HFCAClient.class, memberServices.getClass()); }
@Test public void testNewInstanceEmptyName() throws Exception { thrown.expect(InvalidArgumentException.class); thrown.expectMessage("name must not be"); HFCAClient.createNewInstance("", "http: }
@Test public void testNewInstanceWithName() throws Exception { HFCAClient memberServices = HFCAClient.createNewInstance("name", "http: Assert.assertNotNull(memberServices); Assert.assertSame(HFCAClient.class, memberServices.getClass()); }
@Test public void testNewInstanceWithNameAndProperties() throws Exception { Properties testProps = new Properties(); HFCAClient memberServices = HFCAClient.createNewInstance("name", "http: Assert.assertNotNull(memberServices); Assert.assertSame(HFCAClient.class, memberServices.getClass()); }
@Test public void testNewInstanceNullUrl() throws Exception { thrown.expect(MalformedURLException.class); HFCAClient.createNewInstance(null, null); }
@Test public void testNewInstanceEmptyUrl() throws Exception { thrown.expect(MalformedURLException.class); HFCAClient.createNewInstance("", null); }
@Test public void testNewInstanceBadUrlProto() throws Exception { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("HFCAClient only supports"); HFCAClient.createNewInstance("file: }
@Test public void testNewInstanceBadUrlPath() throws Exception { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("HFCAClient url does not support path"); HFCAClient.createNewInstance("http: }
@Test public void testNewInstanceNoUrlHost() throws Exception { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("HFCAClient url needs host"); HFCAClient.createNewInstance("http: }
@Test public void testNewInstanceBadUrlQuery() throws Exception { thrown.expect(IllegalArgumentException.class); thrown.expectMessage("HFCAClient url does not support query"); HFCAClient.createNewInstance("http: }
@Test public void testNewInstanceNullName() throws Exception { thrown.expect(InvalidArgumentException.class); thrown.expectMessage("name must not be"); HFCAClient.createNewInstance(null, "http: }