Compare commits

...

2 Commits

Author SHA1 Message Date
Timotheus Pokorra
13316d265e use this 2023-12-12 11:53:25 +01:00
Timotheus Pokorra
9a6a6d094a Erweiterung der Tests um das Ändern von den neuen Domain Eigenschaften, z.B. PassengerPython 2023-12-12 11:52:39 +01:00
2 changed files with 35 additions and 5 deletions

View File

@ -135,6 +135,13 @@ public class DomainTest {
Map<?, ?> row = (Map<?, ?>) o; Map<?, ?> row = (Map<?, ?>) o;
assertTrue("Domain name should be exampleupdate.de but is " + row.get("name"), "exampleupdate.de".equals(row.get("name"))); assertTrue("Domain name should be exampleupdate.de but is " + row.get("name"), "exampleupdate.de".equals(row.get("name")));
assertTrue("ValidSubdomainNames should be * but is " + row.get("validsubdomainnames"), "*".equals(row.get("validsubdomainnames"))); assertTrue("ValidSubdomainNames should be * but is " + row.get("validsubdomainnames"), "*".equals(row.get("validsubdomainnames")));
String defaultPassengerPython = "";
assertTrue("PassengerPython should be empty but is " + row.get("passengerpython"), isNullOrEmpty(row.get("passengerpython")));
assertTrue("PassengerNodejs should be empty but is " + row.get("passengernodejs"), isNullOrEmpty(row.get("passengernodejs")));
assertTrue("PassengerRuby should be empty but is " + row.get("passengerruby"), isNullOrEmpty(row.get("passengerruby")));
assertTrue("FcgiPhpBin should be empty but is " + row.get("fcgiphpbin"), isNullOrEmpty(row.get("fcgiphpbin")));
String[] checkDomainOptions = Arrays.asList((Object[]) row.get("domainoptions")).toArray(new String[0]); String[] checkDomainOptions = Arrays.asList((Object[]) row.get("domainoptions")).toArray(new String[0]);
String[] expectedDomainOptions = new String[] {"htdocsfallback", "indexes", "dkim", "autoconfig", "greylisting", "includes", "letsencrypt", "multiviews"}; String[] expectedDomainOptions = new String[] {"htdocsfallback", "indexes", "dkim", "autoconfig", "greylisting", "includes", "letsencrypt", "multiviews"};
Arrays.sort(expectedDomainOptions); Arrays.sort(expectedDomainOptions);
@ -156,10 +163,21 @@ public class DomainTest {
// now update the domain // now update the domain
setParams = new HashMap<String, Object>(); setParams = new HashMap<String, Object>();
whereParams = new HashMap<String, String>();
setParams.put("validsubdomainnames", "www2"); setParams.put("validsubdomainnames", "www2");
String newPassengerPython = "/home/pacs/aaa00/users/admin/.venv/bin/python3";
setParams.put("passengerpython", newPassengerPython);
String newPassengerRuby = "/home/pacs/aaa00/users/admin/.rbenv/shims/ruby";
setParams.put("passengerruby", newPassengerRuby);
String newPassengerNodejs = "/home/pacs/aaa00/users/admin/.nvm/versions/node/v18.19.0/bin/node";
setParams.put("passengernodejs", newPassengerNodejs);
String newFcgiPhpBin = "/usr/bin/php8.1";
setParams.put("fcgiphpbin", newFcgiPhpBin);
String[] newDomainOptions = new String[] {"greylisting", "letsencrypt", "passenger", "passengerfriendlyerrorpages", "cgi", "fastcgi"}; String[] newDomainOptions = new String[] {"greylisting", "letsencrypt", "passenger", "passengerfriendlyerrorpages", "cgi", "fastcgi"};
setParams.put("domainoptions", newDomainOptions); setParams.put("domainoptions", newDomainOptions);
whereParams = new HashMap<String, String>();
whereParams.put("name", "exampleupdate.de"); whereParams.put("name", "exampleupdate.de");
params = new Object[] { user, params = new Object[] { user,
cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()), cas.getServiceTicket(grantingTicketURL, RemoteTestHelper.getBackendURL()),
@ -174,6 +192,12 @@ public class DomainTest {
Map<?, ?> row = (Map<?, ?>) o; Map<?, ?> row = (Map<?, ?>) o;
assertTrue("Domain name should be exampleupdate.de but is " + row.get("name"), "exampleupdate.de".equals(row.get("name"))); assertTrue("Domain name should be exampleupdate.de but is " + row.get("name"), "exampleupdate.de".equals(row.get("name")));
assertTrue("ValidSubdomainNames should be www2 but is " + row.get("validsubdomainnames"), "www2".equals(row.get("validsubdomainnames"))); assertTrue("ValidSubdomainNames should be www2 but is " + row.get("validsubdomainnames"), "www2".equals(row.get("validsubdomainnames")));
assertTrue("PassengerPython should be " + newPassengerPython + " but is " + row.get("passengerpython"), newPassengerPython.equals(row.get("passengerpython")));
assertTrue("PassengerNodejs should be " + newPassengerNodejs + " but is " + row.get("passengernodejs"), newPassengerNodejs.equals(row.get("passengernodejs")));
assertTrue("PassengerRuby should be " + newPassengerRuby + " but is " + row.get("passengerruby"), newPassengerRuby.equals(row.get("passengerruby")));
assertTrue("FcgiPhpBin should be " + newFcgiPhpBin + " but is " + row.get("fcgiphpbin"), newFcgiPhpBin.equals(row.get("fcgiphpbin")));
String[] checkDomainOptions = Arrays.asList((Object[]) row.get("domainoptions")).toArray(new String[0]); String[] checkDomainOptions = Arrays.asList((Object[]) row.get("domainoptions")).toArray(new String[0]);
Arrays.sort(newDomainOptions); Arrays.sort(newDomainOptions);
Arrays.sort(checkDomainOptions); Arrays.sort(checkDomainOptions);
@ -193,6 +217,12 @@ public class DomainTest {
} }
} }
private Boolean isNullOrEmpty(Object s) {
if (s == null) return true;
if (((String)s).equals("")) return true;
return false;
}
@Test @Test
public void testCreateForeignSubdomain() throws UnknownHostException, IOException { public void testCreateForeignSubdomain() throws UnknownHostException, IOException {
int count = getDomsCount(); int count = getDomsCount();

View File

@ -212,7 +212,7 @@ public class Domain extends AbstractEntity {
} }
public void setPassengerPython(String value) { public void setPassengerPython(String value) {
passengerpython = value; this.passengerpython = value;
} }
public String getPassengerNodejs() { public String getPassengerNodejs() {
@ -220,7 +220,7 @@ public class Domain extends AbstractEntity {
} }
public void setPassengerNodejs(String value) { public void setPassengerNodejs(String value) {
passengernodejs = value; this.passengernodejs = value;
} }
public String getPassengerRuby() { public String getPassengerRuby() {
@ -228,7 +228,7 @@ public class Domain extends AbstractEntity {
} }
public void setPassengerRuby(String value) { public void setPassengerRuby(String value) {
passengerruby = value; this.passengerruby = value;
} }
public String getFcgiPhpBin() { public String getFcgiPhpBin() {
@ -236,7 +236,7 @@ public class Domain extends AbstractEntity {
} }
public void setFcgiPhpBin(String value) { public void setFcgiPhpBin(String value) {
fcgiphpbin = value; this.fcgiphpbin = value;
} }
public String getServeraliases() { public String getServeraliases() {