- private void passCATS(User u) {
- GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("INSERT INTO cats_passed SET user_id=?, variant_id=3");
- ps.setInt(1, u.getId());
- ps.execute();
+ private User createAssurer(int i) throws GigiApiException, IllegalAccessException {
+ try (GigiPreparedStatement ps = new GigiPreparedStatement("INSERT INTO `notary` SET `from`=?, `to`=?, `points`=?, `location`=?, `date`=?, `country`=?")) {
+ String mail = "test-assurer" + i + "@example.com";
+ User u = User.getByEmail(mail);
+ if (u == null) {
+ System.out.println("Creating RA-Agent");
+ createUser(mail);
+ u = User.getByEmail(mail);
+ passCATS(u, CATSType.ASSURER_CHALLENGE);
+ ps.setInt(1, u.getId());
+ ps.setInt(2, u.getPreferredName().getId());
+ ps.setInt(3, 100);
+ ps.setString(4, "Manager init code");
+ ps.setString(5, "1990-01-01");
+ ps.setString(6, getRandomCountry().getCode());
+ ps.execute();
+ }
+ return u;
+ }
+ }
+
+ private void passCATS(User u, CATSType t) {
+ CATS.enterResult(u, t, new Date(System.currentTimeMillis()), "en_EN", "1");