示例#1
0
 @Test
 public void testCreation() {
   final String name = "Programming";
   final String description = "Program to solve the problems.";
   Domain domain = new Domain(name, description);
   assertEquals(name, domain.getName());
   assertEquals(description, domain.getDescription());
 }
  public String updateDomain(Domain theDomain) throws Exception {
    try {
      startTransaction(false);

      DomainRow dr = new DomainRow();
      dr.id = idAsInt(theDomain.getId());
      dr.name = theDomain.getName();
      dr.description = theDomain.getDescription();
      dr.className = theDomain.getDriverClassName();
      dr.propFileName = theDomain.getPropFileName();
      dr.authenticationServer = theDomain.getAuthenticationServer();
      dr.theTimeStamp = theDomain.getTheTimeStamp();
      dr.silverpeasServerURL = theDomain.getSilverpeasServerURL();

      // Create domain
      getOrganization().domain.updateDomain(dr);
      if (domainDriverInstances.get(theDomain.getId()) != null) {
        domainDriverInstances.remove(theDomain.getId());
      }
      this.commit();
      LoginPasswordAuthentication.initDomains();

      return theDomain.getId();
    } catch (AdminException e) {
      try {
        this.rollback();
      } catch (Exception e1) {
        SilverTrace.error("admin", "DomainDriverManager.updateDomain", "root.EX_ERR_ROLLBACK", e1);
      }
      throw new AdminException(
          "DomainDriverManager.updateDomain",
          SilverpeasException.ERROR,
          "admin.EX_ERR_ADD_DOMAIN",
          "domain name: '" + theDomain.getName() + "'",
          e);
    } finally {
      releaseOrganizationSchema();
    }
  }