add live profile

This commit is contained in:
DOHA 2016-10-11 13:10:56 +02:00
parent e7ea2e1d2b
commit 7279e62e44
4 changed files with 61 additions and 6 deletions

View File

@ -278,6 +278,61 @@
</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>
<!-- Spring -->
<org.springframework.version>4.2.5.RELEASE</org.springframework.version>

View File

@ -22,16 +22,16 @@ public class ClientNoSpringLiveTest {
@Test
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 CloseableHttpClient client = HttpClientBuilder.create().setDefaultCredentialsProvider(credentialsProvider).useSystemProperties().build();
final HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactoryDigestAuth(host, client);
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);
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"));
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);
System.out.println(responseEntity.getStatusCode());

View File

@ -23,7 +23,7 @@ public class ClientWithSpringLiveTest {
@Test
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);
System.out.println(responseEntity.getStatusCode());

View File

@ -29,7 +29,7 @@ public class RawClientLiveTest {
final int timeout = 20; // seconds
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);
final int hardTimeout = 5; // seconds