Esempio n. 1
0
 /**
  * @param sessionKey Caller's session key.
  * @param orgId the orgId of the organization to set name on
  * @param name the new name for the org.
  * @return the updated org.
  * @xmlrpc.doc Updates the name of an organization
  * @xmlrpc.param #param("string", "sessionKey")
  * @xmlrpc.param #param("int", "orgId")
  * @xmlrpc.param #param_desc("string", "name", "Organization name. Must meet same criteria as in
  *     the web UI.")
  * @xmlrpc.returntype $OrgDtoSerializer
  */
 public OrgDto updateName(String sessionKey, Integer orgId, String name) {
   getSatAdmin(sessionKey);
   Org org = verifyOrgExists(orgId);
   if (!org.getName().equals(name)) {
     try {
       OrgManager.checkOrgName(name);
       org.setName(name);
     } catch (ValidatorException ve) {
       throw new ValidationException(ve.getMessage());
     }
   }
   return OrgManager.toDetailsDto(org);
 }
 public void testDuplicateKeyCreation() throws Exception {
   String keyName = "Hey!";
   ActivationKeyManager.getInstance()
       .createNewActivationKey(user, keyName, null, null, null, false);
   try {
     ActivationKeyManager.getInstance()
         .createNewActivationKey(user, keyName, "Cool Duplicate", null, null, false);
     String msg = "Duplicate Key exception not raised..";
     fail(msg);
   } catch (ValidatorException e) {
     for (ValidatorError er : e.getResult().getErrors()) {
       if (er.getKey().equals("activation-key.java.exists")) {
         // sweet duplicate object exception
         return;
       }
     }
     throw e;
   }
 }