Package data

Class TestCRUD

java.lang.Object
data.TestCRUD

public class TestCRUD
extends java.lang.Object
Tests Create, Read, Update, Delete operations through the Hibernate ORM, using parameters from provided .json files.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    static java.lang.String DB_PARTIAL_RESET
    Name of the SQL script which performs a partial reset between tests, and repopulates the tables which were reset.
    static java.lang.String DB_POPULATE_SQL
    The SQL script which populates the database
    static java.lang.String PARAMS_DIR
    The directory where the test params can be found, with .json files matching class names.
    static java.lang.Object[][] TESTS
    The array of test parameters for the tests to be run
  • Constructor Summary

    Constructors 
    Constructor Description
    TestCRUD​(data.TestCRUD.TestParams params)
    Instantiates a new Test crud with the provided params
  • Method Summary

    Modifier and Type Method Description
    void dbReset()
    Performs a partial reset on the database
    static java.util.Collection getTestParams()
    For JUnit to obtain the test parameters which will be passed into each instance of TestCRUD
    void testCreate()
    Test create operations
    void testDelete()
    Test delete operations
    void testRead()
    Test read operations
    void testUpdate()
    Test update operations

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DB_PARTIAL_RESET

      public static final java.lang.String DB_PARTIAL_RESET
      Name of the SQL script which performs a partial reset between tests, and repopulates the tables which were reset. It resets the scan and host data tables but not the lookup tables
      See Also:
      Constant Field Values
    • DB_POPULATE_SQL

      public static final java.lang.String DB_POPULATE_SQL
      The SQL script which populates the database
      See Also:
      Constant Field Values
    • PARAMS_DIR

      public static final java.lang.String PARAMS_DIR
      The directory where the test params can be found, with .json files matching class names.
      See Also:
      Constant Field Values
    • TESTS

      public static final java.lang.Object[][] TESTS
      The array of test parameters for the tests to be run
  • Constructor Details

    • TestCRUD

      public TestCRUD​(data.TestCRUD.TestParams params)
      Instantiates a new Test crud with the provided params
      Parameters:
      params - the params
  • Method Details

    • dbReset

      public void dbReset() throws java.io.FileNotFoundException
      Performs a partial reset on the database
      Throws:
      java.io.FileNotFoundException - the file not found exception
    • testCreate

      public void testCreate()
      Test create operations
    • testUpdate

      public void testUpdate()
      Test update operations
    • testDelete

      public void testDelete()
      Test delete operations
    • testRead

      public void testRead()
      Test read operations
    • getTestParams

      public static java.util.Collection getTestParams() throws java.lang.NoSuchFieldException, java.lang.IllegalAccessException, java.io.IOException
      For JUnit to obtain the test parameters which will be passed into each instance of TestCRUD
      Returns:
      the test params
      Throws:
      java.lang.NoSuchFieldException - the no such field exception
      java.lang.IllegalAccessException - the illegal access exception
      java.io.IOException - the io exception