import club.wpia.gigi.dbObjects.Verification;
import club.wpia.gigi.dbObjects.Verification.VerificationType;
import club.wpia.gigi.testUtils.BusinessTest;
-import club.wpia.gigi.util.DayDate;
import club.wpia.gigi.util.Notary;
public class TestUser extends BusinessTest {
@Test
public void testStoreAndLoad() throws SQLException, GigiApiException {
- long dob = System.currentTimeMillis();
- dob -= dob % (1000 * 60 * 60 * 24);
User u = createUser("f", "l", createUniqueName() + "a@email.org", TEST_PASSWORD);
int id = u.getId();
User u2 = User.getById(id);
@Test
public void testDoubleInsert() throws GigiApiException {
- long d = System.currentTimeMillis();
- d -= d % DayDate.MILLI_DAY;
User u = createUser("f", "l", createUniqueName() + "@example.org", TEST_PASSWORD);
Verification[] ma = u.getMadeVerifications();
Verification[] ma2 = u.getMadeVerifications();
public void testPingPeriodOneAddress() throws IOException, GeneralSecurityException, GigiApiException {
// get new email address with last ping in past
String furtherEmail = createUniqueName() + "@example.org";
- EmailAddress ea = new EmailAddress(u, furtherEmail, Locale.ENGLISH);
- TestMail mail = getMailReceiver().receive(furtherEmail);
+ new EmailAddress(u, furtherEmail, Locale.ENGLISH);
+ getMailReceiver().receive(furtherEmail);
try (GigiPreparedStatement stmt = new GigiPreparedStatement("UPDATE `emailPinglog` SET `status`='success'::`pingState`, `when` = (now() - interval '1 months' * ?::INTEGER) WHERE `email`=? ")) {
stmt.setInt(1, TimeConditions.getInstance().getEmailPingMonths());
stmt.setString(2, furtherEmail);
public void testPingPeriodTwoAddresses() throws IOException, GeneralSecurityException, GigiApiException {
// get new email address with last ping in past
String furtherEmail = createUniqueName() + "@example.org";
- EmailAddress ea = new EmailAddress(u, furtherEmail, Locale.ENGLISH);
- TestMail mail = getMailReceiver().receive(furtherEmail);
+ new EmailAddress(u, furtherEmail, Locale.ENGLISH);
+ getMailReceiver().receive(furtherEmail);
try (GigiPreparedStatement stmt = new GigiPreparedStatement("UPDATE `emailPinglog` SET `status`='success'::`pingState`, `when` = (now() - interval '1 months' * ?::INTEGER) WHERE `email`=? ")) {
stmt.setInt(1, TimeConditions.getInstance().getEmailPingMonths());
stmt.setString(2, furtherEmail);
ass.start();
System.out.println(port + " and " + port2 + " ready");
System.err.println(port + " and " + port2 + " ready");
- boolean accept2 = acceptSSLServer(sss2);
- boolean accept1 = ass.join();
+ acceptSSLServer(sss2);
+ ass.join();
// assertTrue(firstSucceeds ^ accept1);
boolean secondsSucceeds = sslVariant != 0;
// assertTrue(secondsSucceeds ^ accept2);