Skip to content

Commit 12e55f5

Browse files
committed
Fix mysql Error IT on insert/update/delete
1 parent 4b6efe8 commit 12e55f5

File tree

4 files changed

+30
-9
lines changed

4 files changed

+30
-9
lines changed

model/src/test/java/com/test/vendor/mysql/MySqlDeleteSuiteIT.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.jsql.model.InjectionModel;
44
import com.jsql.model.exception.JSqlException;
55
import com.jsql.view.terminal.SystemOutTerminal;
6+
import org.junit.jupiter.api.AfterEach;
67
import org.junit.jupiter.api.Assertions;
78
import org.junitpioneer.jupiter.RetryingTest;
89

@@ -25,7 +26,14 @@ public void setupInjection() throws Exception {
2526
);
2627

2728
model.setIsScanning(true);
28-
29+
30+
model
31+
.getMediatorUtils()
32+
.getPreferencesUtil()
33+
.withIsStrategyBlindBitDisabled(true)
34+
.withIsStrategyBlindBinDisabled(true)
35+
.withIsStrategyTimeDisabled(true);
36+
2937
model
3038
.getMediatorUtils()
3139
.getConnectionUtil()
@@ -37,8 +45,12 @@ public void setupInjection() throws Exception {
3745

3846
@Override
3947
@RetryingTest(3)
40-
public void listDatabases() throws JSqlException {
48+
public void listDatabases() throws JSqlException { // API changes rows: listValues() not usable
4149
super.listDatabases();
50+
}
51+
52+
@AfterEach
53+
void afterEach() {
4254
Assertions.assertEquals(
4355
this.injectionModel.getMediatorStrategy().getError(),
4456
this.injectionModel.getMediatorStrategy().getStrategy()

model/src/test/java/com/test/vendor/mysql/MySqlInsertSuiteIT.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
class MySqlInsertSuiteIT extends ConcreteMySqlErrorSuiteIT {
1111

12+
@Override
13+
public void initTable() {
14+
this.jsqlTableName = "StudentForDelete";
15+
}
16+
1217
@Override
1318
public void setupInjection() throws Exception {
1419
InjectionModel model = new InjectionModel();
@@ -38,10 +43,9 @@ public void setupInjection() throws Exception {
3843
model.beginInjection();
3944
}
4045

41-
// Insert API add row to the table: listValues() not usable
4246
@Override
4347
@RetryingTest(3)
44-
public void listDatabases() throws JSqlException {
48+
public void listDatabases() throws JSqlException { // API changes rows: listValues() not usable
4549
super.listDatabases();
4650
}
4751

model/src/test/java/com/test/vendor/mysql/MySqlUpdateSuiteIT.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
class MySqlUpdateSuiteIT extends ConcreteMySqlErrorSuiteIT {
1111

12+
@Override
13+
public void initTable() {
14+
this.jsqlTableName = "StudentForDelete";
15+
}
16+
1217
@Override
1318
public void setupInjection() throws Exception {
1419
InjectionModel model = new InjectionModel();
@@ -37,11 +42,11 @@ public void setupInjection() throws Exception {
3742

3843
model.beginInjection();
3944
}
40-
45+
4146
@Override
4247
@RetryingTest(3)
43-
public void listValues() throws JSqlException {
44-
super.listValues();
48+
public void listDatabases() throws JSqlException { // API changes rows: listValues() not usable
49+
super.listDatabases();
4550
}
4651

4752
@AfterEach

model/src/test/java/spring/rest/HibernateRestController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,12 @@ public Greeting endpointDelete(@RequestParam(value="name", defaultValue="World")
181181

182182
@RequestMapping("/insert")
183183
public Greeting endpointInsert(@RequestParam(value="name", defaultValue="World") String name) {
184-
return this.getResponse(name, "insert into Student select * from Student where 'not_found' = '%s'", true, true, false);
184+
return this.getResponse(name, "insert into StudentForDelete select * from StudentForDelete where 'not_found' = '%s'", true, true, false);
185185
}
186186

187187
@RequestMapping("/update")
188188
public Greeting endpointUpdate(@RequestParam(value="name", defaultValue="World") String name) {
189-
return this.getResponse(name, "update Student set roll_no = '' where 'not_found' = '%s'", true, true, false);
189+
return this.getResponse(name, "update StudentForDelete set Class_Name = '' where 'not_found' = '%s'", true, true, false);
190190
}
191191

192192
@RequestMapping("/order-by")

0 commit comments

Comments
 (0)