Class DualRunSimulator<E extends EntityType<E>>

  • Type Parameters:
    E - EntityType

    public class DualRunSimulator<E extends EntityType<E>>
    extends java.lang.Object
    This utility helps to migrate from an old mutation code to Persistence Layer by running them side-by-side and compare their results. Terminology + ActualMutator - This is the old code. + Simulated - The persistence layer commands. Implementation This simulator runs both the old mutator along with the simulated commands (PL). However, the simulated commands run without DbOutputGenerator, meaning, they don't really affect the database. PL simulated commands only run enrichers, validators, etc. After the real (old) mutator changed the DB, we fetch the final state of the entities to compare the actual modification with the content of the simulated commands. Limitations + One-to-many relations: Child commands are not supported.
    • Method Detail

      • runCreation

        public java.util.List<ComparisonMismatch<E>> runCreation​(UniqueKey<E> uniqueKey,
                                                                 ActualDatabaseMutator<E> databaseMutator,
                                                                 java.util.Collection<? extends CreateEntityCommand<E>> commandsToSimulate)
        Runs the real mutator and compares the actual DB affect with the values in the simulated commands. Correlating each simulated command to an actual affect is done by a unique key. The key doesn't have to be the primary key. It could be whatever unique key you want. But it must be populated in the simulation commands.
        Parameters:
        uniqueKey -
        databaseMutator -
        commandsToSimulate - - must contain values for the unique key.
        Returns: