X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=tests%2Forg%2Fcacert%2Fgigi%2FtestUtils%2FPingTest.java;h=fd5de700daa9d0c87a0443cda2c3c097f54cabc4;hp=4fb49595c316e84a5e9452f14bd6ebb7e82fd991;hb=a0232b6e40e7e09767f0444d24e18bf12dafc362;hpb=8af6231b22da4fef795bcb54913faad6592b1a02 diff --git a/tests/org/cacert/gigi/testUtils/PingTest.java b/tests/org/cacert/gigi/testUtils/PingTest.java index 4fb49595..fd5de700 100644 --- a/tests/org/cacert/gigi/testUtils/PingTest.java +++ b/tests/org/cacert/gigi/testUtils/PingTest.java @@ -12,7 +12,6 @@ import java.sql.SQLException; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.cacert.gigi.database.DatabaseConnection; import org.cacert.gigi.database.GigiPreparedStatement; import org.cacert.gigi.database.GigiResultSet; import org.cacert.gigi.pages.account.domain.DomainOverview; @@ -34,15 +33,16 @@ public abstract class PingTest extends ClientTest { } protected void waitForPings(int count) throws SQLException, InterruptedException { - GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT COUNT(*) FROM domainPinglog"); - long start = System.currentTimeMillis(); - while (System.currentTimeMillis() - start < 10000) { - GigiResultSet rs = ps.executeQuery(); - rs.next(); - if (rs.getInt(1) >= count) { - break; + try (GigiPreparedStatement ps = new GigiPreparedStatement("SELECT COUNT(*) FROM `domainPinglog`")) { + long start = System.currentTimeMillis(); + while (System.currentTimeMillis() - start < 10000) { + GigiResultSet rs = ps.executeQuery(); + rs.next(); + if (rs.getInt(1) >= count) { + break; + } + Thread.sleep(200); } - Thread.sleep(200); } } @@ -50,7 +50,7 @@ public abstract class PingTest extends ClientTest { URLConnection openConnection = u.openConnection(); openConnection.setRequestProperty("Cookie", cookie); openConnection.setDoOutput(true); - openConnection.getOutputStream().write(content.getBytes()); + openConnection.getOutputStream().write(content.getBytes("UTF-8")); openConnection.getHeaderField("Location"); String newcontent = IOUtils.readURL(cookie(u.openConnection(), cookie));