-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #734 from stephanpio1/feature/662_test_default_limit
add test for defaultFetchLimit
- Loading branch information
Showing
15 changed files
with
396 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...test/java/com/homihq/db2rest/rest/mariadb/MariaDBReadControllerDefaultFetchLimitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.homihq.db2rest.rest.mariadb; | ||
|
||
|
||
import com.homihq.db2rest.MariaDBBaseIntegrationTest; | ||
import org.junit.jupiter.api.*; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.test.context.TestPropertySource; | ||
|
||
import static com.homihq.db2rest.jdbc.rest.RdbmsRestApi.VERSION; | ||
import static org.hamcrest.Matchers.hasSize; | ||
import static org.hamcrest.core.AnyOf.anyOf; | ||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; | ||
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | ||
|
||
@TestClassOrder(ClassOrderer.OrderAnnotation.class) | ||
@Order(305) | ||
@TestPropertySource(properties = {"db2rest.defaultFetchLimit=5"}) | ||
public class MariaDBReadControllerDefaultFetchLimitTest extends MariaDBBaseIntegrationTest { | ||
|
||
|
||
@Test | ||
@DisplayName("Get all with default fetch limit set to 5") | ||
void findAllPersonsWithDefaultFetchLimit5() throws Exception { | ||
mockMvc.perform(get(VERSION + "/mariadb/person") | ||
.accept(MediaType.APPLICATION_JSON) | ||
) | ||
.andExpect(status().isOk()) | ||
.andExpect(jsonPath("$", anyOf(hasSize(5)))) | ||
.andDo(document("mariadb-find-all-persons-with-default-fetch-limit-5")); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...src/test/java/com/homihq/db2rest/rest/mssql/MsSQLReadControllerDefaultFetchLimitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.homihq.db2rest.rest.mssql; | ||
|
||
|
||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Order; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.test.context.TestPropertySource; | ||
|
||
import static org.hamcrest.Matchers.hasSize; | ||
import static org.hamcrest.core.AnyOf.anyOf; | ||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; | ||
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | ||
|
||
@Order(306) | ||
@TestPropertySource(properties = {"db2rest.defaultFetchLimit=5"}) | ||
public class MsSQLReadControllerDefaultFetchLimitTest extends MsSQLBaseIntegrationTest { | ||
|
||
@Test | ||
@DisplayName("Get all with default fetch limit set to 5") | ||
void findAllPersonsWithDefaultFetchLimit5() throws Exception { | ||
mockMvc.perform(get(getPrefixApiUrl() + "/person") | ||
.accept(MediaType.APPLICATION_JSON) | ||
) | ||
.andExpect(status().isOk()) | ||
.andExpect(jsonPath("$", anyOf(hasSize(5)))) | ||
.andDo(document(DB_NAME + "-find-all-persons-with-default-fetch-limit-5")); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...src/test/java/com/homihq/db2rest/rest/mysql/MySQLReadControllerDefaultFetchLimitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.homihq.db2rest.rest.mysql; | ||
|
||
import com.homihq.db2rest.MySQLBaseIntegrationTest; | ||
import org.junit.jupiter.api.*; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.test.context.TestPropertySource; | ||
|
||
import static com.homihq.db2rest.jdbc.rest.RdbmsRestApi.VERSION; | ||
import static org.hamcrest.Matchers.hasSize; | ||
import static org.hamcrest.core.AnyOf.anyOf; | ||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; | ||
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | ||
@TestClassOrder(ClassOrderer.OrderAnnotation.class) | ||
@Order(3) | ||
@TestPropertySource(properties = {"db2rest.defaultFetchLimit=5"}) | ||
public class MySQLReadControllerDefaultFetchLimitTest extends MySQLBaseIntegrationTest { | ||
|
||
@Test | ||
@DisplayName("Get all with default fetch limit set to 5") | ||
void findAllPersonsWithDefaultFetchLimit5() throws Exception { | ||
mockMvc.perform(get(VERSION + "/mysqldb/person") | ||
.accept(MediaType.APPLICATION_JSON) | ||
) | ||
.andExpect(status().isOk()) | ||
.andExpect(jsonPath("$", anyOf(hasSize(5)))) | ||
.andDo(document("mysqldb-find-all-persons-with-default-fetch-limit-5")); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
...c/test/java/com/homihq/db2rest/rest/oracle/OracleReadControllerDefaultFetchLimitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.homihq.db2rest.rest.oracle; | ||
|
||
import com.homihq.db2rest.OracleBaseIntegrationTest; | ||
import org.junit.jupiter.api.*; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.test.context.TestPropertySource; | ||
|
||
import static com.homihq.db2rest.jdbc.rest.RdbmsRestApi.VERSION; | ||
import static org.hamcrest.Matchers.hasSize; | ||
import static org.hamcrest.core.AnyOf.anyOf; | ||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; | ||
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | ||
|
||
@TestClassOrder(ClassOrderer.OrderAnnotation.class) | ||
@Order(203) | ||
@TestPropertySource(properties = {"db2rest.defaultFetchLimit=5"}) | ||
public class OracleReadControllerDefaultFetchLimitTest extends OracleBaseIntegrationTest { | ||
|
||
@Test | ||
@DisplayName("Get all with default fetch limit set to 5") | ||
void findAllPersonsWithDefaultFetchLimit5() throws Exception { | ||
mockMvc.perform(get(VERSION + "/oradb/person") | ||
.accept(MediaType.APPLICATION_JSON) | ||
) | ||
.andExpect(status().isOk()) | ||
.andExpect(jsonPath("$", anyOf(hasSize(5)))) | ||
.andDo(document("oracle-find-all-persons-with-default-fetch-limit-5")); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
api-rest/src/test/java/com/homihq/db2rest/rest/pg/PgReadControllerDefaultFetchLimitTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.homihq.db2rest.rest.pg; | ||
|
||
import com.homihq.db2rest.PostgreSQLBaseIntegrationTest; | ||
import org.junit.jupiter.api.*; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.test.context.TestPropertySource; | ||
|
||
import static com.homihq.db2rest.jdbc.rest.RdbmsRestApi.VERSION; | ||
import static org.hamcrest.Matchers.hasSize; | ||
import static org.hamcrest.core.AnyOf.anyOf; | ||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; | ||
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | ||
|
||
@TestClassOrder(ClassOrderer.OrderAnnotation.class) | ||
@Order(103) | ||
@TestPropertySource(properties = {"db2rest.defaultFetchLimit=5"}) | ||
public class PgReadControllerDefaultFetchLimitTest extends PostgreSQLBaseIntegrationTest { | ||
|
||
@Test | ||
@DisplayName("Get all with default fetch limit set to 5") | ||
void findAllPersonsWithDefaultFetchLimit5() throws Exception { | ||
mockMvc.perform(get(VERSION + "/pgsqldb/person") | ||
.accept(MediaType.APPLICATION_JSON) | ||
) | ||
.andExpect(status().isOk()) | ||
.andExpect(jsonPath("$", anyOf(hasSize(5)))) | ||
.andDo(document("pg-find-all-persons-with-default-fetch-limit-5")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.