Polish contribution
Closes gh-6367
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
@@ -36,6 +36,7 @@ import static org.junit.Assert.assertTrue;
|
||||
* Integration test for {@link JarCommand}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class JarCommandIT {
|
||||
|
||||
@@ -98,12 +99,16 @@ public class JarCommandIT {
|
||||
|
||||
assertThat(invocation.getErrorOutput(), equalTo(""));
|
||||
assertThat(invocation.getStandardOutput(), containsString("Hello World!"));
|
||||
assertThat(invocation.getStandardOutput(), containsString("/public/public.txt"));
|
||||
assertThat(invocation.getStandardOutput(),
|
||||
containsString("/resources/resource.txt"));
|
||||
assertThat(invocation.getStandardOutput(), containsString("/static/static.txt"));
|
||||
containsString("/BOOT-INF/classes!/public/public.txt"));
|
||||
assertThat(invocation.getStandardOutput(),
|
||||
containsString("/templates/template.txt"));
|
||||
containsString("/BOOT-INF/classes!/resources/resource.txt"));
|
||||
assertThat(invocation.getStandardOutput(),
|
||||
containsString("/BOOT-INF/classes!/static/static.txt"));
|
||||
assertThat(invocation.getStandardOutput(),
|
||||
containsString("/BOOT-INF/classes!/templates/template.txt"));
|
||||
assertThat(invocation.getStandardOutput(),
|
||||
containsString("/BOOT-INF/classes!/root.properties"));
|
||||
assertThat(invocation.getStandardOutput(), containsString("Goodbye Mama"));
|
||||
}
|
||||
|
||||
|
||||
@@ -16,16 +16,16 @@
|
||||
|
||||
package org.springframework.boot.cli;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.cli.command.archive.WarCommand;
|
||||
import org.springframework.boot.cli.infrastructure.CommandLineInvoker;
|
||||
import org.springframework.boot.cli.infrastructure.CommandLineInvoker.Invocation;
|
||||
import org.springframework.boot.loader.tools.JavaExecutable;
|
||||
import org.springframework.util.SocketUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
@@ -57,27 +57,8 @@ public class WarCommandIT {
|
||||
assertThat(invocation.getOutput())
|
||||
.contains("/WEB-INF/lib-provided/tomcat-embed-core");
|
||||
assertThat(invocation.getOutput())
|
||||
.contains("/WEB-INF/lib-provided/tomcat-embed-core");
|
||||
.contains("WEB-INF/classes!/root.properties");
|
||||
process.destroy();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resourcesAreCopiedToWebInfClasses() throws Exception {
|
||||
File war = new File("target/test-app.war");
|
||||
Invocation invocation = this.cli.invoke("war", war.getAbsolutePath(),
|
||||
"war.groovy");
|
||||
invocation.await();
|
||||
assertThat(war.exists()).isTrue();
|
||||
|
||||
ZipFile warFile = new ZipFile(war.getAbsolutePath());
|
||||
try {
|
||||
assertThat(warFile.getEntry("application.properties")).isNull();
|
||||
assertThat(warFile.getEntry("WEB-INF/classes/application.properties")).isNotNull();
|
||||
}
|
||||
finally {
|
||||
warFile.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class Example implements CommandLineRunner {
|
||||
println getClass().getResource('/resources/resource.txt')
|
||||
println getClass().getResource('/static/static.txt')
|
||||
println getClass().getResource('/templates/template.txt')
|
||||
println getClass().getResource('/root.properties')
|
||||
println template('template.txt', [world:'Mama'])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ class WarExample implements CommandLineRunner {
|
||||
|
||||
void run(String... args) {
|
||||
println getClass().getResource('/org/apache/tomcat/InstanceManager.class')
|
||||
println getClass().getResource('/root.properties')
|
||||
throw new RuntimeException("onStart error")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user