public final class DbSetup extends java.lang.Object
@Before public void setUp() throws Exception { Operation operation = Operations.sequenceOf( CommonOperations.DELETE_ALL, CommonOperations.INSERT_REFERENCE_DATA, Operations.insertInto("CLIENT") .columns("CLIENT_ID", "FIRST_NAME", "LAST_NAME", "DATE_OF_BIRTH", "COUNTRY_ID") .values(1L, "John", "Doe", "1975-07-19", 1L) .values(2L, "Jack", "Smith", "1969-08-22", 2L) .build()); DbSetup dbSetup = new DbSetup(new DataSourceDestination(dataSource), operation); dbSetup.launch(); }In the above code,
CommonOperations.DELETE_ALL
and CommonOperations.INSERT_REFERENCE_DATA
are operations shared by multiple test classes.
Note that, to speed up test executions, a DbSetupTracker
can be used, at the price of a slightly
bigger complexity.
Constructor and Description |
---|
DbSetup(Destination destination,
Operation operation)
Constructor which uses the
default binder configuration . |
DbSetup(Destination destination,
Operation operation,
BinderConfiguration binderConfiguration)
Constructor allowing to use a custom
BinderConfiguration . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
void |
launch()
Executes the sequence of operations.
|
java.lang.String |
toString() |
public DbSetup(@Nonnull Destination destination, @Nonnull Operation operation)
default binder configuration
.destination
- the destination of the sequence of database operationsoperation
- the operation to execute (most of the time, an instance of
CompositeOperation
public DbSetup(@Nonnull Destination destination, @Nonnull Operation operation, @Nonnull BinderConfiguration binderConfiguration)
BinderConfiguration
.destination
- the destination of the sequence of database operationsoperation
- the operation to execute (most of the time, an instance of
CompositeOperation
binderConfiguration
- the binder configuration to use.public void launch()
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object