Skip to content

Commit 4c23d2c

Browse files
committed
Merge pull request #31267 from vpavic
* gh-31267: Polish "Update smoke tests to avoid conflicts with NAME environment variable" Update smoke tests to avoid conflicts with NAME environment variable Closes gh-31267
2 parents bbb5966 + 0834dc5 commit 4c23d2c

File tree

19 files changed

+35
-35
lines changed

19 files changed

+35
-35
lines changed

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-aop/src/main/java/smoketest/aop/service/HelloWorldService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@
2222
@Component
2323
public class HelloWorldService {
2424

25-
@Value("${name:World}")
25+
@Value("${test.name:World}")
2626
private String name;
2727

2828
public String getHelloMessage() {
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
name: Phil
1+
test.name: Phil

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-aop/src/test/java/smoketest/aop/SampleAopApplicationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -60,7 +60,7 @@ void testDefaultSettings(CapturedOutput output) {
6060

6161
@Test
6262
void testCommandLineOverrides(CapturedOutput output) {
63-
SampleAopApplication.main(new String[] { "--name=Gordon" });
63+
SampleAopApplication.main(new String[] { "--test.name=Gordon" });
6464
assertThat(output).contains("Hello Gordon");
6565
}
6666

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jetty/src/main/java/smoketest/jetty/service/HelloWorldService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@
2222
@Component
2323
public class HelloWorldService {
2424

25-
@Value("${name:World}")
25+
@Value("${test.name:World}")
2626
private String name;
2727

2828
public String getHelloMessage() {

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-jetty10/src/main/java/smoketest/jetty10/service/HelloWorldService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@
2222
@Component
2323
public class HelloWorldService {
2424

25-
@Value("${name:World}")
25+
@Value("${test.name:World}")
2626
private String name;
2727

2828
public String getHelloMessage() {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
hello: Bonjour
1+
test.hello: Bonjour

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-profile/src/main/java/smoketest/profile/SampleProfileApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class SampleProfileApplication implements CommandLineRunner {
3030

3131
// Simple example shows how a command line spring application can execute an
3232
// injected bean service. Also demonstrates how you can use @Value to inject
33-
// command line args ('--name=whatever') or application properties
33+
// command line args ('--test.name=whatever') or application properties
3434

3535
@Autowired
3636
private MessageService helloWorldService;

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-profile/src/main/java/smoketest/profile/service/GenericService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,10 +24,10 @@
2424
@Profile({ "generic" })
2525
public class GenericService implements MessageService {
2626

27-
@Value("${hello:Hello}")
27+
@Value("${test.hello:Hello}")
2828
private String hello;
2929

30-
@Value("${name:World}")
30+
@Value("${test.name:World}")
3131
private String name;
3232

3333
@Override

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-profile/src/main/java/smoketest/profile/service/GoodbyeWorldService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@
2424
@Profile("goodbye")
2525
public class GoodbyeWorldService implements MessageService {
2626

27-
@Value("${name:World}")
27+
@Value("${test.name:World}")
2828
private String name;
2929

3030
@Override

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-profile/src/main/java/smoketest/profile/service/HelloWorldService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@
2424
@Profile({ "hello", "default" })
2525
public class HelloWorldService implements MessageService {
2626

27-
@Value("${name:World}")
27+
@Value("${test.name:World}")
2828
private String name;
2929

3030
@Override
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
name: Phil
1+
test.name: Phil
22

33
---
44

55
spring.config.activate.on-profile: goodbye | dev
6-
name: Everyone
6+
test.name: Everyone

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-profile/src/test/java/smoketest/profile/SampleProfileApplicationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void testGenericProfile(CapturedOutput output) {
6565
* This is a profile that requires a new environment property, and one which is
6666
* only overridden in the current working directory. That file also only contains
6767
* partial overrides, and the default application.yml should still supply the
68-
* "name" property.
68+
* "test.name" property.
6969
*/
7070
System.setProperty("spring.profiles.active", "generic");
7171
SampleProfileApplication.main();

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-simple/src/main/java/smoketest/simple/SampleSimpleApplication.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,7 +30,7 @@ public class SampleSimpleApplication implements CommandLineRunner {
3030

3131
// Simple example shows how a command line spring application can execute an
3232
// injected bean service. Also demonstrates how you can use @Value to inject
33-
// command line args ('--name=whatever') or application properties
33+
// command line args ('--test.name=whatever') or application properties
3434

3535
@Autowired
3636
private HelloWorldService helloWorldService;

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-simple/src/main/java/smoketest/simple/service/HelloWorldService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,10 +24,10 @@
2424
@Component
2525
public class HelloWorldService {
2626

27-
@Value("${name:World}")
27+
@Value("${test.name:World}")
2828
private String name;
2929

30-
@Value("${duration:10s}")
30+
@Value("${test.duration:10s}")
3131
private Duration duration;
3232

3333
public String getHelloMessage() {
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name=Phil
1+
test.name=Phil
22
sample.name=Andy
33

44
spring.banner.image.bitdepth=8

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-simple/src/test/java/smoketest/simple/SampleSimpleApplicationTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -60,7 +60,7 @@ void testDefaultSettings(CapturedOutput output) {
6060

6161
@Test
6262
void testCommandLineOverrides(CapturedOutput output) {
63-
SampleSimpleApplication.main(new String[] { "--name=Gordon", "--duration=1m" });
63+
SampleSimpleApplication.main(new String[] { "--test.name=Gordon", "--test.duration=1m" });
6464
assertThat(output).contains("Hello Gordon for 60 seconds");
6565
}
6666

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-testng/src/main/java/smoketest/testng/service/HelloWorldService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@
2222
@Component
2323
public class HelloWorldService {
2424

25-
@Value("${name:World}")
25+
@Value("${test.name:World}")
2626
private String name;
2727

2828
public String getHelloMessage() {

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-tomcat/src/main/java/smoketest/tomcat/service/HelloWorldService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@
2222
@Component
2323
public class HelloWorldService {
2424

25-
@Value("${name:World}")
25+
@Value("${test.name:World}")
2626
private String name;
2727

2828
public String getHelloMessage() {

spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-xml/src/main/java/smoketest/xml/service/HelloWorldService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@
2222
@Component
2323
public class HelloWorldService {
2424

25-
@Value("${name:World}")
25+
@Value("${test.name:World}")
2626
private String name;
2727

2828
public String getHelloMessage() {

0 commit comments

Comments
 (0)