Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Commit 3fc66c4

Browse files
committed
Add sample to test ClientHttpRequestFactory
Closes gh-1636
1 parent e26b9e4 commit 3fc66c4

File tree

7 files changed

+129
-0
lines changed

7 files changed

+129
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
HELP.md
2+
target/
3+
!.mvn/wrapper/maven-wrapper.jar
4+
!**/src/main/**
5+
!**/src/test/**
6+
7+
### STS ###
8+
.apt_generated
9+
.classpath
10+
.factorypath
11+
.project
12+
.settings
13+
.springBeans
14+
.sts4-cache
15+
16+
### IntelliJ IDEA ###
17+
.idea
18+
*.iws
19+
*.iml
20+
*.ipr
21+
22+
### NetBeans ###
23+
/nbproject/private/
24+
/nbbuild/
25+
/dist/
26+
/nbdist/
27+
/.nb-gradle/
28+
build/
29+
30+
### VS Code ###
31+
.vscode/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Testing ClientHttpRequestFactory
2+
3+
See https://github.com/spring-projects-experimental/spring-native/issues/1636
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
3+
${PWD%/*samples/*}/scripts/compileWithMaven.sh $* && ${PWD%/*samples/*}/scripts/test.sh $*
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>org.springframework.experimental</groupId>
8+
<artifactId>spring-native-sample-parent</artifactId>
9+
<version>0.12.1-SNAPSHOT</version>
10+
<relativePath>../maven-parent/pom.xml</relativePath>
11+
</parent>
12+
<groupId>com.example</groupId>
13+
<artifactId>clientHttpRequestFactory</artifactId>
14+
<version>0.0.1-SNAPSHOT</version>
15+
16+
<dependencies>
17+
<dependency>
18+
<groupId>org.springframework.experimental</groupId>
19+
<artifactId>spring-native</artifactId>
20+
</dependency>
21+
<dependency>
22+
<groupId>org.springframework.boot</groupId>
23+
<artifactId>spring-boot-starter-web</artifactId>
24+
</dependency>
25+
26+
<dependency>
27+
<groupId>org.springframework.boot</groupId>
28+
<artifactId>spring-boot-starter-test</artifactId>
29+
<scope>test</scope>
30+
</dependency>
31+
</dependencies>
32+
33+
<!-- Check out the parent POM for the plugins configuration -->
34+
<build>
35+
<plugins>
36+
<plugin>
37+
<groupId>org.springframework.experimental</groupId>
38+
<artifactId>spring-aot-maven-plugin</artifactId>
39+
</plugin>
40+
<plugin>
41+
<groupId>org.springframework.boot</groupId>
42+
<artifactId>spring-boot-maven-plugin</artifactId>
43+
</plugin>
44+
</plugins>
45+
</build>
46+
47+
</project>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.example.webmvc;
2+
3+
import java.time.Duration;
4+
5+
import org.springframework.boot.CommandLineRunner;
6+
import org.springframework.boot.SpringApplication;
7+
import org.springframework.boot.autoconfigure.SpringBootApplication;
8+
import org.springframework.boot.web.client.RestTemplateBuilder;
9+
import org.springframework.context.annotation.Bean;
10+
import org.springframework.web.client.RestTemplate;
11+
12+
@SpringBootApplication
13+
public class ClientHttpRequestFactoryApplication {
14+
15+
public static void main(String[] args) {
16+
SpringApplication.run(ClientHttpRequestFactoryApplication.class, args);
17+
}
18+
19+
@Bean
20+
CommandLineRunner commandLineRunner() {
21+
return args -> {
22+
RestTemplate restTemplate = new RestTemplateBuilder().setConnectTimeout(Duration.ofMillis(1000)).build();
23+
System.out.println("RestTemplate: " + restTemplate);
24+
};
25+
}
26+
27+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.example.webmvc;
2+
3+
import org.junit.jupiter.api.Test;
4+
5+
import org.springframework.boot.test.context.SpringBootTest;
6+
7+
@SpringBootTest
8+
class ClientHttpRequestFactoryApplicationTests {
9+
10+
@Test
11+
void contextLoads() {
12+
13+
}
14+
15+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
source ${PWD%/*samples/*}/scripts/wait.sh
3+
wait_log target/native/test-output.txt "RestTemplate: org.springframework.web.client.RestTemplate@"

0 commit comments

Comments
 (0)