Skip to content

Commit 7c3c30e

Browse files
authored
Merge pull request #19 from Backbase/BEFOUND-321
Moving to xml changelog for liquibase. Moving to Junit5
2 parents 3689e0b + 5ab014c commit 7c3c30e

File tree

5 files changed

+50
-25
lines changed

5 files changed

+50
-25
lines changed

service-sdk/13.0.0/add-persistence-to-service/example-service/src/main/resources/application.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ spring:
4747
generate-ddl: false
4848
liquibase:
4949
enabled: true
50-
change-log: classpath:db/changelog.yaml
50+
change-log: classpath:db/changelog/db.changelog-persistence.xml
5151

5252
buildingblocks:
5353
security:

service-sdk/13.0.0/add-persistence-to-service/example-service/src/main/resources/db/changelog.yaml

Lines changed: 0 additions & 16 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<databaseChangeLog
4+
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
7+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
8+
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
9+
10+
<property dbms="mssql" name="varcharDataType" value="NVARCHAR"/>
11+
<property dbms="mysql" name="varcharDataType" value="VARCHAR"/>
12+
<property dbms="oracle" name="varcharDataType" value="VARCHAR2"/>
13+
<property name="varcharDataType" value="VARCHAR"/>
14+
15+
<changeSet id="initial_001" context="initial" author="backbase">
16+
<comment>create the greeting table</comment>
17+
<createTable tableName="greetings" remarks="Table to store the greetings">
18+
<column name="id" type="${varcharDataType}(36)">
19+
<constraints nullable="false" primaryKey="true" primaryKeyName="pk_greeting"/>
20+
</column>
21+
<column name="message" type="${varcharDataType}(255)" remarks="Text message">
22+
<constraints nullable="false"/>
23+
</column>
24+
</createTable>
25+
</changeSet>
26+
27+
</databaseChangeLog>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<databaseChangeLog
4+
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
7+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd
8+
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
9+
10+
<include file="db.changelog-1.0.0.xml" relativeToChangelogFile="true"/>
11+
12+
</databaseChangeLog>

service-sdk/13.0.0/add-persistence-to-service/example-service/src/test/java/com/backbase/example/ExampleControllerIT.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import com.fasterxml.jackson.core.type.TypeReference;
55
import com.fasterxml.jackson.databind.ObjectMapper;
6+
import org.junit.jupiter.api.extension.ExtendWith;
67
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
78
import org.springframework.boot.test.context.SpringBootTest;
89
import org.springframework.mock.web.MockHttpServletRequest;
@@ -11,40 +12,41 @@
1112
import org.springframework.test.annotation.DirtiesContext;
1213
import org.springframework.test.annotation.DirtiesContext.ClassMode;
1314
import org.springframework.test.context.ActiveProfiles;
14-
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
15+
import org.springframework.test.context.junit.jupiter.SpringExtension;
16+
1517
import org.springframework.beans.factory.annotation.Autowired;
1618
import org.springframework.test.web.servlet.MockMvc;
1719
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
1820
import org.springframework.test.web.servlet.MvcResult;
1921
import org.springframework.test.web.servlet.ResultActions;
2022
import org.springframework.http.MediaType;
21-
import org.junit.runner.RunWith;
22-
import org.junit.Test;
23+
24+
import org.junit.jupiter.api.Test;
2325

2426
import java.util.List;
2527

28+
import static org.hamcrest.MatcherAssert.assertThat;
2629
import static org.hamcrest.Matchers.greaterThan;
2730
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
2831
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
2932
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
3033
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
3134
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
3235
import static org.hamcrest.CoreMatchers.containsString;
33-
import static org.junit.Assert.assertThat;
36+
3437

3538
/**
3639
* A wrapper annotation for use with integration tests.
3740
*
3841
* By default, assumes the integration test modifies the
39-
* {@link ApplicationContext} associated with the test/s and will therefore be
42+
* {@link org.springframework.context.ApplicationContext} associated with the test/s and will therefore be
4043
* closed and removed from the context cache at the end of the class.
4144
*/
4245
@SpringBootTest(classes = Application.class)
4346
@DirtiesContext(classMode = ClassMode.AFTER_CLASS)
44-
@RunWith(SpringJUnit4ClassRunner.class)
4547
@AutoConfigureMockMvc
4648
@ActiveProfiles("it")
47-
public class ExampleControllerIT {
49+
class ExampleControllerIT {
4850

4951
String TOKEN_ATTR_NAME = "org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository.CSRF_TOKEN";
5052

@@ -58,7 +60,7 @@ public class ExampleControllerIT {
5860
private MockMvc mvc;
5961

6062
@Test
61-
public void exampleTest() throws Exception {
63+
void exampleTest() throws Exception {
6264
String greetingsId = givenAGreetingExists();
6365
whenWeGetTheMessageByIdThenTheMessageExists(greetingsId);
6466
WhenWeGetAllMessagesThenAListOfMessagesIsReturned();

0 commit comments

Comments
 (0)