user1.setStatus(UserDataVOWS.STATUS_NEW);
user1.setTokenType(UserDataVOWS.TOKEN_TYPE_USERGENERATED);
user1.setEndEntityProfileName("EMPTY");
user1.setCertificateProfileName("ENDUSER");
ErrorCode errorCode = null;
// /// Check ErrorCode.CA_NOT_EXISTS /////
user1.setCaName(BADCANAME);
try {
ejbcaraws.editUser(user1);
} catch (CADoesntExistsException_Exception e) {
errorCode = e.getFaultInfo().getErrorCode();
}
assertNotNull("error code should not be null", errorCode);
assertEquals(errorCode.getInternalErrorCode(), org.ejbca.core.ErrorCode.CA_NOT_EXISTS.getInternalErrorCode());
// restore CA name
user1.setCaName(getAdminCAName());
errorCode = null;
// /// Check ErrorCode.EE_PROFILE_NOT_EXISTS /////
user1.setEndEntityProfileName("Bad EE profile");
try {
ejbcaraws.editUser(user1);
} catch (EjbcaException_Exception e) {
errorCode = e.getFaultInfo().getErrorCode();
}
assertNotNull("error code should not be null", errorCode);
assertEquals(errorCode.getInternalErrorCode(), org.ejbca.core.ErrorCode.EE_PROFILE_NOT_EXISTS.getInternalErrorCode());
// restore EE profile
user1.setEndEntityProfileName("EMPTY");
errorCode = null;
// /// Check ErrorCode.CERT_PROFILE_NOT_EXISTS /////
user1.setCertificateProfileName("Bad cert profile");
try {
ejbcaraws.editUser(user1);
} catch (EjbcaException_Exception e) {
errorCode = e.getFaultInfo().getErrorCode();
}
assertNotNull("error code should not be null", errorCode);
assertEquals(errorCode.getInternalErrorCode(), org.ejbca.core.ErrorCode.CERT_PROFILE_NOT_EXISTS.getInternalErrorCode());
// restore Certificate profile
user1.setCertificateProfileName("ENDUSER");
errorCode = null;
// /// Check ErrorCode.UNKOWN_TOKEN_TYPE /////
user1.setTokenType("Bad token type");
try {
ejbcaraws.editUser(user1);
} catch (EjbcaException_Exception e) {
errorCode = e.getFaultInfo().getErrorCode();
}
assertNotNull("error code should not be null", errorCode);
assertEquals(errorCode.getInternalErrorCode(), org.ejbca.core.ErrorCode.UNKOWN_TOKEN_TYPE.getInternalErrorCode());
}