Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add project for SPR-9964

  • Loading branch information...
commit b87d3d4b28d76b4edf4829487e9fe18c5d7af0b4 1 parent 6a5277e
@rstoyanchev rstoyanchev authored
Showing with 655 additions and 0 deletions.
  1. +223 −0 SPR-9964/pom.xml
  2. 0  SPR-9964/src/main/java/org/springframework/issues/.gitignore
  3. +28 −0 SPR-9964/src/main/java/org/springframework/issues/test/AbstractTestController.java
  4. +11 −0 SPR-9964/src/main/java/org/springframework/issues/test/Identifiable.java
  5. +46 −0 SPR-9964/src/main/java/org/springframework/issues/test/TestDTO.java
  6. +11 −0 SPR-9964/src/main/java/org/springframework/issues/test/TestingController.java
  7. +28 −0 SPR-9964/src/main/java/org/springframework/issues/test2/AbstractTest2Controller.java
  8. +11 −0 SPR-9964/src/main/java/org/springframework/issues/test2/Identifiable2.java
  9. +46 −0 SPR-9964/src/main/java/org/springframework/issues/test2/Test2DTO.java
  10. +11 −0 SPR-9964/src/main/java/org/springframework/issues/test2/Testing2Controller.java
  11. +7 −0 SPR-9964/src/main/resources/log4j.properties
  12. +9 −0 SPR-9964/src/main/webapp/WEB-INF/spring/root-context.xml
  13. +22 −0 SPR-9964/src/main/webapp/WEB-INF/spring/servlet-context.xml
  14. +11 −0 SPR-9964/src/main/webapp/WEB-INF/views/home.jsp
  15. +36 −0 SPR-9964/src/main/webapp/WEB-INF/web.xml
  16. 0  SPR-9964/src/test/java/org/springframework/issues/.gitignore
  17. +74 −0 SPR-9964/src/test/java/org/springframework/issues/test/TestControllerTests.java
  18. +74 −0 SPR-9964/src/test/java/org/springframework/issues/test2/Test2ControllerTests.java
  19. +7 −0 SPR-9964/src/test/resources/log4j.properties
View
223 SPR-9964/pom.xml
@@ -0,0 +1,223 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.springframework.issues</groupId>
+ <artifactId>SPR-9964</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>Spring MVC Issue Reproduction Project</name>
+ <packaging>war</packaging>
+
+ <properties>
+ <java-version>1.6</java-version>
+ <org.springframework-version>3.2.0.BUILD-SNAPSHOT</org.springframework-version>
+ <org.slf4j-version>1.6.1</org.slf4j-version>
+ </properties>
+
+ <dependencies>
+ <!-- Spring Framework -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <version>${org.springframework-version}</version>
+ <exclusions>
+ <!-- Exclude Commons Logging in favor of SLF4j -->
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc</artifactId>
+ <version>${org.springframework-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>${org.springframework-version}</version>
+ </dependency>
+
+ <!-- Logging -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${org.slf4j-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>${org.slf4j-version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>${org.slf4j-version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.16</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <!-- Servlet API -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- JSP API and JSTL
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.2</version>
+ </dependency>
+ -->
+
+ <!-- Apache Tiles
+ <dependency>
+ <groupId>org.apache.tiles</groupId>
+ <artifactId>tiles-jsp</artifactId>
+ <version>2.1.3</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ -->
+
+ <!-- JSR 303 with Hibernate Validator
+ <dependency>
+ <groupId>javax.validation</groupId>
+ <artifactId>validation-api</artifactId>
+ <version>1.0.0.GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-validator</artifactId>
+ <version>4.1.0.Final</version>
+ </dependency>
+ -->
+
+ <!-- Joda Time Library
+ <dependency>
+ <groupId>joda-time</groupId>
+ <artifactId>joda-time</artifactId>
+ <version>1.6.2</version>
+ </dependency>
+ <dependency>
+ <groupId>joda-time</groupId>
+ <artifactId>joda-time-jsptags</artifactId>
+ <version>1.0.2</version>
+ <scope>runtime</scope>
+ </dependency>
+ -->
+
+ <!-- Apache Commons File Upload
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.2.2</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ -->
+
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ <version>1.8.1</version>
+ </dependency>
+
+ <!-- Rome Atom+RSS
+ <dependency>
+ <groupId>rome</groupId>
+ <artifactId>rome</artifactId>
+ <version>1.0</version>
+ </dependency>
+ -->
+
+ <!-- Test -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <id>spring-maven-snapshot</id>
+ <name>Springframework Maven Snapshot Repository</name>
+ <url>http://repo.springsource.org/snapshot</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>${java-version}</source>
+ <target>${java-version}</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>install</id>
+ <phase>install</phase>
+ <goals>
+ <goal>sources</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <version>2.8</version>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ <downloadJavadocs>false</downloadJavadocs>
+ <wtpversion>2.0</wtpversion>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/*Tests.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/*Abstract*.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
+
View
0  SPR-9964/src/main/java/org/springframework/issues/.gitignore
No changes.
View
28 SPR-9964/src/main/java/org/springframework/issues/test/AbstractTestController.java
@@ -0,0 +1,28 @@
+package org.springframework.issues.test;
+
+import java.util.List;
+
+import org.springframework.http.HttpEntity;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+public abstract class AbstractTestController<DTO extends Identifiable> {
+
+ @RequestMapping(value = "/test", method = RequestMethod.POST)
+ public @ResponseBody DTO test(@RequestBody DTO dto) {
+ return dto;
+ }
+
+ @RequestMapping(value = "/testList", method = RequestMethod.POST)
+ public @ResponseBody List<DTO> test(@RequestBody List<DTO> dtoList) {
+ return dtoList;
+ }
+
+ @RequestMapping(value = "/testHttpEntity", method = RequestMethod.POST)
+ public @ResponseBody DTO test(HttpEntity<DTO> responseEntity) {
+ return responseEntity.getBody();
+ }
+
+}
View
11 SPR-9964/src/main/java/org/springframework/issues/test/Identifiable.java
@@ -0,0 +1,11 @@
+package org.springframework.issues.test;
+
+import java.io.Serializable;
+
+public interface Identifiable extends Serializable
+{
+ public Long getId();
+
+ public void setId(Long id);
+
+}
View
46 SPR-9964/src/main/java/org/springframework/issues/test/TestDTO.java
@@ -0,0 +1,46 @@
+package org.springframework.issues.test;
+
+public class TestDTO implements Identifiable {
+
+ private static final long serialVersionUID = -1518868790807131221L;
+
+ private Long id;
+ private String value1;
+ private String value2;
+
+ public String getValue1() {
+ return value1;
+ }
+
+ public void setValue1(String value1) {
+ this.value1 = value1;
+ }
+
+ public String getValue2() {
+ return value2;
+ }
+
+ public void setValue2(String value2) {
+ this.value2 = value2;
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("TestDTO[");
+ sb.append("value1=").append(value1);
+ sb.append(",value2=").append(value2);
+ sb.append("]");
+ return sb.toString();
+ }
+
+ @Override
+ public Long getId() {
+ return id;
+ }
+
+ @Override
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+}
View
11 SPR-9964/src/main/java/org/springframework/issues/test/TestingController.java
@@ -0,0 +1,11 @@
+package org.springframework.issues.test;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@Controller
+@RequestMapping(value = "testcontroller")
+public class TestingController extends AbstractTestController<TestDTO>
+{
+
+}
View
28 SPR-9964/src/main/java/org/springframework/issues/test2/AbstractTest2Controller.java
@@ -0,0 +1,28 @@
+package org.springframework.issues.test2;
+
+import java.util.List;
+
+import org.springframework.http.HttpEntity;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+public abstract class AbstractTest2Controller<DTO extends Identifiable2<T>, T> {
+
+ @RequestMapping(value = "/test2", method = RequestMethod.POST)
+ public @ResponseBody DTO test(@RequestBody DTO dto) {
+ return dto;
+ }
+
+ @RequestMapping(value = "/test2List", method = RequestMethod.POST)
+ public @ResponseBody List<DTO> test(@RequestBody List<DTO> dtoList) {
+ return dtoList;
+ }
+
+ @RequestMapping(value = "/test2HttpEntity", method = RequestMethod.POST)
+ public @ResponseBody DTO test(HttpEntity<DTO> responseEntity) {
+ return responseEntity.getBody();
+ }
+
+}
View
11 SPR-9964/src/main/java/org/springframework/issues/test2/Identifiable2.java
@@ -0,0 +1,11 @@
+package org.springframework.issues.test2;
+
+import java.io.Serializable;
+
+public interface Identifiable2<T> extends Serializable
+{
+ public T getId();
+
+ public void setId(T id);
+
+}
View
46 SPR-9964/src/main/java/org/springframework/issues/test2/Test2DTO.java
@@ -0,0 +1,46 @@
+package org.springframework.issues.test2;
+
+public class Test2DTO implements Identifiable2<Long> {
+
+ private static final long serialVersionUID = -1518868790807131221L;
+
+ private Long id;
+ private String value1;
+ private String value2;
+
+ public String getValue1() {
+ return value1;
+ }
+
+ public void setValue1(String value1) {
+ this.value1 = value1;
+ }
+
+ public String getValue2() {
+ return value2;
+ }
+
+ public void setValue2(String value2) {
+ this.value2 = value2;
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("TestDTO[");
+ sb.append("value1=").append(value1);
+ sb.append(",value2=").append(value2);
+ sb.append("]");
+ return sb.toString();
+ }
+
+ @Override
+ public Long getId() {
+ return id;
+ }
+
+ @Override
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+}
View
11 SPR-9964/src/main/java/org/springframework/issues/test2/Testing2Controller.java
@@ -0,0 +1,11 @@
+package org.springframework.issues.test2;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@Controller
+@RequestMapping(value = "testcontroller2")
+public class Testing2Controller extends AbstractTest2Controller<Test2DTO,Long>
+{
+
+}
View
7 SPR-9964/src/main/resources/log4j.properties
@@ -0,0 +1,7 @@
+log4j.rootCategory=INFO, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
+
+log4j.category.org.springframework.web=DEBUG
View
9 SPR-9964/src/main/webapp/WEB-INF/spring/root-context.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
+
+ <!-- Root Context: defines shared resources visible to all other web components -->
+
+</beans>
View
22 SPR-9964/src/main/webapp/WEB-INF/spring/servlet-context.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:mvc="http://www.springframework.org/schema/mvc"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">
+
+ <mvc:annotation-driven />
+
+ <mvc:view-controller path="/" view-name="home" />
+
+ <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
+ <property name="prefix" value="/WEB-INF/views/" />
+ <property name="suffix" value=".jsp" />
+ </bean>
+
+ <context:component-scan base-package="org.springframework.issues" />
+
+</beans>
View
11 SPR-9964/src/main/webapp/WEB-INF/views/home.jsp
@@ -0,0 +1,11 @@
+<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Home</title>
+</head>
+<body>
+ <h1>Home</h1>
+</body>
+</html>
View
36 SPR-9964/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+ <context-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>/WEB-INF/spring/root-context.xml</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+ </listener>
+
+ <servlet>
+ <servlet-name>appServlet</servlet-name>
+ <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+ <init-param>
+ <param-name>contextConfigLocation</param-name>
+ <param-value>/WEB-INF/spring/servlet-context.xml</param-value>
+ </init-param>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>appServlet</servlet-name>
+ <url-pattern>/</url-pattern>
+ </servlet-mapping>
+
+ <!-- Disables Servlet Container welcome file handling. Needed for compatibility
+ with Servlet 3.0 and Tomcat 7.0 -->
+ <welcome-file-list>
+ <welcome-file></welcome-file>
+ </welcome-file-list>
+
+</web-app>
View
0  SPR-9964/src/test/java/org/springframework/issues/.gitignore
No changes.
View
74 SPR-9964/src/test/java/org/springframework/issues/test/TestControllerTests.java
@@ -0,0 +1,74 @@
+package org.springframework.issues.test;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup;
+
+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;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.web.context.WebApplicationContext;
+
+@WebAppConfiguration
+@ContextConfiguration("file:src/main/webapp/WEB-INF/spring/servlet-context.xml")
+@RunWith(SpringJUnit4ClassRunner.class)
+public class TestControllerTests {
+
+ @Autowired
+ private WebApplicationContext wac;
+
+ private MockMvc mockMvc;
+
+ @Before
+ public void setup() {
+ this.mockMvc = webAppContextSetup(wac)
+ .defaultRequest(get("/").contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
+ .build();
+ }
+
+ @Test
+ public void testDto() throws Exception {
+
+ String jsonContent = "{\"id\":1,\"value1\":\"foo\",\"value2\":\"bar\"}";
+
+ this.mockMvc.perform(post("/testcontroller/test")
+ .content(jsonContent))
+ .andExpect(status().isOk())
+ .andExpect(content().string(jsonContent));
+ }
+
+ @Test
+ public void testDtoLists() throws Exception {
+
+ String jsonContent =
+ "[{\"id\":1,\"value1\":\"foo1\",\"value2\":\"bar1\"}," +
+ "{\"id\":2,\"value1\":\"foo2\",\"value2\":\"bar2\"}," +
+ "{\"id\":3,\"value1\":\"foo3\",\"value2\":\"bar3\"}]";
+
+ this.mockMvc.perform(post("/testcontroller/testList")
+ .content(jsonContent))
+ .andExpect(status().isOk())
+ .andExpect(content().string(jsonContent));
+ }
+
+
+ @Test
+ public void testHttpEntity() throws Exception {
+
+ String jsonContent = "{\"id\":1,\"value1\":\"foo\",\"value2\":\"bar\"}";
+
+ this.mockMvc.perform(post("/testcontroller/testHttpEntity")
+ .content(jsonContent))
+ .andExpect(status().isOk())
+ .andExpect(content().string(jsonContent));
+ }
+
+}
View
74 SPR-9964/src/test/java/org/springframework/issues/test2/Test2ControllerTests.java
@@ -0,0 +1,74 @@
+package org.springframework.issues.test2;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup;
+
+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;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.WebAppConfiguration;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.web.context.WebApplicationContext;
+
+@WebAppConfiguration
+@ContextConfiguration("file:src/main/webapp/WEB-INF/spring/servlet-context.xml")
+@RunWith(SpringJUnit4ClassRunner.class)
+public class Test2ControllerTests {
+
+ @Autowired
+ private WebApplicationContext wac;
+
+ private MockMvc mockMvc;
+
+ @Before
+ public void setup() {
+ this.mockMvc = webAppContextSetup(wac)
+ .defaultRequest(get("/").contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
+ .build();
+ }
+
+ @Test
+ public void testDto() throws Exception {
+
+ String jsonContent = "{\"id\":1,\"value1\":\"foo\",\"value2\":\"bar\"}";
+
+ this.mockMvc.perform(post("/testcontroller2/test2")
+ .content(jsonContent))
+ .andExpect(status().isOk())
+ .andExpect(content().string(jsonContent));
+ }
+
+ @Test
+ public void testDtoLists() throws Exception {
+
+ String jsonContent =
+ "[{\"id\":1,\"value1\":\"foo1\",\"value2\":\"bar1\"}," +
+ "{\"id\":2,\"value1\":\"foo2\",\"value2\":\"bar2\"}," +
+ "{\"id\":3,\"value1\":\"foo3\",\"value2\":\"bar3\"}]";
+
+ this.mockMvc.perform(post("/testcontroller2/test2List")
+ .content(jsonContent))
+ .andExpect(status().isOk())
+ .andExpect(content().string(jsonContent));
+ }
+
+
+ @Test
+ public void testHttpEntity() throws Exception {
+
+ String jsonContent = "{\"id\":1,\"value1\":\"foo\",\"value2\":\"bar\"}";
+
+ this.mockMvc.perform(post("/testcontroller2/test2HttpEntity")
+ .content(jsonContent))
+ .andExpect(status().isOk())
+ .andExpect(content().string(jsonContent));
+ }
+
+}
View
7 SPR-9964/src/test/resources/log4j.properties
@@ -0,0 +1,7 @@
+log4j.rootCategory=INFO, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
+
+log4j.category.org.springframework.web=DEBUG
Please sign in to comment.
Something went wrong with that request. Please try again.