Skip to content

Commit 66c5db0

Browse files
committed
configure test profiles
1 parent bf887e7 commit 66c5db0

8 files changed

Lines changed: 49 additions & 12 deletions

File tree

‎spring-security-rest-full/pom.xml‎

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@
339339
</container>
340340
<configuration>
341341
<properties>
342-
<cargo.servlet.port>8080</cargo.servlet.port>
342+
<cargo.servlet.port>8082</cargo.servlet.port>
343343
</properties>
344344
</configuration>
345345
</configuration>
@@ -386,10 +386,45 @@
386386
</goals>
387387
<configuration>
388388
<excludes>
389-
<exclude>none</exclude>
389+
<exclude>**/*LiveTest.java</exclude>
390390
</excludes>
391391
<includes>
392392
<include>**/*IntegrationTest.java</include>
393+
</includes>
394+
</configuration>
395+
</execution>
396+
</executions>
397+
<configuration>
398+
<systemPropertyVariables>
399+
<test.mime>json</test.mime>
400+
</systemPropertyVariables>
401+
</configuration>
402+
</plugin>
403+
</plugins>
404+
405+
</build>
406+
</profile>
407+
408+
<profile>
409+
<id>live</id>
410+
<build>
411+
412+
<plugins>
413+
414+
<plugin>
415+
<groupId>org.apache.maven.plugins</groupId>
416+
<artifactId>maven-surefire-plugin</artifactId>
417+
<executions>
418+
<execution>
419+
<phase>integration-test</phase>
420+
<goals>
421+
<goal>test</goal>
422+
</goals>
423+
<configuration>
424+
<excludes>
425+
<exclude>**/*IntegrationTest.java</exclude>
426+
</excludes>
427+
<includes>
393428
<include>**/*LiveTest.java</include>
394429
</includes>
395430
</configuration>

‎spring-security-rest-full/src/main/java/org/baeldung/spring/Application.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
/**
1212
* Main Application Class - uses Spring Boot. Just run this as a normal Java
13-
* class to run up a Jetty Server (on http://localhost:8080)
13+
* class to run up a Jetty Server (on http://localhost:8082/spring-security-rest-full)
1414
*
1515
*/
1616
@EnableScheduling
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
server.port=8082
2+
server.context-path=/spring-security-rest-full
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package org.baeldung;
22

33
public interface Consts {
4-
int APPLICATION_PORT = 8080;
4+
int APPLICATION_PORT = 8082;
55
}

‎spring-security-rest-full/src/test/java/org/baeldung/client/RestTemplateLiveTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
public class RestTemplateLiveTest {
5252

5353
private RestTemplate restTemplate;
54-
private static final String fooResourceUrl = "http://localhost:" + APPLICATION_PORT + "/auth/foos";
54+
private static final String fooResourceUrl = "http://localhost:" + APPLICATION_PORT + "/spring-security-rest-full/auth/foos";
5555

5656
@Before
5757
public void beforeTest() {

‎spring-security-rest-full/src/test/java/org/baeldung/common/web/AbstractLiveTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ final Response createAsResponse(final T resource) {
5757
//
5858

5959
protected String getURL() {
60-
return "http://localhost:" + APPLICATION_PORT + "/auth/foos";
60+
return "http://localhost:" + APPLICATION_PORT + "/spring-security-rest-full/auth/foos";
6161
}
6262

6363
protected final RequestSpecification givenAuth() {

‎spring-security-rest-full/src/test/java/org/baeldung/persistence/query/JPASpecificationLiveTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class JPASpecificationLiveTest {
2424

2525
private User userTom;
2626

27-
private final String URL_PREFIX = "http://localhost:8080/auth/users/spec?search=";
27+
private final String URL_PREFIX = "http://localhost:8082/spring-security-rest-full/auth/users/spec?search=";
2828

2929
@Before
3030
public void init() {

‎spring-security-rest-full/src/test/java/org/baeldung/web/MyUserLiveTest.java‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,32 @@
1414
public class MyUserLiveTest {
1515

1616
private final MyUser userJohn = new MyUser("john", "doe", "john@doe.com", 11);
17-
17+
private String URL_PREFIX = "http://localhost:8082/spring-security-rest-full/auth/api/myusers";
1818
@Test
1919
public void whenGettingListOfUsers_thenCorrect() {
20-
final Response response = givenAuth().get("http://localhost:8080/auth/api/myusers");
20+
final Response response = givenAuth().get(URL_PREFIX);
2121
final MyUser[] result = response.as(MyUser[].class);
2222
assertEquals(result.length, 2);
2323
}
2424

2525
@Test
2626
public void givenFirstName_whenGettingListOfUsers_thenCorrect() {
27-
final Response response = givenAuth().get("http://localhost:8080/auth/api/myusers?firstName=john");
27+
final Response response = givenAuth().get(URL_PREFIX + "?firstName=john");
2828
final MyUser[] result = response.as(MyUser[].class);
2929
assertEquals(result.length, 1);
3030
assertEquals(result[0].getEmail(), userJohn.getEmail());
3131
}
3232

3333
@Test
3434
public void givenPartialLastName_whenGettingListOfUsers_thenCorrect() {
35-
final Response response = givenAuth().get("http://localhost:8080/auth/api/myusers?lastName=do");
35+
final Response response = givenAuth().get(URL_PREFIX + "?lastName=do");
3636
final MyUser[] result = response.as(MyUser[].class);
3737
assertEquals(result.length, 2);
3838
}
3939

4040
@Test
4141
public void givenEmail_whenGettingListOfUsers_thenIgnored() {
42-
final Response response = givenAuth().get("http://localhost:8080/auth/api/myusers?email=john");
42+
final Response response = givenAuth().get(URL_PREFIX + "?email=john");
4343
final MyUser[] result = response.as(MyUser[].class);
4444
assertEquals(result.length, 2);
4545
}

0 commit comments

Comments
 (0)