use of org.apache.airavata.credential.store.credential.CommunityUser in project airavata by apache.
the class CommunityUserDAOTest method testDeleteCommunityUser.
@Test
public void testDeleteCommunityUser() throws Exception {
Connection connection = getConnection();
try {
CommunityUser communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
communityUserDAO.addCommunityUser(communityUser, "Token1", connection);
CommunityUser user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
Assert.assertNotNull(user);
communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
communityUserDAO.deleteCommunityUser(communityUser, connection);
user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
Assert.assertNull(user);
} finally {
connection.close();
}
}
use of org.apache.airavata.credential.store.credential.CommunityUser in project airavata by apache.
the class CommunityUserDAOTest method testDeleteCommunityUserByToken.
@Test
public void testDeleteCommunityUserByToken() throws Exception {
Connection connection = getConnection();
try {
CommunityUser communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
communityUserDAO.addCommunityUser(communityUser, "Token1", connection);
CommunityUser user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
Assert.assertNotNull(user);
communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
communityUserDAO.deleteCommunityUserByToken(communityUser, "Token1", connection);
user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
Assert.assertNull(user);
} finally {
connection.close();
}
}
use of org.apache.airavata.credential.store.credential.CommunityUser in project airavata by apache.
the class CommunityUserDAOTest method testGetCommunityUsers.
@Test
public void testGetCommunityUsers() throws Exception {
Connection connection = getConnection();
try {
CommunityUser communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
communityUserDAO.addCommunityUser(communityUser, "Token1", connection);
CommunityUser user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
Assert.assertNotNull(user);
Assert.assertEquals("ogce@sciencegateway.org", user.getUserEmail());
} finally {
connection.close();
}
}
use of org.apache.airavata.credential.store.credential.CommunityUser in project airavata by apache.
the class CredentialsDAOTest method testUpdateCredentials.
@Test
public void testUpdateCredentials() throws Exception {
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");
certificateCredential.setCredentialOwnerType(CredentialOwnerType.USER);
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());
// Assert.assertNotNull(certificateCredential.getPrivateKey());
Assert.assertEquals("test2", certificateCredential.getPortalUserName());
Assert.assertEquals(CredentialOwnerType.USER, certificateCredential.getCredentialOwnerType());
} finally {
connection.close();
}
}
Aggregations