Class Changes

All Implemented Interfaces:
DbElement, WithColumnLetterCase, WithLetterCase, WithPrimaryKeyLetterCase, WithTableLetterCase

public class Changes extends AbstractDbElement<Changes>
Changes in the database.

A Changes should be constructed by the fluent builder Changes.Builder from a AssertDbConnection instance.

Examples of instantiation :

  • This Changes detect all changes in database.

     
     AssertDbConnection connection = AssertDbConnectionFactory.of(dataSource).create();
     Changes changes = connection.changes().build();
     changes.setStartPointNow();
     ....
     do some DB updates
     ....
     changes.setEndPointNow();
     assertThat(changes).....
     
     
  • This Changes detect changes for only two table.

     
     AssertDbConnection connection = AssertDbConnectionFactory.of(dataSource).create();
     Changes changes = connection.changes().table("movie").table("song").build();
     
     
  • This Changes detect changes for row returned by a SQL query.

     
     AssertDbConnection connection = AssertDbConnectionFactory.of(dataSource).create();
     Changes changes = connection.changes().request("select * from movie;").build();
     
     
Author:
Régis Pouiller, Julien Roy
  • Method Details

    • getTablesList

      public List<Table> getTablesList()
      Returns the list of Table.
      Returns:
      The list of Table.
    • getRequest

      public Request getRequest()
      Returns the Request.
      Returns:
      The Request.
    • getTablesAtStartPointList

      public List<Table> getTablesAtStartPointList()
      Returns the list of the Tables at start point.
      Returns:
      The list of the Tables at start point.
      See Also:
    • getTablesAtEndPointList

      public List<Table> getTablesAtEndPointList()
      Returns the list of the Tables at end point.
      Returns:
      The list of the Tables at end point.
      See Also:
    • getRequestAtStartPoint

      public Request getRequestAtStartPoint()
      Returns the Request at start point.
      Returns:
      The Request at start point.
      See Also:
    • getRequestAtEndPoint

      public Request getRequestAtEndPoint()
      Returns the Request at end point.
      Returns:
      The Request at end point.
      See Also:
    • setStartPointNow

      public Changes setStartPointNow()
      Sets the start point for comparison.
      Returns:
      this actual instance.
    • setEndPointNow

      public Changes setEndPointNow()
      Sets the end point for comparison.
      Returns:
      this actual instance.
      Throws:
      AssertJDBException - If the start point is not set
    • getChangesList

      public List<Change> getChangesList()
      Returns the list of the changes.
      Returns:
      The list of the changes.
      Throws:
      AssertJDBException - If the changes are on all the tables and if the number of tables change between the start point and the end point. It is normally impossible.
    • getChangesOfTable

      public Changes getChangesOfTable(String tableName)
      Returns Changes only on the table name in parameter.
      Parameters:
      tableName - The table name
      Returns:
      Changes instance.
    • getChangesOfType

      public Changes getChangesOfType(ChangeType changeType)
      Returns Changes only on the change type in parameter.
      Parameters:
      changeType - The change type
      Returns:
      Changes instance.