-
-
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 #799 from 9tigerio/feature/710_oracle_sp
#710 - add first oracle stored procedure test
- Loading branch information
Showing
5 changed files
with
106 additions
and
11 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -75,7 +75,8 @@ logging: | |
springframework: | ||
web: INFO | ||
beans: INFO | ||
jdbc: INFO | ||
jdbc: DEBUG | ||
|
||
|
||
management: | ||
endpoints: | ||
|
44 changes: 44 additions & 0 deletions
44
api-rest/src/test/java/com/homihq/db2rest/rest/oracle/OracleProcedureControllerTest.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,44 @@ | ||
package com.homihq.db2rest.rest.oracle; | ||
|
||
import com.homihq.db2rest.MySQLBaseIntegrationTest; | ||
import com.homihq.db2rest.OracleBaseIntegrationTest; | ||
import org.junit.jupiter.api.*; | ||
import org.springframework.http.MediaType; | ||
|
||
import java.util.Map; | ||
|
||
import static com.homihq.db2rest.jdbc.rest.RdbmsRestApi.VERSION; | ||
import static java.nio.charset.StandardCharsets.UTF_8; | ||
import static org.hamcrest.Matchers.*; | ||
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document; | ||
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post; | ||
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(250) | ||
class OracleProcedureControllerTest extends OracleBaseIntegrationTest { | ||
|
||
@Disabled | ||
@Test | ||
@DisplayName("Execute stored procedure on oracle db") | ||
void execute() throws Exception { | ||
var json = """ | ||
{ | ||
"movieTitle": "ACADEMY DINOSAUR" | ||
} | ||
"""; | ||
|
||
mockMvc.perform(post(VERSION + "/oradb/procedure/GetMovieRentalRateProc") | ||
.characterEncoding(UTF_8) | ||
.contentType(MediaType.APPLICATION_JSON) | ||
.accept(MediaType.APPLICATION_JSON) | ||
.content(json)) | ||
.andExpect(status().isOk()) | ||
.andExpect(jsonPath("$", instanceOf(Map.class))) | ||
.andExpect(jsonPath("$.*", hasSize(2))) | ||
.andExpect(jsonPath("$.rentalRate", equalTo(0.99))) | ||
//.andDo(print()) | ||
.andDo(document("oracle-execute-procedure")); | ||
} | ||
} |
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
4 changes: 1 addition & 3 deletions
4
rdbms-support/src/main/java/com/homihq/db2rest/jdbc/core/service/ProcedureService.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 |
---|---|---|
@@ -1,11 +1,9 @@ | ||
package com.homihq.db2rest.jdbc.core.service; | ||
|
||
import org.springframework.jdbc.core.simple.SimpleJdbcCall; | ||
|
||
import java.util.Map; | ||
|
||
public interface ProcedureService extends SubRoutine { | ||
SimpleJdbcCall getSimpleJdbcCall(String dbId, String subRoutineName); | ||
public interface ProcedureService { | ||
|
||
Map<String, Object> execute(String dbId, String subRoutineName, Map<String, Object> inParams); | ||
} |