return mainProps;
}
inited = true;
+ url = testProps.getProperty("name.www") + ":" + testProps.getProperty("serverPort.https");
purgeDatabase();
String type = testProps.getProperty("type");
generateMainProps(mainProps);
if (type.equals("local")) {
- url = testProps.getProperty("name.www") + ":" + testProps.getProperty("serverPort.https");
String[] parts = testProps.getProperty("mail").split(":", 2);
ter = new TestEmailReceiver(new InetSocketAddress(parts[0], Integer.parseInt(parts[1])));
ter.start();
}
return mainProps;
}
- url = testProps.getProperty("name.www") + ":" + testProps.getProperty("serverPort.https");
gigi = Runtime.getRuntime().exec(testProps.getProperty("java"));
DataOutputStream toGigi = new DataOutputStream(gigi.getOutputStream());
System.out.println("... starting server");
public static void purgeDatabase() throws SQLException, IOException {
purgeOnlyDB();
- clearCaches();
+ if (gigi != null) {
+ clearCaches();
+ }
}
public static void clearCaches() throws IOException {
ObjectCache.clearAllCaches();
// String type = testProps.getProperty("type");
URL u = new URL("https://" + getServerName() + "/manage");
- u.openConnection().getHeaderField("Location");
+ URLConnection connection = u.openConnection();
+ connection.getHeaderField("Location");
+ connection.getInputStream().close();
}
private static void generateMainProps(Properties mainProps) {
String type = testProps.getProperty("type");
ter.destroy();
if (type.equals("local")) {
+ if (testProps.getProperty("withSigner", "false").equals("true")) {
+ try {
+ SimpleSigner.stopSigner();
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ inited = false;
return;
}
gigi.destroy();
} catch (InterruptedException e) {
e.printStackTrace();
}
+ inited = false;
}
public final String uniq = createUniqueName();
public static int createVerifiedUser(String firstName, String lastName, String email, String password) {
registerUser(firstName, lastName, email, password);
try {
- ter.receive().verify();
+ ter.receive(email).verify();
try (GigiPreparedStatement ps = new GigiPreparedStatement("SELECT `id` FROM `users` WHERE `email`=?")) {
ps.setString(1, email);
* the password
* @return a new userid.
*/
- public static int createAssuranceUser(String firstName, String lastName, String email, String password) {
+ public static int createVerificationUser(String firstName, String lastName, String email, String password) {
int uid = createVerifiedUser(firstName, lastName, email, password);
- makeAssurer(uid);
+ makeAgent(uid);
return uid;
}
public EmailAddress createVerifiedEmail(User u, String email) throws InterruptedException, GigiApiException {
EmailAddress addr = new EmailAddress(u, email, Locale.ENGLISH);
- TestMail testMail = getMailReceiver().receive();
- assertEquals(addr.getAddress(), testMail.getTo());
+ TestMail testMail = getMailReceiver().receive(addr.getAddress());
String hash = testMail.extractLink().substring(testMail.extractLink().lastIndexOf('=') + 1);
addr.verify(hash);
- getMailReceiver().clearMails();
+ getMailReceiver().assertEmpty();
return addr;
}