+ public int createAssuranceUser(String firstName, String lastName,
+ String email, String password) {
+ int uid = createVerifiedUser(firstName, lastName, email, password);
+ // TODO make him pass CATS and be assured for 100 points
+ return uid;
+ }
+ static int count = 0;
+ public String createUniqueName() {
+ return "test" + System.currentTimeMillis() + "a" + (count++);
+ }
+ public String login(String email, String pw) throws IOException {
+ URL u = new URL("https://" + getServerName() + "/login");
+ HttpURLConnection huc = (HttpURLConnection) u.openConnection();
+ huc.setDoOutput(true);
+ OutputStream os = huc.getOutputStream();
+ String data = "username=" + URLEncoder.encode(email, "UTF-8")
+ + "&password=" + URLEncoder.encode(pw, "UTF-8");
+ os.write(data.getBytes());
+ os.flush();
+ String headerField = huc.getHeaderField("Set-Cookie");
+ headerField = headerField.substring(0, headerField.indexOf(';'));
+ return headerField;
+ }