Fixed minor H2 bug.
Fixed dbTest gradle task (now tests all 3 supported DB engines).Bulletin-Board-Batch
parent
c4b0d8f23c
commit
37fdc0bb83
|
@ -27,6 +27,12 @@ public class BulletinBoardClientIntegrationTest {
|
|||
Semaphore jobSemaphore;
|
||||
Vector<Throwable> thrown;
|
||||
|
||||
protected void genericHandleFailure(Throwable t){
|
||||
System.err.println(t.getCause() + " " + t.getMessage());
|
||||
thrown.add(t);
|
||||
jobSemaphore.release();
|
||||
}
|
||||
|
||||
private class PostCallback implements ClientCallback<Object>{
|
||||
|
||||
@Override
|
||||
|
@ -37,8 +43,7 @@ public class BulletinBoardClientIntegrationTest {
|
|||
|
||||
@Override
|
||||
public void handleFailure(Throwable t) {
|
||||
thrown.add(t);
|
||||
jobSemaphore.release();
|
||||
genericHandleFailure(t);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,8 +64,7 @@ public class BulletinBoardClientIntegrationTest {
|
|||
|
||||
@Override
|
||||
public void handleFailure(Throwable t) {
|
||||
thrown.add(t);
|
||||
jobSemaphore.release();
|
||||
genericHandleFailure(t);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -93,8 +97,7 @@ public class BulletinBoardClientIntegrationTest {
|
|||
|
||||
@Override
|
||||
public void handleFailure(Throwable t) {
|
||||
thrown.add(t);
|
||||
jobSemaphore.release();
|
||||
genericHandleFailure(t);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,10 +205,7 @@ public class BulletinBoardClientIntegrationTest {
|
|||
}
|
||||
|
||||
bulletinBoardClient.close();
|
||||
|
||||
for (Throwable t : thrown) {
|
||||
System.err.println(t.getMessage());
|
||||
}
|
||||
|
||||
if (thrown.size() > 0) {
|
||||
assert false;
|
||||
}
|
||||
|
|
|
@ -75,13 +75,15 @@ dependencies {
|
|||
test {
|
||||
exclude '**/*SQLite*Test*'
|
||||
exclude '**/*H2*Test*'
|
||||
exclude '**/*MySql*Test'
|
||||
exclude '**/*MySQL*Test*'
|
||||
exclude '**/*IntegrationTest*'
|
||||
}
|
||||
|
||||
task dbTest(type: Test) {
|
||||
include '**/*H2*Test*'
|
||||
include '**/*MySql*Test'
|
||||
include '**/*MySQL*Test*'
|
||||
include '**/*SQLite*Test*'
|
||||
outputs.upToDateWhen { false }
|
||||
}
|
||||
|
||||
task integrationTest(type: Test) {
|
||||
|
|
|
@ -74,7 +74,7 @@ public class H2QueryProvider implements BulletinBoardSQLServer.SQLQueryProvider
|
|||
case MAX_MESSAGES:
|
||||
return "LIMIT :Limit" + serialString;
|
||||
case MSG_ID:
|
||||
return "MsgTable.MsgId = MsgId" + serialString;
|
||||
return "MsgTable.MsgId = :MsgId" + serialString;
|
||||
case SIGNER_ID:
|
||||
return "EXISTS (SELECT 1 FROM SignatureTable"
|
||||
+ " WHERE SignatureTable.SignerId = :SignerId" + serialString + " AND SignatureTable.EntryNum = MsgTable.EntryNum)";
|
||||
|
|
|
@ -73,15 +73,31 @@ public class SQLiteQueryProvider implements BulletinBoardSQLServer.SQLQueryProvi
|
|||
|
||||
@Override
|
||||
public String getConditionParamTypeName(FilterType filterType) throws IllegalArgumentException {
|
||||
return null; //TODO: write this.
|
||||
|
||||
switch(filterType) {
|
||||
case EXACT_ENTRY: // Go through
|
||||
case MAX_ENTRY: // Go through
|
||||
case MAX_MESSAGES:
|
||||
return "INTEGER";
|
||||
|
||||
case MSG_ID: // Go through
|
||||
case SIGNER_ID:
|
||||
return "BLOB";
|
||||
|
||||
case TAG:
|
||||
return "VARCHAR";
|
||||
|
||||
default:
|
||||
throw new IllegalArgumentException("Cannot serve a filter of type " + filterType);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSource getDataSource() {
|
||||
// TODO: Fix this
|
||||
|
||||
SQLiteDataSource dataSource = new SQLiteDataSource();
|
||||
dataSource.setUrl("jdbc:sqlite:" + dbName);
|
||||
dataSource.setDatabaseName("meerkat"); //TODO: Make generic
|
||||
|
||||
return dataSource;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<param-value>mypass</param-value></context-param>
|
||||
<context-param>
|
||||
<param-name>dbType</param-name>
|
||||
<param-value>SQLite</param-value></context-param>
|
||||
<param-value>H2</param-value></context-param>
|
||||
<listener>
|
||||
<listener-class>meerkat.bulletinboard.webapp.BulletinBoardWebApp</listener-class>
|
||||
</listener>
|
||||
|
|
Loading…
Reference in New Issue