Fix Windows-related build issues

- Increase max heap size in gradle wrapper.
- Use MockProperties implementation to protect against security
  exceptions.
- Replace windows CRLF with LF in various tests.
- Increase Thread.sleep times to account for lack of precision on
  Windows.

Issue: SPR-9717
This commit is contained in:
Phillip Webb
2012-09-07 11:49:06 -07:00
committed by Chris Beams
parent 94bb036269
commit 8e7622bb8a
7 changed files with 114 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2009 the original author or authors.
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -321,6 +321,7 @@ public class FreeMarkerMacroTests {
ClassPathResource resource = new ClassPathResource("test.ftl", getClass());
assertTrue(resource.exists());
String all = FileCopyUtils.copyToString(new InputStreamReader(resource.getInputStream()));
all = all.replace("\r\n", "\n");
String[] macros = StringUtils.delimitedListToStringArray(all, "\n\n");
for (String macro : macros) {
if (macro.startsWith(name)) {

View File

@@ -156,7 +156,7 @@ public class MappingJackson2JsonViewTests {
view.setPrettyPrint(true);
view.render(model, request, response);
String result = response.getContentAsString();
String result = response.getContentAsString().replace("\r\n", "\n");
assertTrue("Pretty printing not applied:\n" + result, result.startsWith("{\n \"foo\" : {\n "));
validateResult();

View File

@@ -149,7 +149,7 @@ public class MappingJacksonJsonViewTests {
view.setPrettyPrint(true);
view.render(model, request, response);
String result = response.getContentAsString();
String result = response.getContentAsString().replace("\r\n", "\n");
assertTrue("Pretty printing not applied:\n" + result, result.startsWith("{\n \"foo\" : {\n "));
validateResult();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2007 the original author or authors.
* Copyright 2002-2012 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -53,7 +53,7 @@ public class VelocityRenderTests {
private MockHttpServletRequest request;
private MockHttpServletResponse response;
@Rule
public ExpectedException thrown = ExpectedException.none();
@@ -95,12 +95,12 @@ public class VelocityRenderTests {
Map<String,Object> model = new HashMap<String,Object>();
model.put("command", new TestBean("juergen", 99));
view.render(model, request, response);
assertEquals("\nNAME\njuergen\n", response.getContentAsString());
assertEquals("\nNAME\njuergen\n", response.getContentAsString().replace("\r\n", "\n"));
}
@Test
@Ignore // This works with Velocity 1.6.2
@Ignore // This works with Velocity 1.6.2
public void testSimpleRenderWithError() throws Exception {
thrown.expect(NestedServletException.class);
@@ -111,10 +111,10 @@ public class VelocityRenderTests {
}
public void describeTo(Description description) {
description.appendText("exception has cause of MethodInvocationException");
}
});
});
VelocityConfigurer vc = new VelocityConfigurer();
vc.setPreferFileSystemAccess(false);
vc.setVelocityPropertiesMap(Collections.<String,Object>singletonMap("runtime.references.strict", "true"));
@@ -143,10 +143,10 @@ public class VelocityRenderTests {
}
public void describeTo(Description description) {
description.appendText("exception has cause of IOException");
}
});
});
VelocityConfigurer vc = new VelocityConfigurer();
vc.setPreferFileSystemAccess(false);
vc.setVelocityPropertiesMap(Collections.<String,Object>singletonMap("runtime.references.strict", "true"));