Class RowCountCheckConfiguration
RowCounter to use, from a DatabaseConfig and the dbunit.* system
property overrides.
Precedence, for both the enabled flag and the exclude patterns: the system property, when
present, wins in either direction, so it can force-enable in CI and force-disable locally.
Absent, resolution falls through to the DatabaseConfig value; absent there too, the
enabled flag defaults to false. The exclude system property, when present, replaces
rather than appends to the configured patterns.
The RowCounter has no system property override: swapping the counting implementation
is a code-level decision made once for a suite, not something flipped per run.
The RowCountCheckConfiguration(DatabaseConfig) constructor is a thin adapter: it
reads the three values a DatabaseConfig carries and delegates to
RowCountCheckConfiguration(boolean, String[], RowCounter), which owns the
system-property precedence and the defaulting. A caller that already holds the values - an
annotation override, say - passes them to the second constructor directly rather than
staging them through a throwaway DatabaseConfig.
- Since:
- 3.6.0
- Author:
- dbunit
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSystem property overridingDatabaseConfig.FEATURE_ROW_COUNT_CHECK, in either direction, when present.static final StringSystem property overridingDatabaseConfig.PROPERTY_ROW_COUNT_CHECK_EXCLUDE_TABLESwhen present, replacing rather than appending to the configured patterns. -
Constructor Summary
ConstructorsConstructorDescriptionRowCountCheckConfiguration(boolean enabled, String[] excludeTablePatterns, RowCounter rowCounter) Resolves the configuration from explicit values and the current system properties.RowCountCheckConfiguration(DatabaseConfig databaseConfig) Resolves the configuration from the three values aDatabaseConfigcarries, delegating toRowCountCheckConfiguration(boolean, String[], RowCounter)for the system-property precedence and the defaulting. -
Method Summary
Modifier and TypeMethodDescriptionReturns the filter built from the resolved exclude table patterns.Returns theRowCounterto use.booleanReturns whether the row count check is enabled.
-
Field Details
-
DBUNIT_ROW_COUNT_CHECK
System property overridingDatabaseConfig.FEATURE_ROW_COUNT_CHECK, in either direction, when present.- See Also:
-
DBUNIT_ROW_COUNT_CHECK_EXCLUDE_TABLES
System property overridingDatabaseConfig.PROPERTY_ROW_COUNT_CHECK_EXCLUDE_TABLESwhen present, replacing rather than appending to the configured patterns.- See Also:
-
-
Constructor Details
-
RowCountCheckConfiguration
Resolves the configuration from the three values aDatabaseConfigcarries, delegating toRowCountCheckConfiguration(boolean, String[], RowCounter)for the system-property precedence and the defaulting.- Parameters:
databaseConfig- the database config to readDatabaseConfig.FEATURE_ROW_COUNT_CHECK,DatabaseConfig.PROPERTY_ROW_COUNT_CHECK_EXCLUDE_TABLES, andDatabaseConfig.PROPERTY_ROW_COUNTERfrom.
-
RowCountCheckConfiguration
public RowCountCheckConfiguration(boolean enabled, String[] excludeTablePatterns, RowCounter rowCounter) Resolves the configuration from explicit values and the current system properties. Thedbunit.rowCountCheckanddbunit.rowCountCheckExcludeTablessystem properties, when present, still win overenabledandexcludeTablePatternsrespectively, exactly as they win over aDatabaseConfig's own values.- Parameters:
enabled- whether the check is enabled, absent a system property override.excludeTablePatterns- the excluded table patterns, absent a system property override;nullresolves to no exclusions.rowCounter- theRowCounterto use;nullresolves to a newQueryPerTableRowCounter, so a value not carried byDatabaseConfig's own default initialization is still tolerated.
-
-
Method Details
-
isEnabled
public boolean isEnabled()Returns whether the row count check is enabled.- Returns:
truewhen enabled.
-
getExcludeTableFilter
Returns the filter built from the resolved exclude table patterns.- Returns:
- the exclude table filter.
-
getRowCounter
Returns theRowCounterto use.- Returns:
- the configured row counter.
-