Upgrade to spring-javaformat 0.0.11

This commit is contained in:
Andy Wilkinson
2019-06-07 09:44:58 +01:00
parent d548c5ed31
commit 8f1be4cded
1940 changed files with 16814 additions and 28498 deletions

View File

@@ -48,28 +48,21 @@ public class HolidayEndpoint {
private HumanResourceService humanResourceService;
public HolidayEndpoint(HumanResourceService humanResourceService)
throws JDOMException, XPathFactoryConfigurationException,
XPathExpressionException {
throws JDOMException, XPathFactoryConfigurationException, XPathExpressionException {
this.humanResourceService = humanResourceService;
Namespace namespace = Namespace.getNamespace("hr", NAMESPACE_URI);
XPathFactory xPathFactory = XPathFactory.instance();
this.startDateExpression = xPathFactory.compile("//hr:StartDate",
Filters.element(), null, namespace);
this.endDateExpression = xPathFactory.compile("//hr:EndDate", Filters.element(),
null, namespace);
this.nameExpression = xPathFactory.compile(
"concat(//hr:FirstName,' ',//hr:LastName)", Filters.fstring(), null,
this.startDateExpression = xPathFactory.compile("//hr:StartDate", Filters.element(), null, namespace);
this.endDateExpression = xPathFactory.compile("//hr:EndDate", Filters.element(), null, namespace);
this.nameExpression = xPathFactory.compile("concat(//hr:FirstName,' ',//hr:LastName)", Filters.fstring(), null,
namespace);
}
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "HolidayRequest")
public void handleHolidayRequest(@RequestPayload Element holidayRequest)
throws Exception {
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);
}

View File

@@ -30,8 +30,7 @@ public class StubHumanResourceService implements HumanResourceService {
@Override
public void bookHoliday(Date startDate, Date endDate, String name) {
this.logger.info("Booking holiday for [{} - {}] for [{}] ", startDate, endDate,
name);
this.logger.info("Booking holiday for [{} - {}] for [{}] ", startDate, endDate, name);
}
}

View File

@@ -49,19 +49,16 @@ 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=\"https://company.example.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:FirstName>John</hr:FirstName>"
+ " <hr:LastName>Doe</hr:LastName>" + " </hr:Employee>"
+ "</hr:HolidayRequest>";
+ " <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:HolidayRequest>";
StreamSource source = new StreamSource(new StringReader(request));
StreamResult result = new StreamResult(System.out);
this.webServiceTemplate.sendSourceAndReceiveToResult(source, result);