import static org.junit.Assert.*;
-import java.io.IOException;
import java.sql.SQLException;
import java.util.Date;
import org.cacert.gigi.GigiApiException;
import org.cacert.gigi.database.GigiPreparedStatement;
import org.cacert.gigi.dbObjects.Assurance.AssuranceType;
+import org.cacert.gigi.dbObjects.ObjectCache;
import org.cacert.gigi.dbObjects.User;
import org.cacert.gigi.output.DateSelector;
-import org.cacert.gigi.testUtils.ManagedTest;
+import org.cacert.gigi.testUtils.BusinessTest;
import org.junit.Test;
-public class TestNotary extends ManagedTest {
+public class TestNotary extends BusinessTest {
// These tests create a lot of users and therefore require resetting of the
// registering-rate-limit.
@Test
public void testNormalAssurance() throws SQLException, GigiApiException {
- try {
- clearCaches();
- } catch (IOException e) {
- throw new Error(e);
- }
User[] users = new User[30];
for (int i = 0; i < users.length; i++) {
int id = createVerifiedUser("fn" + i, "ln" + i, createUniqueName() + "@email.org", TEST_PASSWORD);
@Test
public void testPoJam() throws SQLException, GigiApiException {
- try {
- clearCaches();
- } catch (IOException e) {
- throw new Error(e);
- }
User[] users = new User[30];
for (int i = 0; i < users.length; i++) {
int id = createVerifiedUser("fn" + i, "ln" + i, createUniqueName() + "@email.org", TEST_PASSWORD);
ps.setInt(1, id);
ps.execute();
}
+ ObjectCache.clearAllCaches(); // reload values from db
User assurer = User.getById(id);
for (int i = 0; i < users.length; i++) {
assuranceFail(assurer, users[i], -1, "test-notary", "2014-01-01");