Formatting

This commit is contained in:
spencergibb
2020-09-17 11:05:13 -04:00
parent 13518fb981
commit baa1bd4282
234 changed files with 2528 additions and 4269 deletions

View File

@@ -51,10 +51,8 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
// Normally spring.cloud.config.enabled:true is the default but since we have the
// config
// server on the classpath we need to set it explicitly
properties = { "spring.cloud.config.enabled:true", "",
"spring.config.use-legacy-processing=true",
"management.security.enabled=false",
"management.endpoints.web.exposure.include=*" },
properties = { "spring.cloud.config.enabled:true", "", "spring.config.use-legacy-processing=true",
"management.security.enabled=false", "management.endpoints.web.exposure.include=*" },
webEnvironment = RANDOM_PORT)
public class ApplicationBootstrapTests {
@@ -70,17 +68,13 @@ public class ApplicationBootstrapTests {
@BeforeClass
public static void startConfigServer() throws IOException {
System.setProperty("spring.cloud.bootstrap.name", "bootstrapservercomposite");
String baseDir = ConfigServerTestUtils
.getBaseDirectory("spring-cloud-config-sample");
String repo = ConfigServerTestUtils.prepareLocalRepo(baseDir, "target/repos",
"config-repo", "target/config");
String baseDir = ConfigServerTestUtils.getBaseDirectory("spring-cloud-config-sample");
String repo = ConfigServerTestUtils.prepareLocalRepo(baseDir, "target/repos", "config-repo", "target/config");
System.setProperty("repo1", repo);
server = SpringApplication.run(
org.springframework.cloud.config.server.ConfigServerApplication.class,
server = SpringApplication.run(org.springframework.cloud.config.server.ConfigServerApplication.class,
// FIXME: configdata why is use legacy needed here and above?
"--spring.config.use-legacy-processing=true",
"--server.port=" + configPort, "--spring.config.name=compositeserver",
"--repo1=" + repo);
"--spring.config.use-legacy-processing=true", "--server.port=" + configPort,
"--spring.config.name=compositeserver", "--repo1=" + repo);
System.setProperty("config.port", "" + configPort);
}
@@ -103,8 +97,8 @@ public class ApplicationBootstrapTests {
@Test
@SuppressWarnings("unchecked")
public void contextLoads() {
Map res = new TestRestTemplate().getForObject(
"http://localhost:" + this.port + BASE_PATH + "/env/info.foo", Map.class);
Map res = new TestRestTemplate().getForObject("http://localhost:" + this.port + BASE_PATH + "/env/info.foo",
Map.class);
assertThat(res).containsKey("propertySources");
Map<String, Object> property = (Map<String, Object>) res.get("property");
assertThat(property).containsEntry("value", "bar");

View File

@@ -29,16 +29,13 @@ public class ApplicationFailFastTests {
@Test
public void contextFails() {
try {
new SpringApplicationBuilder().sources(Application.class).run(
"--spring.config.use-legacy-processing=true", "--server.port=0",
"--spring.cloud.config.enabled=true",
"--spring.cloud.config.fail-fast=true",
new SpringApplicationBuilder().sources(Application.class).run("--spring.config.use-legacy-processing=true",
"--server.port=0", "--spring.cloud.config.enabled=true", "--spring.cloud.config.fail-fast=true",
"--spring.cloud.config.uri=http://serverhostdoesnotexist:1234");
fail("failFast option did not produce an exception");
}
catch (Exception e) {
assertThat(e.getMessage().contains("fail fast"))
.as("Exception not caused by fail fast").isTrue();
assertThat(e.getMessage().contains("fail fast")).as("Exception not caused by fail fast").isTrue();
}
}

View File

@@ -44,8 +44,7 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
// server on the classpath we need to set it explicitly
properties = { "spring.cloud.config.enabled:true",
// FIXME: configdata why is this needed here?
"spring.config.use-legacy-processing=true",
"management.security.enabled=false",
"spring.config.use-legacy-processing=true", "management.security.enabled=false",
"management.endpoints.web.exposure.include=*" },
webEnvironment = RANDOM_PORT)
public class ApplicationTests {
@@ -61,12 +60,9 @@ public class ApplicationTests {
@BeforeClass
public static void startConfigServer() throws IOException {
String baseDir = ConfigServerTestUtils
.getBaseDirectory("spring-cloud-config-sample");
String repo = ConfigServerTestUtils.prepareLocalRepo(baseDir, "target/repos",
"config-repo", "target/config");
server = SpringApplication.run(
org.springframework.cloud.config.server.ConfigServerApplication.class,
String baseDir = ConfigServerTestUtils.getBaseDirectory("spring-cloud-config-sample");
String repo = ConfigServerTestUtils.prepareLocalRepo(baseDir, "target/repos", "config-repo", "target/config");
server = SpringApplication.run(org.springframework.cloud.config.server.ConfigServerApplication.class,
"--server.port=" + configPort, "--spring.config.name=server",
"--spring.cloud.config.server.git.uri=" + repo);
/*
@@ -93,8 +89,8 @@ public class ApplicationTests {
@Test
@SuppressWarnings("unchecked")
public void contextLoads() {
Map res = new TestRestTemplate().getForObject(
"http://localhost:" + this.port + BASE_PATH + "/env/info.foo", Map.class);
Map res = new TestRestTemplate().getForObject("http://localhost:" + this.port + BASE_PATH + "/env/info.foo",
Map.class);
assertThat(res).containsKey("propertySources");
Map<String, Object> property = (Map<String, Object>) res.get("property");
assertThat(property).containsEntry("value", "bar");

View File

@@ -36,8 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class, properties = "spring.application.name:bad",
webEnvironment = RANDOM_PORT)
@SpringBootTest(classes = Application.class, properties = "spring.application.name:bad", webEnvironment = RANDOM_PORT)
public class ServerNativeApplicationTests {
private static int configPort = 0;
@@ -53,11 +52,9 @@ public class ServerNativeApplicationTests {
@BeforeClass
public static void startConfigServer() throws IOException {
String repo = ConfigServerTestUtils.prepareLocalRepo();
server = SpringApplication.run(
org.springframework.cloud.config.server.ConfigServerApplication.class,
server = SpringApplication.run(org.springframework.cloud.config.server.ConfigServerApplication.class,
"--server.port=" + configPort, "--spring.config.name=server",
"--spring.cloud.config.server.git.uri=" + repo,
"--spring.profiles.active=native");
"--spring.cloud.config.server.git.uri=" + repo, "--spring.profiles.active=native");
/*
* FIXME configPort = ((EmbeddedWebApplicationContext) server)
* .getEmbeddedServletContainer().getPort();