add live profile
This commit is contained in:
parent
a063b93de0
commit
0d22ab4a44
|
@ -257,7 +257,7 @@
|
||||||
<version>${maven-surefire-plugin.version}</version>
|
<version>${maven-surefire-plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<excludes>
|
<excludes>
|
||||||
<!-- <exclude>**/*ProductionTest.java</exclude> -->
|
<exclude>**/*LiveTest.java</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
<systemPropertyVariables>
|
<systemPropertyVariables>
|
||||||
<!-- <provPersistenceTarget>h2</provPersistenceTarget> -->
|
<!-- <provPersistenceTarget>h2</provPersistenceTarget> -->
|
||||||
|
@ -289,6 +289,62 @@
|
||||||
|
|
||||||
</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>
|
||||||
|
|
|
@ -17,14 +17,16 @@ import com.jayway.restassured.specification.RequestSpecification;
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@ContextConfiguration(classes = { TestConfig.class }, loader = AnnotationConfigContextLoader.class)
|
@ContextConfiguration(classes = { TestConfig.class }, loader = AnnotationConfigContextLoader.class)
|
||||||
public class FooLiveTest {
|
public class FooLiveTest {
|
||||||
private static final String URL_PREFIX = "http://localhost:8080/spring-security-rest";
|
private static final String URL_PREFIX = "http://localhost:8082/spring-security-rest";
|
||||||
// private FormAuthConfig formConfig = new FormAuthConfig(URL_PREFIX + "/login", "temporary", "temporary");
|
// private FormAuthConfig formConfig = new FormAuthConfig(URL_PREFIX + "/login", "temporary", "temporary");
|
||||||
|
|
||||||
private String cookie;
|
private String cookie;
|
||||||
|
|
||||||
private RequestSpecification givenAuth() {
|
private RequestSpecification givenAuth() {
|
||||||
// return RestAssured.given().auth().form("user", "userPass", formConfig);
|
// return RestAssured.given().auth().form("user", "userPass", formConfig);
|
||||||
if (cookie == null)
|
if (cookie == null) {
|
||||||
cookie = RestAssured.given().contentType("application/x-www-form-urlencoded").formParam("password", "userPass").formParam("username", "user").post(URL_PREFIX + "/login").getCookie("JSESSIONID");
|
cookie = RestAssured.given().contentType("application/x-www-form-urlencoded").formParam("password", "userPass").formParam("username", "user").post(URL_PREFIX + "/login").getCookie("JSESSIONID");
|
||||||
|
}
|
||||||
return RestAssured.given().cookie("JSESSIONID", cookie);
|
return RestAssured.given().cookie("JSESSIONID", cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ import com.jayway.restassured.RestAssured;
|
||||||
import com.jayway.restassured.response.Response;
|
import com.jayway.restassured.response.Response;
|
||||||
|
|
||||||
public class SwaggerLiveTest {
|
public class SwaggerLiveTest {
|
||||||
private static final String URL_PREFIX = "http://localhost:8080/spring-security-rest/api";
|
private static final String URL_PREFIX = "http://localhost:8082/spring-security-rest/api";
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void whenVerifySpringFoxIsWorking_thenOK() {
|
public void whenVerifySpringFoxIsWorking_thenOK() {
|
||||||
|
|
Loading…
Reference in New Issue