Skip to content
Snippets Groups Projects
Commit 5385640f authored by Piotr Gawron's avatar Piotr Gawron
Browse files

include only single threaded tests

parent f95cad48
No related branches found
No related tags found
2 merge requests!836Resolve "Implement Spring Security",!613WIP: New Minerva Security Layer
......@@ -4,17 +4,10 @@ import static org.junit.Assert.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Random;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.*;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
......@@ -27,11 +20,9 @@ import org.springframework.transaction.annotation.Transactional;
import com.google.gson.JsonParser;
import lcsb.mapviewer.model.Project;
import lcsb.mapviewer.model.cache.UploadedFileEntry;
import lcsb.mapviewer.model.security.PrivilegeType;
import lcsb.mapviewer.model.user.User;
import lcsb.mapviewer.persist.dao.ProjectDao;
import lcsb.mapviewer.persist.dao.cache.UploadedFileEntryDao;
import lcsb.mapviewer.services.interfaces.IUserService;
@RunWith(SpringJUnit4ClassRunner.class)
......@@ -49,9 +40,6 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
private static final String ADMIN_PASSWORD = "admin_pass";
private static final String ADMIN_LOGIN = "admin_user";
@Autowired
private UploadedFileEntryDao uploadedFileEntryDao;
@Autowired
private IUserService userService;
......@@ -63,37 +51,9 @@ public class ProjectControllerIntegrationTest extends ControllerIntegrationTest
@Before
public void setup() {
curator = createUser(CURATOR_LOGIN, CURATOR_PASSWORD);
userService.grantUserPrivilege(curator, PrivilegeType.IS_CURATOR);
admin = createUser(ADMIN_LOGIN, ADMIN_PASSWORD);
userService.grantUserPrivilege(admin, PrivilegeType.IS_ADMIN);
}
@Test
@Ignore("This test litter in the database")
// TODO
public void addProject() throws Exception {
byte[] fileContent = Files.readAllBytes(Paths.get("./src/test/resources/generic.xml"));
UploadedFileEntry fileEntry = new UploadedFileEntry();
fileEntry.setOriginalFileName("test_file");
fileEntry.setFileContent(fileContent);
fileEntry.setLength(Integer.MAX_VALUE);
fileEntry.setOwner(curator);
uploadedFileEntryDao.add(fileEntry);
String body = EntityUtils.toString(new UrlEncodedFormEntity(Arrays.asList(
new BasicNameValuePair("file-id", String.valueOf(fileEntry.getId())),
new BasicNameValuePair("mapCanvasType", "OPEN_LAYERS"),
new BasicNameValuePair("parser", "lcsb.mapviewer.converter.model.celldesigner.CellDesignerXmlParser"))));
RequestBuilder request = post("/projects/" + new Random().nextInt())
.contentType(MediaType.APPLICATION_FORM_URLENCODED)
.content(body)
.session(createSession(CURATOR_LOGIN, CURATOR_PASSWORD));
curator = createCurator(CURATOR_LOGIN, CURATOR_PASSWORD);
mockMvc.perform(request).andExpect(status().is2xxSuccessful());
Thread.sleep(5000);
admin = createAdmin(ADMIN_LOGIN, ADMIN_PASSWORD);
}
@Test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment