Skip to content

Commit 76e8d10

Browse files
authored
Merge pull request eugenp#5903 from rozagerardo/geroza/BAEL-10845_subtask-part-1_BAEL-10354_migrateparent-boot-to-spring-boot-2.1_part-3
[BAEL-10845] | Upgrade set of modules to use boot 2.1 - part 3
2 parents 06d925e + 291abe3 commit 76e8d10

33 files changed

Lines changed: 73 additions & 191 deletions

File tree

‎parent-boot-2.0-temp/README.md‎

Lines changed: 0 additions & 2 deletions
This file was deleted.

‎parent-boot-2.0-temp/pom.xml‎

Lines changed: 0 additions & 85 deletions
This file was deleted.

‎pom.xml‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,6 @@
324324
<modules>
325325
<module>parent-boot-1</module>
326326
<module>parent-boot-2</module>
327-
<module>parent-boot-2.0-temp</module>
328327
<module>parent-spring-4</module>
329328
<module>parent-spring-5</module>
330329
<module>parent-java</module>
@@ -590,7 +589,6 @@
590589
<modules>
591590
<module>parent-boot-1</module>
592591
<module>parent-boot-2</module>
593-
<module>parent-boot-2.0-temp</module>
594592
<module>parent-spring-4</module>
595593
<module>parent-spring-5</module>
596594
<module>parent-java</module>
@@ -985,7 +983,6 @@
985983
<modules>
986984
<module>parent-boot-1</module>
987985
<module>parent-boot-2</module>
988-
<module>parent-boot-2.0-temp</module>
989986
<module>parent-spring-4</module>
990987
<module>parent-spring-5</module>
991988
<module>parent-java</module>
@@ -1038,7 +1035,6 @@
10381035
<modules>
10391036
<module>parent-boot-1</module>
10401037
<module>parent-boot-2</module>
1041-
<module>parent-boot-2.0-temp</module>
10421038
<module>parent-spring-4</module>
10431039
<module>parent-spring-5</module>
10441040
<module>parent-java</module>
@@ -1300,7 +1296,6 @@
13001296
<modules>
13011297
<module>parent-boot-1</module>
13021298
<module>parent-boot-2</module>
1303-
<module>parent-boot-2.0-temp</module>
13041299
<module>parent-spring-4</module>
13051300
<module>parent-spring-5</module>
13061301
<module>parent-java</module>
@@ -1536,7 +1531,6 @@
15361531
<modules>
15371532
<module>parent-boot-1</module>
15381533
<module>parent-boot-2</module>
1539-
<module>parent-boot-2.0-temp</module>
15401534
<module>parent-spring-4</module>
15411535
<module>parent-spring-5</module>
15421536
<module>parent-java</module>

‎spring-mvc-forms-thymeleaf/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22

33
- [Session Attributes in Spring MVC](http://www.baeldung.com/spring-mvc-session-attributes)
44
- [Binding a List in Thymeleaf](http://www.baeldung.com/thymeleaf-list)
5+

‎spring-mvc-forms-thymeleaf/pom.xml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
<description>spring forms examples using thymeleaf</description>
1010

1111
<parent>
12-
<artifactId>parent-boot-2.0-temp</artifactId>
12+
<artifactId>parent-boot-2</artifactId>
1313
<groupId>com.baeldung</groupId>
1414
<version>0.0.1-SNAPSHOT</version>
15-
<relativePath>../parent-boot-2.0-temp</relativePath>
15+
<relativePath>../parent-boot-2</relativePath>
1616
</parent>
1717

1818
<dependencies>

‎spring-rest-angular/pom.xml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
<packaging>war</packaging>
99

1010
<parent>
11-
<artifactId>parent-boot-2.0-temp</artifactId>
11+
<artifactId>parent-boot-2</artifactId>
1212
<groupId>com.baeldung</groupId>
1313
<version>0.0.1-SNAPSHOT</version>
14-
<relativePath>../parent-boot-2.0-temp</relativePath>
14+
<relativePath>../parent-boot-2</relativePath>
1515
</parent>
1616

1717
<dependencies>

‎spring-rest-angular/src/main/java/org/baeldung/web/main/Application.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
import org.springframework.context.annotation.Bean;
77
import org.springframework.context.annotation.Import;
88
import org.springframework.web.filter.ShallowEtagHeaderFilter;
9-
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
9+
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
1010

1111
@SpringBootApplication
1212
@EnableAutoConfiguration
1313
@Import(PersistenceConfig.class)
14-
public class Application extends WebMvcConfigurerAdapter {
14+
public class Application implements WebMvcConfigurer {
1515

1616
public static void main(String[] args) {
1717
SpringApplication.run(Application.class, args);
Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,66 @@
11
package org.baeldung.web.service;
22

3+
import static io.restassured.RestAssured.given;
4+
import static org.hamcrest.core.Is.is;
5+
import static org.hamcrest.core.IsCollectionContaining.hasItems;
6+
import static org.hamcrest.core.IsEqual.equalTo;
7+
38
import org.apache.commons.lang3.RandomStringUtils;
49
import org.baeldung.web.main.Application;
510
import org.junit.Test;
611
import org.junit.runner.RunWith;
712
import org.springframework.boot.test.context.SpringBootTest;
813
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
14+
import org.springframework.boot.web.server.LocalServerPort;
915
import org.springframework.test.context.junit4.SpringRunner;
1016

11-
import static io.restassured.RestAssured.given;
12-
import static org.hamcrest.core.Is.is;
13-
import static org.hamcrest.core.IsCollectionContaining.hasItems;
14-
import static org.hamcrest.core.IsEqual.equalTo;
15-
1617
@RunWith(SpringRunner.class)
17-
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.DEFINED_PORT)
18+
@SpringBootTest(classes = Application.class, webEnvironment = WebEnvironment.RANDOM_PORT)
1819
public class StudentServiceIntegrationTest {
20+
21+
@LocalServerPort
22+
int port;
1923

20-
private static final String ENDPOINT = "http://localhost:8080/student/get";
24+
private static final String ENDPOINT = "http://localhost:%s/student/get";
2125

2226
@Test
2327
public void givenRequestForStudents_whenPageIsOne_expectContainsNames() {
24-
given().params("page", "0", "size", "2").get(ENDPOINT).then().assertThat()
28+
given().params("page", "0", "size", "2").get(String.format(ENDPOINT, port)).then().assertThat()
2529
.body("content.name", hasItems("Bryan", "Ben"));
2630
}
2731

2832
@Test
2933
public void givenRequestForStudents_whenSizeIsTwo_expectTwoItems() {
30-
given().params("page", "0", "size", "2").get(ENDPOINT).then().assertThat().body("size", equalTo(2));
34+
given().params("page", "0", "size", "2").get(String.format(ENDPOINT, port)).then().assertThat().body("size", equalTo(2));
3135
}
3236

3337
@Test
3438
public void givenRequestForStudents_whenSizeIsTwo_expectNumberOfElementsTwo() {
35-
given().params("page", "0", "size", "2").get(ENDPOINT).then().assertThat().body("numberOfElements", equalTo(2));
39+
given().params("page", "0", "size", "2").get(String.format(ENDPOINT, port)).then().assertThat().body("numberOfElements", equalTo(2));
3640
}
3741

3842
@Test
3943
public void givenRequestForStudents_whenResourcesAreRetrievedPaged_thenExpect200() {
40-
given().params("page", "0", "size", "2").get(ENDPOINT).then().statusCode(200);
44+
given().params("page", "0", "size", "2").get(String.format(ENDPOINT, port)).then().statusCode(200);
4145
}
4246

4347
@Test
4448
public void givenRequestForStudents_whenPageOfResourcesAreRetrievedOutOfBounds_thenExpect500() {
45-
given().params("page", "1000", "size", "2").get(ENDPOINT).then().statusCode(500);
49+
given().params("page", "1000", "size", "2").get(String.format(ENDPOINT, port)).then().statusCode(500);
4650
}
4751

4852
@Test
4953
public void givenRequestForStudents_whenPageNotValid_thenExpect500() {
50-
given().params("page", RandomStringUtils.randomNumeric(5), "size", "2").get(ENDPOINT).then().statusCode(500);
54+
given().params("page", RandomStringUtils.randomNumeric(5), "size", "2").get(String.format(ENDPOINT, port)).then().statusCode(500);
5155
}
5256

5357
@Test
5458
public void givenRequestForStudents_whenPageSizeIsFive_expectFiveItems() {
55-
given().params("page", "0", "size", "5").get(ENDPOINT).then().body("content.size()", is(5));
59+
given().params("page", "0", "size", "5").get(String.format(ENDPOINT, port)).then().body("content.size()", is(5));
5660
}
5761

5862
@Test
5963
public void givenResourcesExist_whenFirstPageIsRetrieved_thenPageContainsResources() {
60-
given().params("page", "0", "size", "2").get(ENDPOINT).then().assertThat().body("first", equalTo(true));
64+
given().params("page", "0", "size", "2").get(String.format(ENDPOINT, port)).then().assertThat().body("first", equalTo(true));
6165
}
6266
}

‎spring-rest-query-language/pom.xml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
<packaging>war</packaging>
88

99
<parent>
10-
<artifactId>parent-boot-2.0-temp</artifactId>
10+
<artifactId>parent-boot-2</artifactId>
1111
<groupId>com.baeldung</groupId>
1212
<version>0.0.1-SNAPSHOT</version>
13-
<relativePath>../parent-boot-2.0-temp</relativePath>
13+
<relativePath>../parent-boot-2</relativePath>
1414
</parent>
1515

1616
<dependencies>

‎spring-rest-shell/pom.xml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
<description>A simple project to demonstrate Spring REST Shell features.</description>
99

1010
<parent>
11-
<artifactId>parent-boot-2.0-temp</artifactId>
11+
<artifactId>parent-boot-2</artifactId>
1212
<groupId>com.baeldung</groupId>
1313
<version>0.0.1-SNAPSHOT</version>
14-
<relativePath>../parent-boot-2.0-temp</relativePath>
14+
<relativePath>../parent-boot-2</relativePath>
1515
</parent>
1616

1717
<dependencies>

0 commit comments

Comments
 (0)