Merge branch '1.2.x'
This commit is contained in:
@@ -33,7 +33,8 @@ import org.springframework.xml.xsd.XsdSchema;
|
||||
public class WebServiceConfig extends WsConfigurerAdapter {
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean dispatcherServlet(ApplicationContext applicationContext) {
|
||||
public ServletRegistrationBean dispatcherServlet(
|
||||
ApplicationContext applicationContext) {
|
||||
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
|
||||
servlet.setApplicationContext(applicationContext);
|
||||
return new ServletRegistrationBean(servlet, "/services/*");
|
||||
|
||||
@@ -69,10 +69,10 @@ public class HolidayEndpoint {
|
||||
public void handleHolidayRequest(@RequestPayload Element holidayRequest)
|
||||
throws Exception {
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date startDate = dateFormat.parse(this.startDateExpression.evaluateFirst(
|
||||
holidayRequest).getText());
|
||||
Date endDate = dateFormat.parse(this.endDateExpression.evaluateFirst(
|
||||
holidayRequest).getText());
|
||||
Date startDate = dateFormat
|
||||
.parse(this.startDateExpression.evaluateFirst(holidayRequest).getText());
|
||||
Date endDate = dateFormat
|
||||
.parse(this.endDateExpression.evaluateFirst(holidayRequest).getText());
|
||||
String name = this.nameExpression.evaluateFirst(holidayRequest);
|
||||
|
||||
this.humanResourceService.bookHoliday(startDate, endDate, name);
|
||||
|
||||
@@ -51,22 +51,18 @@ public class SampleWsApplicationTests {
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
this.webServiceTemplate.setDefaultUri("http://localhost:" + this.serverPort
|
||||
+ "/services/");
|
||||
this.webServiceTemplate
|
||||
.setDefaultUri("http://localhost:" + this.serverPort + "/services/");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSendingHolidayRequest() {
|
||||
final String request = "<hr:HolidayRequest xmlns:hr=\"http://mycompany.com/hr/schemas\">"
|
||||
+ " <hr:Holiday>"
|
||||
+ " <hr:StartDate>2013-10-20</hr:StartDate>"
|
||||
+ " <hr:EndDate>2013-11-22</hr:EndDate>"
|
||||
+ " </hr:Holiday>"
|
||||
+ " <hr:Employee>"
|
||||
+ " <hr:Number>1</hr:Number>"
|
||||
+ " <hr:Holiday>" + " <hr:StartDate>2013-10-20</hr:StartDate>"
|
||||
+ " <hr:EndDate>2013-11-22</hr:EndDate>" + " </hr:Holiday>"
|
||||
+ " <hr:Employee>" + " <hr:Number>1</hr:Number>"
|
||||
+ " <hr:FirstName>John</hr:FirstName>"
|
||||
+ " <hr:LastName>Doe</hr:LastName>"
|
||||
+ " </hr:Employee>"
|
||||
+ " <hr:LastName>Doe</hr:LastName>" + " </hr:Employee>"
|
||||
+ "</hr:HolidayRequest>";
|
||||
|
||||
StreamSource source = new StreamSource(new StringReader(request));
|
||||
|
||||
Reference in New Issue
Block a user