add live profile
This commit is contained in:
parent
7279e62e44
commit
a063b93de0
|
@ -285,6 +285,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>
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class RestTemplateFactory implements FactoryBean<RestTemplate>, Initializ
|
||||||
final RequestConfig config = RequestConfig.custom().setConnectTimeout(timeout * 1000).setConnectionRequestTimeout(timeout * 1000).setSocketTimeout(timeout * 1000).build();
|
final RequestConfig config = RequestConfig.custom().setConnectTimeout(timeout * 1000).setConnectionRequestTimeout(timeout * 1000).setSocketTimeout(timeout * 1000).build();
|
||||||
|
|
||||||
final BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
|
final BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
|
||||||
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 CloseableHttpClient client = HttpClientBuilder.create().setDefaultRequestConfig(config).setDefaultCredentialsProvider(credentialsProvider).build();
|
final CloseableHttpClient client = HttpClientBuilder.create().setDefaultRequestConfig(config).setDefaultCredentialsProvider(credentialsProvider).build();
|
||||||
|
|
||||||
final ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(client);
|
final ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(client);
|
||||||
|
|
|
@ -33,7 +33,7 @@ public class ClientLiveTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public final void whenSecuredRestApiIsConsumed_then200OK() {
|
public final void whenSecuredRestApiIsConsumed_then200OK() {
|
||||||
final ResponseEntity<Foo> responseEntity = secureRestTemplate.exchange("http://localhost:8080/spring-security-rest-basic-auth/api/foos/1", HttpMethod.GET, null, Foo.class);
|
final ResponseEntity<Foo> responseEntity = secureRestTemplate.exchange("http://localhost:8082/spring-security-rest-basic-auth/api/foos/1", HttpMethod.GET, null, Foo.class);
|
||||||
assertThat(responseEntity.getStatusCode().value(), is(200));
|
assertThat(responseEntity.getStatusCode().value(), is(200));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.springframework.web.client.RestTemplate;
|
||||||
* */
|
* */
|
||||||
public class RestClientLiveManualTest {
|
public class RestClientLiveManualTest {
|
||||||
|
|
||||||
final String urlOverHttps = "http://localhost:8080/spring-security-rest-basic-auth/api/bars/1";
|
final String urlOverHttps = "http://localhost:8082/spring-security-rest-basic-auth/api/bars/1";
|
||||||
|
|
||||||
// tests
|
// tests
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue