Bael 4461 2 (#4444)

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* Fix verification times
This commit is contained in:
Amit Pandey
2018-06-11 13:48:30 +05:30
committed by Grzegorz Piwowarek
parent 096826cc07
commit a54c9e0c9e
40 changed files with 201 additions and 101 deletions

View File

@@ -18,26 +18,27 @@ public class AutomapInterfaceIntegrationTest {
private ConnectionProvider connectionProvider = Connector.connectionProvider;
private Database db = Database.from(connectionProvider);
private Observable<Integer> create = null;
private Observable<Integer> truncate = null;
private Observable<Integer> insert1, insert2 = null;
@Before
public void setup() {
create = db.update("CREATE TABLE IF NOT EXISTS EMPLOYEE(id int primary key, name varchar(255))")
Observable<Integer> create = db.update("CREATE TABLE IF NOT EXISTS EMPLOYEE(id int primary key, name varchar(255))")
.count();
truncate = db.update("TRUNCATE TABLE EMPLOYEE")
.dependsOn(create)
.count();
insert1 = db.update("INSERT INTO EMPLOYEE(id, name) VALUES(1, 'Alan')")
.dependsOn(create)
.dependsOn(truncate)
.count();
insert2 = db.update("INSERT INTO EMPLOYEE(id, name) VALUES(2, 'Sarah')")
.dependsOn(create)
.dependsOn(insert1)
.count();
}
@Test
public void whenSelectFromTableAndAutomap_thenCorrect() {
List<Employee> employees = db.select("select id, name from EMPLOYEE")
.dependsOn(create)
.dependsOn(insert1)
.dependsOn(insert2)
.autoMap(Employee.class)
.toList()
@@ -57,7 +58,7 @@ public class AutomapInterfaceIntegrationTest {
@After
public void close() {
db.update("DROP TABLE EMPLOYEE")
.dependsOn(create);
.dependsOn(truncate);
connectionProvider.close();
}
}

View File

@@ -22,24 +22,24 @@ public class BasicQueryTypesIntegrationTest {
@Test
public void whenCreateTableAndInsertRecords_thenCorrect() {
create = db.update("CREATE TABLE IF NOT EXISTS EMPLOYEE(id int primary key, name varchar(255))")
create = db.update("CREATE TABLE IF NOT EXISTS EMPLOYEE_TABLE(id int primary key, name varchar(255))")
.count();
Observable<Integer> insert1 = db.update("INSERT INTO EMPLOYEE(id, name) VALUES(1, 'John')")
Observable<Integer> insert1 = db.update("INSERT INTO EMPLOYEE_TABLE(id, name) VALUES(1, 'John')")
.dependsOn(create)
.count();
Observable<Integer> update = db.update("UPDATE EMPLOYEE SET name = 'Alan' WHERE id = 1")
Observable<Integer> update = db.update("UPDATE EMPLOYEE_TABLE SET name = 'Alan' WHERE id = 1")
.dependsOn(create)
.count();
Observable<Integer> insert2 = db.update("INSERT INTO EMPLOYEE(id, name) VALUES(2, 'Sarah')")
Observable<Integer> insert2 = db.update("INSERT INTO EMPLOYEE_TABLE(id, name) VALUES(2, 'Sarah')")
.dependsOn(create)
.count();
Observable<Integer> insert3 = db.update("INSERT INTO EMPLOYEE(id, name) VALUES(3, 'Mike')")
Observable<Integer> insert3 = db.update("INSERT INTO EMPLOYEE_TABLE(id, name) VALUES(3, 'Mike')")
.dependsOn(create)
.count();
Observable<Integer> delete = db.update("DELETE FROM EMPLOYEE WHERE id = 2")
Observable<Integer> delete = db.update("DELETE FROM EMPLOYEE_TABLE WHERE id = 2")
.dependsOn(create)
.count();
List<String> names = db.select("select name from EMPLOYEE where id < ?")
List<String> names = db.select("select name from EMPLOYEE_TABLE where id < ?")
.parameter(3)
.dependsOn(create)
.dependsOn(insert1)
@@ -57,7 +57,7 @@ public class BasicQueryTypesIntegrationTest {
@After
public void close() {
db.update("DROP TABLE EMPLOYEE")
db.update("DROP TABLE EMPLOYEE_TABLE")
.dependsOn(create);
connectionProvider.close();
}

View File

@@ -27,7 +27,7 @@ public class InsertClobIntegrationTest {
@Before
public void setup() throws IOException {
create = db.update("CREATE TABLE IF NOT EXISTS SERVERLOG (id int primary key, document CLOB)")
create = db.update("CREATE TABLE IF NOT EXISTS SERVERLOG_TABLE (id int primary key, document CLOB)")
.count();
InputStream actualInputStream = new FileInputStream("src/test/resources/actual_clob");
@@ -35,7 +35,7 @@ public class InsertClobIntegrationTest {
InputStream expectedInputStream = new FileInputStream("src/test/resources/expected_clob");
this.expectedDocument = Utils.getStringFromInputStream(expectedInputStream);
this.insert = db.update("insert into SERVERLOG(id,document) values(?,?)")
this.insert = db.update("insert into SERVERLOG_TABLE(id,document) values(?,?)")
.parameter(1)
.parameter(Database.toSentinelIfNull(actualDocument))
.dependsOn(create)
@@ -44,7 +44,7 @@ public class InsertClobIntegrationTest {
@Test
public void whenSelectCLOB_thenCorrect() throws IOException {
db.select("select document from SERVERLOG where id = 1")
db.select("select document from SERVERLOG_TABLE where id = 1")
.dependsOn(create)
.dependsOn(insert)
.getAs(String.class)
@@ -56,7 +56,7 @@ public class InsertClobIntegrationTest {
@After
public void close() {
db.update("DROP TABLE SERVERLOG")
db.update("DROP TABLE SERVERLOG_TABLE")
.dependsOn(create);
connectionProvider.close();
}

View File

@@ -22,14 +22,14 @@ public class ReturnKeysIntegrationTest {
@Before
public void setup() {
begin = db.beginTransaction();
createStatement = db.update("CREATE TABLE IF NOT EXISTS EMPLOYEE(id int auto_increment primary key, name varchar(255))")
createStatement = db.update("CREATE TABLE IF NOT EXISTS EMPLOYEE_SAMPLE(id int auto_increment primary key, name varchar(255))")
.dependsOn(begin)
.count();
}
@Test
public void whenInsertAndReturnGeneratedKey_thenCorrect() {
Integer key = db.update("INSERT INTO EMPLOYEE(name) VALUES('John')")
Integer key = db.update("INSERT INTO EMPLOYEE_SAMPLE(name) VALUES('John')")
.dependsOn(createStatement)
.returnGeneratedKeys()
.getAs(Integer.class)
@@ -41,7 +41,7 @@ public class ReturnKeysIntegrationTest {
@After
public void close() {
db.update("DROP TABLE EMPLOYEE")
db.update("DROP TABLE EMPLOYEE_SAMPLE")
.dependsOn(createStatement);
connectionProvider.close();
}

View File

@@ -24,8 +24,11 @@ public class TransactionIntegrationTest {
.update("CREATE TABLE IF NOT EXISTS EMPLOYEE(id int primary key, name varchar(255))")
.dependsOn(begin)
.count();
Observable<Integer> truncateStatement = db.update("TRUNCATE TABLE EMPLOYEE")
.dependsOn(createStatement)
.count();
Observable<Integer> insertStatement = db.update("INSERT INTO EMPLOYEE(id, name) VALUES(1, 'John')")
.dependsOn(createStatement)
.dependsOn(truncateStatement)
.count();
Observable<Integer> updateStatement = db.update("UPDATE EMPLOYEE SET name = 'Tom' WHERE id = 1")
.dependsOn(insertStatement)