import org.cacert.gigi.util.SimpleSigner;
import org.junit.After;
import org.junit.AfterClass;
+import org.junit.Assert;
import org.junit.BeforeClass;
/**
throw new Error("Server startup failed");
}
ter = new TestEmailReciever(new InetSocketAddress("localhost", 8473));
+ ter.start();
SimpleSigner.runSigner();
} catch (IOException e) {
throw new Error(e);
public static void clearCaches() throws IOException {
ObjectCache.clearAllCaches();
- String type = testProps.getProperty("type");
+ // String type = testProps.getProperty("type");
URL u = new URL("https://" + getServerName() + "/manage");
u.openConnection().getHeaderField("Location");
}
@After
public void clearAcceptLanguage() {
- acceptLanguage = null;
+ ManagedTest.setAcceptLanguage(null);
}
public TestMail waitForMail() {
- try {
- return ter.recieve();
- } catch (InterruptedException e) {
- throw new Error(e);
+ TestMail mail = null;
+ while (null == mail) {
+ try {
+ mail = ter.recieve();
+ } catch (InterruptedException e) {
+ throw new Error(e);
+ }
}
+ return mail;
}
public static TestEmailReciever getMailReciever() {
registerUser(firstName, lastName, email, password);
try {
TestMail tm = ter.recieve();
+ Assert.assertNotNull(tm);
tm.verify();
GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT id FROM users where email=?");
ps.setString(1, email);
EmailAddress adrr = new EmailAddress(u, createUniqueName() + "test@test.tld");
adrr.insert(Language.getInstance(Locale.ENGLISH));
TestMail testMail = getMailReciever().recieve();
+ Assert.assertNotNull(testMail);
assertEquals(adrr.getAddress(), testMail.getTo());
String hash = testMail.extractLink().substring(testMail.extractLink().lastIndexOf('=') + 1);
adrr.verify(hash);