From 0d22ab4a44dd1db96e46a2bfa02c47f9654de15e Mon Sep 17 00:00:00 2001 From: DOHA Date: Tue, 11 Oct 2016 13:32:28 +0200 Subject: [PATCH] add live profile --- spring-security-rest/pom.xml | 58 ++++++++++++++++++- .../java/org/baeldung/web/FooLiveTest.java | 6 +- .../org/baeldung/web/SwaggerLiveTest.java | 2 +- 3 files changed, 62 insertions(+), 4 deletions(-) diff --git a/spring-security-rest/pom.xml b/spring-security-rest/pom.xml index 6d492863b4..255cf25308 100644 --- a/spring-security-rest/pom.xml +++ b/spring-security-rest/pom.xml @@ -257,7 +257,7 @@ ${maven-surefire-plugin.version} - + **/*LiveTest.java @@ -289,6 +289,62 @@ + + + live + + + + org.codehaus.cargo + cargo-maven2-plugin + + + start-server + pre-integration-test + + start + + + + stop-server + post-integration-test + + stop + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + integration-test + + test + + + + none + + + **/*LiveTest.java + + + cargo + + + + + + + + + + + + 4.2.5.RELEASE diff --git a/spring-security-rest/src/test/java/org/baeldung/web/FooLiveTest.java b/spring-security-rest/src/test/java/org/baeldung/web/FooLiveTest.java index dc3a576b7b..0ef50f745a 100644 --- a/spring-security-rest/src/test/java/org/baeldung/web/FooLiveTest.java +++ b/spring-security-rest/src/test/java/org/baeldung/web/FooLiveTest.java @@ -17,14 +17,16 @@ import com.jayway.restassured.specification.RequestSpecification; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = { TestConfig.class }, loader = AnnotationConfigContextLoader.class) 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 String cookie; + private RequestSpecification givenAuth() { // 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"); + } return RestAssured.given().cookie("JSESSIONID", cookie); } diff --git a/spring-security-rest/src/test/java/org/baeldung/web/SwaggerLiveTest.java b/spring-security-rest/src/test/java/org/baeldung/web/SwaggerLiveTest.java index 792b3e28ce..cf1516f8e1 100644 --- a/spring-security-rest/src/test/java/org/baeldung/web/SwaggerLiveTest.java +++ b/spring-security-rest/src/test/java/org/baeldung/web/SwaggerLiveTest.java @@ -8,7 +8,7 @@ import com.jayway.restassured.RestAssured; import com.jayway.restassured.response.Response; 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 public void whenVerifySpringFoxIsWorking_thenOK() {