Skip to content

Commit 67b3d62

Browse files
authored
Merge pull request eugenp#749 from ivanp81/master
Move OkHttp examples to spring-rest
2 parents 66c5db0 + 5329c54 commit 67b3d62

14 files changed

Lines changed: 152 additions & 185 deletions

‎okhttp/pom.xml‎

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

‎okhttp/src/test/java/org/baeldung/okhttp/OkHttpMiscTest.java‎

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

‎pom.xml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<module>apache-cxf</module>
1919
<!-- <module>apache-fop</module> --> <!-- TODO: has a compilation issue -->
2020
<module>autovalue-tutorial</module>
21-
21+
2222
<module>cdi</module>
2323
<module>core-java</module>
2424
<module>core-java-8</module>
@@ -68,7 +68,6 @@
6868
<module>rest-assured</module>
6969
<module>rest-testing</module>
7070
<module>resteasy</module>
71-
<module>okhttp</module>
7271

7372
<module>spring-all</module>
7473
<module>spring-akka</module>

‎spring-rest/README.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
###The Course
66
The "REST With Spring" Classes: http://bit.ly/restwithspring
77

8-
### Relevant Articles:
8+
### Relevant Articles:
99
- [Spring @RequestMapping](http://www.baeldung.com/spring-requestmapping)
1010
- [Http Message Converters with the Spring Framework](http://www.baeldung.com/spring-httpmessageconverter-rest)
1111
- [Redirect in Spring](http://www.baeldung.com/spring-redirect-and-forward)
1212
- [Returning Custom Status Codes from Spring Controllers](http://www.baeldung.com/spring-mvc-controller-custom-http-status-code)
13+
- [A Guide to OkHttp](http://www.baeldung.com/guide-to-okhttp)

‎spring-rest/pom.xml‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<dependencies>
1616

1717
<!-- Spring Boot Dependencies -->
18-
18+
1919
<dependency>
2020
<groupId>org.springframework.boot</groupId>
2121
<artifactId>spring-boot-starter-thymeleaf</artifactId>
@@ -71,7 +71,7 @@
7171
<groupId>com.fasterxml.jackson.core</groupId>
7272
<artifactId>jackson-databind</artifactId>
7373
</dependency>
74-
74+
7575
<dependency>
7676
<groupId>com.fasterxml.jackson.dataformat</groupId>
7777
<artifactId>jackson-dataformat-xml</artifactId>
@@ -118,6 +118,14 @@
118118
<artifactId>log4j-over-slf4j</artifactId>
119119
</dependency>
120120

121+
<!-- okhttp -->
122+
123+
<dependency>
124+
<groupId>com.squareup.okhttp3</groupId>
125+
<artifactId>okhttp</artifactId>
126+
<version>${com.squareup.okhttp3.version}</version>
127+
</dependency>
128+
121129
<!-- test scoped -->
122130

123131
<dependency>
@@ -153,14 +161,14 @@
153161
<artifactId>rest-assured</artifactId>
154162
<version>${rest-assured.version}</version>
155163
</dependency>
156-
164+
157165
<!-- -->
158166
<dependency>
159167
<groupId>com.google.protobuf</groupId>
160168
<artifactId>protobuf-java</artifactId>
161169
<version>2.6.1</version>
162170
</dependency>
163-
171+
164172
<dependency>
165173
<groupId>com.esotericsoftware</groupId>
166174
<artifactId>kryo</artifactId>
@@ -198,7 +206,7 @@
198206
<artifactId>maven-surefire-plugin</artifactId>
199207
<configuration>
200208
<excludes>
201-
<exclude>**/*LiveTest.java</exclude>
209+
<exclude>**/*LiveTest.java</exclude>
202210
</excludes>
203211
<systemPropertyVariables>
204212
<!-- <provPersistenceTarget>h2</provPersistenceTarget> -->
@@ -285,7 +293,7 @@
285293
</build>
286294
</profile>
287295
</profiles>
288-
296+
289297
<properties>
290298
<!-- Spring -->
291299

@@ -320,6 +328,9 @@
320328
<maven-surefire-plugin.version>2.19.1</maven-surefire-plugin.version>
321329
<cargo-maven2-plugin.version>1.6.0</cargo-maven2-plugin.version>
322330

331+
<!-- okhttp -->
332+
<com.squareup.okhttp3.version>3.4.1</com.squareup.okhttp3.version>
333+
323334
</properties>
324335

325336
</project>

okhttp/src/main/java/org/baeldung/okhttp/DefaultContentTypeInterceptor.java renamed to spring-rest/src/test/java/org/baeldung/okhttp/DefaultContentTypeInterceptor.java

File renamed without changes.

okhttp/src/test/java/org/baeldung/okhttp/OkHttpFileUploadingTest.java renamed to spring-rest/src/test/java/org/baeldung/okhttp/OkHttpFileUploadingLiveTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
import okhttp3.RequestBody;
1919
import okhttp3.Response;
2020

21-
public class OkHttpFileUploadingTest {
21+
public class OkHttpFileUploadingLiveTest {
2222

2323
private static final String BASE_URL = "http://localhost:8080/spring-rest";
2424

2525
@Test
26-
public void whenUploadFileUsingOkHttp_thenCorrect() throws IOException {
26+
public void whenUploadFile_thenCorrect() throws IOException {
2727

2828
OkHttpClient client = new OkHttpClient();
2929

@@ -45,7 +45,7 @@ public void whenUploadFileUsingOkHttp_thenCorrect() throws IOException {
4545
}
4646

4747
@Test
48-
public void whenGetUploadFileProgressUsingOkHttp_thenCorrect() throws IOException {
48+
public void whenGetUploadFileProgress_thenCorrect() throws IOException {
4949

5050
OkHttpClient client = new OkHttpClient();
5151

okhttp/src/test/java/org/baeldung/okhttp/OkHttpGetTest.java renamed to spring-rest/src/test/java/org/baeldung/okhttp/OkHttpGetLiveTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
import okhttp3.Request;
1515
import okhttp3.Response;
1616

17-
public class OkHttpGetTest {
17+
public class OkHttpGetLiveTest {
1818

1919
private static final String BASE_URL = "http://localhost:8080/spring-rest";
2020

2121
@Test
22-
public void whenGetRequestUsingOkHttp_thenCorrect() throws IOException {
22+
public void whenGetRequest_thenCorrect() throws IOException {
2323

2424
OkHttpClient client = new OkHttpClient();
2525

@@ -34,7 +34,7 @@ public void whenGetRequestUsingOkHttp_thenCorrect() throws IOException {
3434
}
3535

3636
@Test
37-
public void whenGetRequestWithQueryParameterUsingOkHttp_thenCorrect() throws IOException {
37+
public void whenGetRequestWithQueryParameter_thenCorrect() throws IOException {
3838

3939
OkHttpClient client = new OkHttpClient();
4040

@@ -54,7 +54,7 @@ public void whenGetRequestWithQueryParameterUsingOkHttp_thenCorrect() throws IOE
5454
}
5555

5656
@Test
57-
public void whenAsynchronousGetRequestUsingOkHttp_thenCorrect() {
57+
public void whenAsynchronousGetRequest_thenCorrect() {
5858

5959
OkHttpClient client = new OkHttpClient();
6060

okhttp/src/test/java/org/baeldung/okhttp/OkHttpHeaderTest.java renamed to spring-rest/src/test/java/org/baeldung/okhttp/OkHttpHeaderLiveTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
import okhttp3.Request;
1010
import okhttp3.Response;
1111

12-
public class OkHttpHeaderTest {
12+
public class OkHttpHeaderLiveTest {
1313

1414
private static final String SAMPLE_URL = "http://www.github.com";
1515

1616
@Test
17-
public void whenSetHeaderUsingOkHttp_thenCorrect() throws IOException {
17+
public void whenSetHeader_thenCorrect() throws IOException {
1818

1919
OkHttpClient client = new OkHttpClient();
2020

@@ -29,7 +29,7 @@ public void whenSetHeaderUsingOkHttp_thenCorrect() throws IOException {
2929
}
3030

3131
@Test
32-
public void whenSetDefaultHeaderUsingOkHttp_thenCorrect() throws IOException {
32+
public void whenSetDefaultHeader_thenCorrect() throws IOException {
3333

3434
OkHttpClient client = new OkHttpClient.Builder()
3535
.addInterceptor(new DefaultContentTypeInterceptor("application/json"))

0 commit comments

Comments
 (0)