Commit 2639f6f3 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

use build in admin account

parent 61a8a22f
......@@ -46,8 +46,6 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
private static final String TEST_USER_LOGIN = "test_user";
private static final String TEST_CURATOR_PASSWORD = "test_curator_pass";
private static final String TEST_CURATOR_LOGIN = "test_curator";
private static final String TEST_ADMIN_PASSWORD = "test_admin";
private static final String TEST_ADMIN_LOGIN = "test_admin";
Logger logger = LogManager.getLogger();
@Autowired
private LayoutDao layoutDao;
......@@ -78,7 +76,6 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testListOverlaysByCreator() throws Exception {
createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
User curator = createCurator(TEST_CURATOR_LOGIN, TEST_CURATOR_PASSWORD);
User user = createUser(TEST_USER_LOGIN, TEST_USER_PASSWORD);
......@@ -87,7 +84,7 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
createOverlay(project, curator);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/" + TEST_PROJECT + "/overlays/?creator=" + TEST_CURATOR_LOGIN)
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
......@@ -104,13 +101,11 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testListPublicOverlaysOverlaysWhenCreatorEmpty() throws Exception {
createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
Layout layout= createOverlay(project, null);
layout.setPublicLayout(true);
layoutDao.add(layout);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/" + TEST_PROJECT + "/overlays/?publicOverlay=true&creator=xxx")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
......@@ -127,16 +122,14 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testListNonPublicOverlaysOverlaysWhenCreatorEmpty() throws Exception {
createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
Layout layout= createOverlay(project, null);
layout.setPublicLayout(true);
layoutDao.add(layout);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get(
"/projects/" + TEST_PROJECT + "/overlays/?publicOverlay=false&creator=" + TEST_ADMIN_LOGIN)
"/projects/" + TEST_PROJECT + "/overlays/?publicOverlay=false&creator=" + BUILT_IN_TEST_ADMIN_LOGIN)
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
.session(session);
......@@ -151,7 +144,6 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testListOverlaysByPublicFlag() throws Exception {
createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
User curator = createCurator(TEST_CURATOR_LOGIN, TEST_CURATOR_PASSWORD);
createUser(TEST_USER_LOGIN, TEST_USER_PASSWORD);
......@@ -164,7 +156,7 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
curatorLayout.setPublicLayout(false);
layoutDao.add(curatorLayout);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/" + TEST_PROJECT + "/overlays/?publicOverlay=true")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
......@@ -257,11 +249,10 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testAdminCanAccessUserOverlay() throws Exception {
User user = createUser(TEST_USER_LOGIN, TEST_USER_PASSWORD, project);
createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
Layout overlay = createOverlay(project, user);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/" + TEST_PROJECT + "/overlays/" + overlay.getId() + "/")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
......@@ -308,7 +299,7 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testUserCannotAccessAnotherUserOverlay() throws Exception {
createUser(TEST_USER_LOGIN, TEST_USER_PASSWORD, project);
User admin = createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
User admin = userService.getUserByLogin(BUILT_IN_TEST_ADMIN_LOGIN);
Layout overlay = createOverlay(project, admin);
......@@ -324,11 +315,11 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testGetBioEntitiesForOverlay() throws Exception {
User admin = createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
User admin = userService.getUserByLogin(BUILT_IN_TEST_ADMIN_LOGIN);
Layout overlay = createOverlay(admin);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get(
"/projects/" + TEST_PROJECT + "/overlays/" + overlay.getId() + "/models/" + map.getId() + "/bioEntities/")
......@@ -395,11 +386,11 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testGetReactionsForOverlay() throws Exception {
User admin = createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
User admin = userService.getUserByLogin(BUILT_IN_TEST_ADMIN_LOGIN);
Layout overlay = createOverlay(admin);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get(
"/projects/" + TEST_PROJECT + "/overlays/" + overlay.getId() + "/models/" + map.getId()
......@@ -451,11 +442,11 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testGetElementsForOverlay() throws Exception {
User admin = createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
User admin = userService.getUserByLogin(BUILT_IN_TEST_ADMIN_LOGIN);
Layout overlay = createOverlay(admin);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get(
"/projects/" + TEST_PROJECT + "/overlays/" + overlay.getId() + "/models/" + map.getId()
......@@ -507,11 +498,11 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testAdminCreateOverlay() throws Exception {
User admin = createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
User admin = userService.getUserByLogin(BUILT_IN_TEST_ADMIN_LOGIN);
UploadedFileEntry file = createFile("elementIdentifier\tvalue\n\t-1", admin);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
String body = EntityUtils.toString(new UrlEncodedFormEntity(Arrays.asList(
new BasicNameValuePair("fileId", String.valueOf(file.getId())),
......@@ -640,12 +631,11 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testAdminCanRemoveOverlay() throws Exception {
createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
User user = createUser(TEST_USER_LOGIN, TEST_USER_PASSWORD);
Layout overlay = createOverlay(user);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = delete("/projects/" + TEST_PROJECT + "/overlays/" + overlay.getId())
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
......@@ -710,14 +700,13 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testAdminCanUpdateOverlay() throws Exception {
createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
User user = createUser(TEST_USER_LOGIN, TEST_USER_PASSWORD);
Layout overlay = createOverlay(user);
String body = "{\"overlay\":{}}";
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = patch("/projects/" + TEST_PROJECT + "/overlays/" + overlay.getId())
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
......@@ -786,12 +775,11 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testAdminCanAccessOverlaySource() throws Exception {
createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
User user = createUser(TEST_USER_LOGIN, TEST_USER_PASSWORD);
Layout overlay = createOverlay(user);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/" + TEST_PROJECT + "/overlays/" + overlay.getId() + ":downloadSource")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
......@@ -857,9 +845,9 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
User user = createAdmin(TEST_USER_LOGIN, TEST_USER_PASSWORD);
createOverlay(user);
User admin = createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
User admin = userService.getUserByLogin(BUILT_IN_TEST_ADMIN_LOGIN);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
UploadedFileEntry file = createFile("elementIdentifier\tvalue\n\t-1", admin);
String body = EntityUtils.toString(new UrlEncodedFormEntity(Arrays.asList(
......@@ -986,14 +974,12 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testDeprecatedOverlayInformation() throws Exception {
createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
Layout overlay = createOverlay(null,
"elementIdentifier\t" + ColorSchemaColumn.REACTION_IDENTIFIER + "\tvalue\n\t\t-1");
overlay.setPublicLayout(true);
layoutDao.update(overlay);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get(
"/projects/" + TEST_PROJECT + "/overlays/" + overlay.getId() + "/")
......@@ -1020,9 +1006,7 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testListOverlaysWithUnknownProject() throws Exception {
createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/*/overlays/")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
......@@ -1034,11 +1018,11 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testGetOverlayByIdWithUnknownProject() throws Exception {
User admin = createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
User admin = userService.getUserByLogin(BUILT_IN_TEST_ADMIN_LOGIN);
Layout overlay = createOverlay(admin);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/*/overlays/" + overlay.getId() + "/")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
......@@ -1050,11 +1034,11 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testGetBioEntitiesForOverlayWithUndefinedProject() throws Exception {
User admin = createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
User admin = userService.getUserByLogin(BUILT_IN_TEST_ADMIN_LOGIN);
Layout overlay = createOverlay(admin);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get(
"/projects/*/overlays/" + overlay.getId() + "/models/" + map.getId() + "/bioEntities/")
......@@ -1067,11 +1051,11 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testGetReactionsForOverlayWithUndefinedProject() throws Exception {
User admin = createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
User admin = userService.getUserByLogin(BUILT_IN_TEST_ADMIN_LOGIN);
Layout overlay = createOverlay(admin);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/*/overlays/" + overlay.getId() + "/models/" + map.getId()
+ "/bioEntities/reactions/" + reaction.getId() + "/")
......@@ -1084,11 +1068,11 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testGetElementsForOverlayWithUndefinedProject() throws Exception {
User admin = createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
User admin = userService.getUserByLogin(BUILT_IN_TEST_ADMIN_LOGIN);
Layout overlay = createOverlay(admin);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/*/overlays/" + overlay.getId() + "/models/" + map.getId()
+ "/bioEntities/elements/" + element.getId() + "/")
......@@ -1101,11 +1085,11 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testCreateOverlayWithUndefinedProjectId() throws Exception {
User admin = createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
User admin = userService.getUserByLogin(BUILT_IN_TEST_ADMIN_LOGIN);
UploadedFileEntry file = createFile("elementIdentifier\tvalue\n\t-1", admin);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
String body = EntityUtils.toString(new UrlEncodedFormEntity(Arrays.asList(
new BasicNameValuePair("fileId", String.valueOf(file.getId())),
......@@ -1126,11 +1110,11 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testRemoveOverlayWithUndefinedProject() throws Exception {
User admin = createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
User admin = userService.getUserByLogin(BUILT_IN_TEST_ADMIN_LOGIN);
Layout overlay = createOverlay(admin);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = delete("/projects/*/overlays/" + overlay.getId())
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
......@@ -1142,13 +1126,13 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testUpdateOverlayWithUndefinedProject() throws Exception {
User admin = createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
User admin = userService.getUserByLogin(BUILT_IN_TEST_ADMIN_LOGIN);
Layout overlay = createOverlay(admin);
String body = "{\"overlay\":{}}";
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = patch("/projects/*/overlays/" + overlay.getId())
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
......@@ -1161,11 +1145,11 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testAccessOverlaySourceWithUndefinedProject() throws Exception {
User admin = createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
User admin = userService.getUserByLogin(BUILT_IN_TEST_ADMIN_LOGIN);
Layout overlay = createOverlay(admin);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = get("/projects/*/overlays/" + overlay.getId() + ":downloadSource")
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
......@@ -1177,7 +1161,6 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testOrderAfterRemoveOverlay() throws Exception {
createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
User user = createUser(TEST_USER_LOGIN, TEST_USER_PASSWORD);
Layout overlay1 = createOverlay(user);
......@@ -1191,7 +1174,7 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
layoutDao.update(overlay2);
layoutDao.update(overlay3);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = delete("/projects/" + TEST_PROJECT + "/overlays/" + overlay2.getId())
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
......@@ -1205,8 +1188,6 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
@Test
public void testOrderAfterRemoveOverlayForPublicOverlay() throws Exception {
createAdmin(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
Layout overlay1 = createOverlay(null);
overlay1.setOrderIndex(1);
Layout overlay2 = createOverlay(null);
......@@ -1218,7 +1199,7 @@ public class OverlayControllerIntegrationTest extends ControllerIntegrationTest
layoutDao.update(overlay2);
layoutDao.update(overlay3);
MockHttpSession session = createSession(TEST_ADMIN_LOGIN, TEST_ADMIN_PASSWORD);
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
RequestBuilder request = delete("/projects/" + TEST_PROJECT + "/overlays/" + overlay2.getId())
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment