Commit 4ed468ec authored by Piotr Gawron's avatar Piotr Gawron
Browse files

transactional issue in file controller

parent 0aa0adbe
......@@ -10,6 +10,7 @@ import org.junit.runners.Suite.SuiteClasses;
CommentControllerIntegrationTest.class,
DrugControllerIntegrationTest.class,
FileControllerIntegrationTest.class,
FileControllerIntegrationTestWithoutTransaction.class,
MapControllerIntegrationTest.class,
MiRnaControllerIntegrationTest.class,
OverlayControllerIntegrationTest.class,
......
package lcsb.mapviewer.web;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import java.util.Arrays;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.mock.web.MockHttpSession;
import org.springframework.test.annotation.Rollback;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.web.servlet.RequestBuilder;
@RunWith(SpringJUnit4ClassRunner.class)
@Rollback
public class FileControllerIntegrationTestWithoutTransaction extends ControllerIntegrationTest {
private static final String BUILT_IN_TEST_ADMIN_PASSWORD = "admin";
private static final String BUILT_IN_TEST_ADMIN_LOGIN = "admin";
@Before
public void setup() {
}
@Test
public void appendToNonExistingFile() throws Exception {
MockHttpSession session = createSession(BUILT_IN_TEST_ADMIN_LOGIN, BUILT_IN_TEST_ADMIN_PASSWORD);
String body = EntityUtils.toString(new UrlEncodedFormEntity(Arrays.asList(
new BasicNameValuePair("id", "-1"),
new BasicNameValuePair("data", "test_content"))));
RequestBuilder request = post("/files/-1:uploadContent")
.content(body)
.session(session);
mockMvc.perform(request)
.andExpect(status().is4xxClientError());
}
}
Supports Markdown
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