addTestCredentials();
Connection connection = getConnection();
try {
CommunityUser communityUser = getCommunityUser("gw1", "tom");
CertificateCredential certificateCredential = new CertificateCredential();
certificateCredential.setToken("tom");
certificateCredential.setCommunityUser(communityUser);
certificateCredential.setCertificates(x509Certificates);
// certificateCredential.setPrivateKey(privateKey);
certificateCredential.setPortalUserName("test2");
certificateCredential.setLifeTime(50);
certificateCredential.setNotBefore("15 OCT 2012 5:34:23");
certificateCredential.setNotAfter("16 OCT 2012 5:34:23");
credentialsDAO.updateCredentials(communityUser.getGatewayName(), certificateCredential, connection);
certificateCredential = (CertificateCredential) credentialsDAO.getCredential("gw1", "tom", connection);
Assert.assertEquals("CN=Airavata Project, OU=IU, O=Indiana University, L=Bloomington, ST=IN, C=US",
certificateCredential.getCertificates()[0].getIssuerDN().toString());