@Test
  public void test04EditUserDataSource() throws Exception {
    log.trace(">test04EditUserDataSource()");
    boolean ret = false;

    BaseUserDataSource userdatasource =
        userDataSourceSession.getUserDataSource(admin, "TESTCLONEDUMMYCUSTOM");
    userdatasource.setDescription(userdatasource.getDescription().toUpperCase());
    userDataSourceSession.changeUserDataSource(admin, "TESTCLONEDUMMYCUSTOM", userdatasource);
    ret = true;

    assertTrue("Editing Custom UserDataSource failed", ret);
    log.trace("<test04EditUserDataSource()");
  }
Example #2
0
 /**
  * Method that saves the userdatasource data to database.
  *
  * @throws UnsupportedEncodingException
  */
 public void setUserDataSource(BaseUserDataSource userdatasource) {
   // We must base64 encode string for UTF safety
   HashMap a = new Base64PutHashMap();
   a.putAll((HashMap) userdatasource.saveData());
   java.io.ByteArrayOutputStream baos = new java.io.ByteArrayOutputStream();
   java.beans.XMLEncoder encoder = new java.beans.XMLEncoder(baos);
   encoder.writeObject(a);
   encoder.close();
   try {
     if (log.isDebugEnabled()) {
       log.debug("Profiledata: \n" + baos.toString("UTF8"));
     }
     setData(baos.toString("UTF8"));
   } catch (UnsupportedEncodingException e) {
     throw new RuntimeException(e);
   }
   this.userdatasource = userdatasource;
   setUpdateCounter(getUpdateCounter() + 1);
 }