Badd test basics for domainoptions backupmxforexternalmx, indexes,
inclides, multiviews, not yet doing anything useful, currently disabled.
This commit is contained in:
parent
1dd78a708d
commit
ac49567fb4
@ -220,6 +220,13 @@ public class DomainTest {
|
||||
}
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void testBackupMxForExternamlMx() throws UnknownHostException, IOException {
|
||||
testBackupMxForExternamlMxOnOff(true, "zuerst an");
|
||||
testBackupMxForExternamlMxOnOff(false, "als zweites aus");
|
||||
testBackupMxForExternamlMxOnOff(true, "zuletzt wieder an");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGreylisting() throws UnknownHostException, IOException {
|
||||
testGreylistingOnOff(true, "zuerst an");
|
||||
@ -233,31 +240,70 @@ public class DomainTest {
|
||||
testHtdocsfallbackOnOff(true, "als zweites an");
|
||||
testHtdocsfallbackOnOff(false, "zuletzt wieder aus");
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void testIncludes() throws UnknownHostException, IOException {
|
||||
testIncludesOnOff(false, "zuerst aus");
|
||||
testIncludesOnOff(true, "als zweites an");
|
||||
testIncludesOnOff(false, "zuletzt wieder aus");
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void testIndexes() throws UnknownHostException, IOException {
|
||||
testIndexesOnOff(false, "zuerst aus");
|
||||
testIndexesOnOff(true, "als zweites an");
|
||||
testIndexesOnOff(false, "zuletzt wieder aus");
|
||||
}
|
||||
|
||||
// @Test
|
||||
public void testMultiviews() throws UnknownHostException, IOException {
|
||||
testMultiviewsOnOff(true, "zuerst an");
|
||||
testMultiviewsOnOff(false, "als zweites aus");
|
||||
testMultiviewsOnOff(true, "zuletzt wieder an");
|
||||
}
|
||||
|
||||
private void testGreylistingOnOff(boolean onoff, String message)
|
||||
private void testBackupMxForExternamlMxOnOff(boolean onoff, String message)
|
||||
throws UnknownHostException, IOException {
|
||||
testDomainptionOnOf(onoff, message, new DomainOptionTester() {
|
||||
|
||||
@Override
|
||||
public String getOptionName() {
|
||||
return "greylisting";
|
||||
return "backupmxforexternalmx";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOptionConfigured(String domain)
|
||||
throws UnknownHostException, IOException {
|
||||
String host = "test-h99.hostsharing.net";
|
||||
String answer = socketQuery( host, 25,
|
||||
"HELO " + domain + "\n" +
|
||||
"MAIl FROM: hsadmin-testing@" + domain + "\n" +
|
||||
"RCPT TO: postmaster@" + domain + "\n" +
|
||||
"DATA\n" +
|
||||
".\n") ;
|
||||
return host == ""; // noch kein sinnvoller test
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void testGreylistingOnOff(boolean onoff, String message)
|
||||
throws UnknownHostException, IOException {
|
||||
testDomainptionOnOf(onoff, message, new DomainOptionTester() {
|
||||
|
||||
@Override
|
||||
public String getOptionName() {
|
||||
return "greylisting";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOptionConfigured(String domain)
|
||||
throws UnknownHostException, IOException {
|
||||
String host = "test-h99.hostsharing.net";
|
||||
String answer = socketQuery( host, 25,
|
||||
"HELO " + domain + "\n" +
|
||||
"MAIl FROM: hsadmin-testing@" + domain + "\n" +
|
||||
"RCPT TO: postmaster@" + domain + "\n" +
|
||||
"DATA\n" +
|
||||
".\n") ;
|
||||
return answer.contains("450") && answer.contains("reylisting");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void testHtdocsfallbackOnOff(boolean onoff, String message)
|
||||
throws UnknownHostException, IOException {
|
||||
testDomainptionOnOf(onoff, message, new DomainOptionTester() {
|
||||
@ -272,8 +318,81 @@ public class DomainTest {
|
||||
throws UnknownHostException, IOException {
|
||||
String host = "test-h99.hostsharing.net";
|
||||
String answer = socketQuery(host, 80, "GET / HTTP/1.1\n"
|
||||
+ "Host: x.y.z." + domain
|
||||
+ "User-Agent: hsAdmin Test\n" + "Connection: close\n");
|
||||
+ "Host: x.y.z." + domain
|
||||
+ "User-Agent: hsAdmin Test\n"
|
||||
+ "Connection: close\n");
|
||||
answer = answer.substring(0, answer.indexOf("\n"));
|
||||
return answer.contains("404");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void testIncludesOnOff(boolean onoff, String message)
|
||||
throws UnknownHostException, IOException {
|
||||
testDomainptionOnOf(onoff, message, new DomainOptionTester() {
|
||||
|
||||
@Override
|
||||
public String getOptionName() {
|
||||
return "includes";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOptionConfigured(String domain)
|
||||
throws UnknownHostException, IOException {
|
||||
String host = "test-h99.hostsharing.net";
|
||||
// TODO dieser Test ist Humbug
|
||||
String answer = socketQuery(host, 80, "GET / HTTP/1.1\n"
|
||||
+ "Host: " + domain
|
||||
+ "User-Agent: hsAdmin Test\n"
|
||||
+ "Connection: close\n");
|
||||
answer = answer.substring(0, answer.indexOf("\n"));
|
||||
return answer.contains("404");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void testIndexesOnOff(boolean onoff, String message)
|
||||
throws UnknownHostException, IOException {
|
||||
testDomainptionOnOf(onoff, message, new DomainOptionTester() {
|
||||
|
||||
@Override
|
||||
public String getOptionName() {
|
||||
return "indexes";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOptionConfigured(String domain)
|
||||
throws UnknownHostException, IOException {
|
||||
String host = "test-h99.hostsharing.net";
|
||||
// TODO dieser Test ist Humbug
|
||||
String answer = socketQuery(host, 80, "GET / HTTP/1.1\n"
|
||||
+ "Host: " + domain
|
||||
+ "User-Agent: hsAdmin Test\n"
|
||||
+ "Connection: close\n");
|
||||
answer = answer.substring(0, answer.indexOf("\n"));
|
||||
return answer.contains("404");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void testMultiviewsOnOff(boolean onoff, String message)
|
||||
throws UnknownHostException, IOException {
|
||||
testDomainptionOnOf(onoff, message, new DomainOptionTester() {
|
||||
|
||||
@Override
|
||||
public String getOptionName() {
|
||||
return "multiviews";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOptionConfigured(String domain)
|
||||
throws UnknownHostException, IOException {
|
||||
String host = "test-h99.hostsharing.net";
|
||||
// TODO dieser Test ist Humbug
|
||||
String answer = socketQuery(host, 80, "GET / HTTP/1.1\n"
|
||||
+ "Host: " + domain
|
||||
+ "User-Agent: hsAdmin Test\n"
|
||||
+ "Connection: close\n");
|
||||
answer = answer.substring(0, answer.indexOf("\n"));
|
||||
return answer.contains("404");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user