Reformat code using Eclipse Mars
This commit is contained in:
@@ -44,8 +44,7 @@ public class SpringLoadedTests {
|
||||
throws IOException {
|
||||
ProjectConnection project = new ProjectCreator()
|
||||
.createProject("spring-loaded-jvm-args");
|
||||
project.newBuild()
|
||||
.forTasks("bootRun")
|
||||
project.newBuild().forTasks("bootRun")
|
||||
.withArguments("-PbootVersion=" + BOOT_VERSION,
|
||||
"-PspringLoadedVersion=" + SPRING_LOADED_VERSION, "--stacktrace")
|
||||
.run();
|
||||
@@ -53,13 +52,13 @@ public class SpringLoadedTests {
|
||||
List<String> output = getOutput();
|
||||
assertOutputContains("-DSOME_ARG=someValue", output);
|
||||
assertOutputContains("-Xverify:none", output);
|
||||
assertOutputMatches(
|
||||
"-javaagent:.*springloaded-" + SPRING_LOADED_VERSION + ".jar", output);
|
||||
assertOutputMatches("-javaagent:.*springloaded-" + SPRING_LOADED_VERSION + ".jar",
|
||||
output);
|
||||
}
|
||||
|
||||
private List<String> getOutput() throws IOException {
|
||||
BufferedReader reader = new BufferedReader(new FileReader(new File(
|
||||
"target/spring-loaded-jvm-args/build/output.txt")));
|
||||
BufferedReader reader = new BufferedReader(new FileReader(
|
||||
new File("target/spring-loaded-jvm-args/build/output.txt")));
|
||||
try {
|
||||
List<String> lines = new ArrayList<String>();
|
||||
|
||||
|
||||
@@ -33,18 +33,20 @@ public final class Versions {
|
||||
}
|
||||
|
||||
public static String getBootVersion() {
|
||||
return evaluateExpression("/*[local-name()='project']/*[local-name()='version']"
|
||||
+ "/text()");
|
||||
return evaluateExpression(
|
||||
"/*[local-name()='project']/*[local-name()='version']" + "/text()");
|
||||
}
|
||||
|
||||
public static String getSpringLoadedVersion() {
|
||||
return evaluateExpression("/*[local-name()='project']/*[local-name()='properties']"
|
||||
+ "/*[local-name()='spring-loaded.version']/text()");
|
||||
return evaluateExpression(
|
||||
"/*[local-name()='project']/*[local-name()='properties']"
|
||||
+ "/*[local-name()='spring-loaded.version']/text()");
|
||||
}
|
||||
|
||||
public static String getSpringVersion() {
|
||||
return evaluateExpression("/*[local-name()='project']/*[local-name()='properties']"
|
||||
+ "/*[local-name()='spring.version']/text()");
|
||||
return evaluateExpression(
|
||||
"/*[local-name()='project']/*[local-name()='properties']"
|
||||
+ "/*[local-name()='spring.version']/text()");
|
||||
}
|
||||
|
||||
private static String evaluateExpression(String expression) {
|
||||
@@ -52,8 +54,8 @@ public final class Versions {
|
||||
XPathFactory xPathfactory = XPathFactory.newInstance();
|
||||
XPath xpath = xPathfactory.newXPath();
|
||||
XPathExpression expr = xpath.compile(expression);
|
||||
String version = expr.evaluate(new InputSource(new FileReader(
|
||||
"target/dependencies-pom.xml")));
|
||||
String version = expr.evaluate(
|
||||
new InputSource(new FileReader("target/dependencies-pom.xml")));
|
||||
return version;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
||||
@@ -85,10 +85,10 @@ public class WarPackagingTests {
|
||||
|
||||
private void checkWebInfEntriesForServletContainer(String servletContainer,
|
||||
Set<String> expectedLibProvidedEntries) throws IOException {
|
||||
project.newBuild()
|
||||
.forTasks("clean", "build")
|
||||
project.newBuild().forTasks("clean", "build")
|
||||
.withArguments("-PbootVersion=" + BOOT_VERSION,
|
||||
"-PservletContainer=" + servletContainer).run();
|
||||
"-PservletContainer=" + servletContainer)
|
||||
.run();
|
||||
|
||||
JarFile war = new JarFile("target/war-packaging/build/libs/war-packaging.war");
|
||||
|
||||
@@ -108,9 +108,8 @@ public class WarPackagingTests {
|
||||
throws IOException {
|
||||
Set<String> entries = getWebInfLibProvidedEntries(war);
|
||||
|
||||
assertEquals(
|
||||
"Expected " + expectedEntries.size() + " but found " + entries.size()
|
||||
+ ": " + entries, expectedEntries.size(), entries.size());
|
||||
assertEquals("Expected " + expectedEntries.size() + " but found " + entries.size()
|
||||
+ ": " + entries, expectedEntries.size(), entries.size());
|
||||
|
||||
List<String> unexpectedLibProvidedEntries = new ArrayList<String>();
|
||||
for (String entry : entries) {
|
||||
@@ -118,8 +117,10 @@ public class WarPackagingTests {
|
||||
unexpectedLibProvidedEntries.add(entry);
|
||||
}
|
||||
}
|
||||
assertTrue("Found unexpected entries in WEB-INF/lib-provided: "
|
||||
+ unexpectedLibProvidedEntries, unexpectedLibProvidedEntries.isEmpty());
|
||||
assertTrue(
|
||||
"Found unexpected entries in WEB-INF/lib-provided: "
|
||||
+ unexpectedLibProvidedEntries,
|
||||
unexpectedLibProvidedEntries.isEmpty());
|
||||
}
|
||||
|
||||
private void checkWebInfLibEntries(JarFile war, Set<String> entriesOnlyInLibProvided)
|
||||
@@ -170,7 +171,8 @@ public class WarPackagingTests {
|
||||
return name.startsWith(WEB_INF_LIB_PREFIX) && !name.equals(WEB_INF_LIB_PREFIX);
|
||||
}
|
||||
|
||||
private boolean isExpectedInWebInfLibProvided(String name, Set<String> expectedEntries) {
|
||||
private boolean isExpectedInWebInfLibProvided(String name,
|
||||
Set<String> expectedEntries) {
|
||||
for (String expected : expectedEntries) {
|
||||
if (name.startsWith(WEB_INF_LIB_PROVIDED_PREFIX + expected)) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user