add live profile
This commit is contained in:
parent
e7ea2e1d2b
commit
7279e62e44
@ -278,6 +278,61 @@
|
|||||||
|
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>live</id>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.cargo</groupId>
|
||||||
|
<artifactId>cargo-maven2-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>start-server</id>
|
||||||
|
<phase>pre-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>start</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>stop-server</id>
|
||||||
|
<phase>post-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>stop</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>test</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<excludes>
|
||||||
|
<exclude>none</exclude>
|
||||||
|
</excludes>
|
||||||
|
<includes>
|
||||||
|
<include>**/*LiveTest.java</include>
|
||||||
|
</includes>
|
||||||
|
<systemPropertyVariables>
|
||||||
|
<webTarget>cargo</webTarget>
|
||||||
|
</systemPropertyVariables>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!-- Spring -->
|
<!-- Spring -->
|
||||||
<org.springframework.version>4.2.5.RELEASE</org.springframework.version>
|
<org.springframework.version>4.2.5.RELEASE</org.springframework.version>
|
||||||
|
@ -22,16 +22,16 @@ public class ClientNoSpringLiveTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public final void givenUsingCustomHttpRequestFactory_whenSecuredRestApiIsConsumed_then200OK() {
|
public final void givenUsingCustomHttpRequestFactory_whenSecuredRestApiIsConsumed_then200OK() {
|
||||||
final HttpHost host = new HttpHost("localhost", 8080, "http");
|
final HttpHost host = new HttpHost("localhost", 8082, "http");
|
||||||
|
|
||||||
final CredentialsProvider credentialsProvider = provider();
|
final CredentialsProvider credentialsProvider = provider();
|
||||||
final CloseableHttpClient client = HttpClientBuilder.create().setDefaultCredentialsProvider(credentialsProvider).useSystemProperties().build();
|
final CloseableHttpClient client = HttpClientBuilder.create().setDefaultCredentialsProvider(credentialsProvider).useSystemProperties().build();
|
||||||
final HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactoryDigestAuth(host, client);
|
final HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactoryDigestAuth(host, client);
|
||||||
final RestTemplate restTemplate = new RestTemplate(requestFactory);
|
final RestTemplate restTemplate = new RestTemplate(requestFactory);
|
||||||
|
|
||||||
// credentialsProvider.setCredentials(new AuthScope("localhost", 8080, AuthScope.ANY_REALM), new UsernamePasswordCredentials("user1", "user1Pass"));
|
// credentialsProvider.setCredentials(new AuthScope("localhost", 8082, AuthScope.ANY_REALM), new UsernamePasswordCredentials("user1", "user1Pass"));
|
||||||
|
|
||||||
final String uri = "http://localhost:8080/spring-security-rest-digest-auth/api/foos/1";
|
final String uri = "http://localhost:8082/spring-security-rest-digest-auth/api/foos/1";
|
||||||
final ResponseEntity<Foo> responseEntity = restTemplate.exchange(uri, HttpMethod.GET, null, Foo.class);
|
final ResponseEntity<Foo> responseEntity = restTemplate.exchange(uri, HttpMethod.GET, null, Foo.class);
|
||||||
|
|
||||||
System.out.println(responseEntity.getStatusCode());
|
System.out.println(responseEntity.getStatusCode());
|
||||||
@ -46,7 +46,7 @@ public class ClientNoSpringLiveTest {
|
|||||||
|
|
||||||
// credentialsProvider.setCredentials(new AuthScope("localhost", 8080, AuthScope.ANY_REALM), new UsernamePasswordCredentials("user1", "user1Pass"));
|
// credentialsProvider.setCredentials(new AuthScope("localhost", 8080, AuthScope.ANY_REALM), new UsernamePasswordCredentials("user1", "user1Pass"));
|
||||||
|
|
||||||
final String uri = "http://localhost:8080/spring-security-rest-digest-auth/api/foos/1";
|
final String uri = "http://localhost:8082/spring-security-rest-digest-auth/api/foos/1";
|
||||||
final ResponseEntity<Foo> responseEntity = restTemplate.exchange(uri, HttpMethod.GET, null, Foo.class);
|
final ResponseEntity<Foo> responseEntity = restTemplate.exchange(uri, HttpMethod.GET, null, Foo.class);
|
||||||
|
|
||||||
System.out.println(responseEntity.getStatusCode());
|
System.out.println(responseEntity.getStatusCode());
|
||||||
|
@ -23,7 +23,7 @@ public class ClientWithSpringLiveTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public final void whenSecuredRestApiIsConsumed_then200OK() {
|
public final void whenSecuredRestApiIsConsumed_then200OK() {
|
||||||
final String uri = "http://localhost:8080/spring-security-rest-digest-auth/api/foos/1";
|
final String uri = "http://localhost:8082/spring-security-rest-digest-auth/api/foos/1";
|
||||||
final ResponseEntity<Foo> responseEntity = restTemplate.exchange(uri, HttpMethod.GET, null, Foo.class);
|
final ResponseEntity<Foo> responseEntity = restTemplate.exchange(uri, HttpMethod.GET, null, Foo.class);
|
||||||
|
|
||||||
System.out.println(responseEntity.getStatusCode());
|
System.out.println(responseEntity.getStatusCode());
|
||||||
|
@ -29,7 +29,7 @@ public class RawClientLiveTest {
|
|||||||
|
|
||||||
final int timeout = 20; // seconds
|
final int timeout = 20; // seconds
|
||||||
final RequestConfig requestConfig = RequestConfig.custom().setConnectionRequestTimeout(timeout).setConnectTimeout(timeout).setSocketTimeout(timeout).build();
|
final RequestConfig requestConfig = RequestConfig.custom().setConnectionRequestTimeout(timeout).setConnectTimeout(timeout).setSocketTimeout(timeout).build();
|
||||||
final HttpGet getMethod = new HttpGet("http://localhost:8080/spring-security-rest-basic-auth/api/bars/1");
|
final HttpGet getMethod = new HttpGet("http://localhost:8082/spring-security-rest-basic-auth/api/bars/1");
|
||||||
getMethod.setConfig(requestConfig);
|
getMethod.setConfig(requestConfig);
|
||||||
|
|
||||||
final int hardTimeout = 5; // seconds
|
final int hardTimeout = 5; // seconds
|
||||||
|
Loading…
x
Reference in New Issue
Block a user