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
|
@Test
|
||||||
public void testGreylisting() throws UnknownHostException, IOException {
|
public void testGreylisting() throws UnknownHostException, IOException {
|
||||||
testGreylistingOnOff(true, "zuerst an");
|
testGreylistingOnOff(true, "zuerst an");
|
||||||
@ -234,25 +241,64 @@ public class DomainTest {
|
|||||||
testHtdocsfallbackOnOff(false, "zuletzt wieder aus");
|
testHtdocsfallbackOnOff(false, "zuletzt wieder aus");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testGreylistingOnOff(boolean onoff, String message)
|
// @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 testBackupMxForExternamlMxOnOff(boolean onoff, String message)
|
||||||
throws UnknownHostException, IOException {
|
throws UnknownHostException, IOException {
|
||||||
testDomainptionOnOf(onoff, message, new DomainOptionTester() {
|
testDomainptionOnOf(onoff, message, new DomainOptionTester() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOptionName() {
|
public String getOptionName() {
|
||||||
return "greylisting";
|
return "backupmxforexternalmx";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOptionConfigured(String domain)
|
public boolean isOptionConfigured(String domain)
|
||||||
throws UnknownHostException, IOException {
|
throws UnknownHostException, IOException {
|
||||||
String host = "test-h99.hostsharing.net";
|
String host = "test-h99.hostsharing.net";
|
||||||
String answer = socketQuery( host, 25,
|
return host == ""; // noch kein sinnvoller test
|
||||||
"HELO " + domain + "\n" +
|
}
|
||||||
"MAIl FROM: hsadmin-testing@" + domain + "\n" +
|
});
|
||||||
"RCPT TO: postmaster@" + domain + "\n" +
|
}
|
||||||
"DATA\n" +
|
|
||||||
".\n") ;
|
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");
|
return answer.contains("450") && answer.contains("reylisting");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -272,8 +318,81 @@ public class DomainTest {
|
|||||||
throws UnknownHostException, IOException {
|
throws UnknownHostException, IOException {
|
||||||
String host = "test-h99.hostsharing.net";
|
String host = "test-h99.hostsharing.net";
|
||||||
String answer = socketQuery(host, 80, "GET / HTTP/1.1\n"
|
String answer = socketQuery(host, 80, "GET / HTTP/1.1\n"
|
||||||
+ "Host: x.y.z." + domain
|
+ "Host: x.y.z." + domain
|
||||||
+ "User-Agent: hsAdmin Test\n" + "Connection: close\n");
|
+ "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"));
|
answer = answer.substring(0, answer.indexOf("\n"));
|
||||||
return answer.contains("404");
|
return answer.contains("404");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user