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,6 +241,45 @@ public class DomainTest {
|
|||||||
testHtdocsfallbackOnOff(false, "zuletzt wieder aus");
|
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 testBackupMxForExternamlMxOnOff(boolean onoff, String message)
|
||||||
|
throws UnknownHostException, IOException {
|
||||||
|
testDomainptionOnOf(onoff, message, new DomainOptionTester() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOptionName() {
|
||||||
|
return "backupmxforexternalmx";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOptionConfigured(String domain)
|
||||||
|
throws UnknownHostException, IOException {
|
||||||
|
String host = "test-h99.hostsharing.net";
|
||||||
|
return host == ""; // noch kein sinnvoller test
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void testGreylistingOnOff(boolean onoff, String message)
|
private void testGreylistingOnOff(boolean onoff, String message)
|
||||||
throws UnknownHostException, IOException {
|
throws UnknownHostException, IOException {
|
||||||
testDomainptionOnOf(onoff, message, new DomainOptionTester() {
|
testDomainptionOnOf(onoff, message, new DomainOptionTester() {
|
||||||
@ -273,7 +319,80 @@ public class DomainTest {
|
|||||||
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