Commentses

This commit is contained in:
Darin Kelkhoff
2021-12-01 23:03:05 -06:00
parent c2fbca18a7
commit 84b432997c
3 changed files with 25 additions and 4 deletions

View File

@ -41,6 +41,8 @@ import static io.javalin.apibuilder.ApiBuilder.post;
/*******************************************************************************
** QQQ Javalin implementation. Given a QInstance, defines all routes needed
** to respond to http requests and route down into the qqq backend.
**
*******************************************************************************/
public class QJavalinImplementation
@ -168,7 +170,7 @@ public class QJavalinImplementation
*******************************************************************************/
private static void dataUpdate(Context context)
{
context.result("{\"updateResult\":{}}");
context.result("{\"todo\":\"not-done\",\"updateResult\":{}}");
}
@ -217,7 +219,7 @@ public class QJavalinImplementation
********************************************************************************/
private static void dataGet(Context context)
{
context.result("{\"getResult\":{}}");
context.result("{\"todo\":\"not-done\",\"getResult\":{}}");
}

View File

@ -22,7 +22,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
/*******************************************************************************
** based on https://javalin.io/tutorials/testing
** Unit terst for the QJavalinImplementation
**
** based on https://javalin.io/tutorials/testing - starts a javalin instance
** and actually makes http requests into it.
**
*******************************************************************************/
class QJavalinImplementationTest
@ -33,6 +36,7 @@ class QJavalinImplementationTest
/*******************************************************************************
** Before the class (all) runs, start a javalin server.
**
*******************************************************************************/
@BeforeAll
@ -45,6 +49,7 @@ class QJavalinImplementationTest
/*******************************************************************************
** Fully rebuild the test-database before each test runs, for completely known state.
**
*******************************************************************************/
@BeforeEach
@ -56,6 +61,7 @@ class QJavalinImplementationTest
/*******************************************************************************
** test the top-level meta-data endpoint
**
*******************************************************************************/
@Test
@ -78,6 +84,7 @@ class QJavalinImplementationTest
/*******************************************************************************
** test the table-level meta-data endpoint
**
*******************************************************************************/
@Test
@ -102,6 +109,7 @@ class QJavalinImplementationTest
/*******************************************************************************
** test the table-level meta-data endpoint for a non-real name
**
*******************************************************************************/
@Test
@ -119,6 +127,7 @@ class QJavalinImplementationTest
/*******************************************************************************
** test a table query
**
*******************************************************************************/
@Test
@ -142,6 +151,7 @@ class QJavalinImplementationTest
/*******************************************************************************
** test a table query using an actual filter.
**
*******************************************************************************/
@Test
@ -163,6 +173,7 @@ class QJavalinImplementationTest
/*******************************************************************************
** test an insert
**
*******************************************************************************/
@Test
@ -194,6 +205,7 @@ class QJavalinImplementationTest
/*******************************************************************************
** test a delete
**
*******************************************************************************/
@Test

View File

@ -17,11 +17,14 @@ import static junit.framework.Assert.assertNotNull;
/*******************************************************************************
** Utility methods for unit tests.
**
*******************************************************************************/
public class TestUtils
{
/*******************************************************************************
** Prime a test database (e.g., h2, in-memory)
**
*******************************************************************************/
@SuppressWarnings("unchecked")
@ -42,6 +45,7 @@ public class TestUtils
/*******************************************************************************
** Run an SQL Query in the test database
**
*******************************************************************************/
public static void runTestSql(String sql, QueryManager.ResultSetProcessor resultSetProcessor) throws Exception
@ -54,6 +58,7 @@ public class TestUtils
/*******************************************************************************
** Define the q-instance for testing (h2 rdbms and 'person' table)
**
*******************************************************************************/
public static QInstance defineInstance()
@ -67,6 +72,7 @@ public class TestUtils
/*******************************************************************************
** Define the h2 rdbms backend
**
*******************************************************************************/
public static QBackendMetaData defineBackend()
@ -84,6 +90,7 @@ public class TestUtils
/*******************************************************************************
** Define the person table
**
*******************************************************************************/
public static QTableMetaData defineTablePerson()