Default domain options for newly created domain - greylisting on,

anything else not set.
This commit is contained in:
Purodha Blissenbach 2012-09-21 14:30:03 +02:00
parent cadd25346c
commit 7be61f856c
2 changed files with 12 additions and 1 deletions

View File

@ -1,6 +1,7 @@
package de.hsadmin.mods.dom;
import java.util.Date;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@ -90,6 +91,13 @@ public class DomainModuleImpl extends AbstractModuleImpl {
if (admin == null || admin.getName() == null || admin.getName().length() == 0) {
throw new HSAdminException("domain admin required");
}
// Standard domainoptions setzen. TODO: Alle defaults über eigene Klasse aus der Datenbank holen.
HashSet<DomainOption> domainOptions = new HashSet<DomainOption>();
DomainOption domainOption = new DomainOption();
domainOption.setName("greylisting");
domainOptions.add(domainOption);
dom.setDomainoptions(domainOptions);
EntityManager em = getTransaction().getEntityManager();
UnixUser loginUser = getTransaction().getLoginUser();

View File

@ -88,7 +88,7 @@ public class DomainTest {
}
@Test
public void testCreate() {
public void testCreate() throws UnknownHostException, IOException {
int count = getDomsCount();
String user = "aaa00";
String grantingTicketURL = cas.getGrantingTicketURL(user);
@ -105,6 +105,9 @@ public class DomainTest {
fail(e.getMessage());
}
assertEquals(count + 1, getDomsCount());
// TODO die beiden folgenden Tests sind etwas spezifisch für Version 2.2
assertEquals("eine neue Domain sollte nur die Domainoption 'greylisting' haben.",1,getDomOptionsCount());
testGreylistingOnOff(true, "sollte bei neuer Domain eingeschaltet sein");
}
@Test