Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for different schemes (not only for public) #17

Merged
merged 8 commits into from
Dec 22, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added tests for another schema
  • Loading branch information
ivan.vakhrushev committed Dec 21, 2019
commit a6d8f5f4fb7efdf5838bbc8221ba3568e431cc79
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dependencies {

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.5.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.5.2'
testImplementation 'com.opentable.components:otj-pg-embedded:0.13.3'
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'ch.qos.logback:logback-classic:1.2.3'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void getInvalidIndexesOnEmptyDatabase() {

@Test
void getInvalidIndexesOnDatabaseWithoutThem() {
executeTestOnDatabase(databasePopulator -> databasePopulator.withReferences().populate(),
executeTestOnDatabase(dbp -> dbp.withReferences().populate(),
() -> {
final var invalidIndexes = indexesHealth.getInvalidIndexes();
assertNotNull(invalidIndexes);
Expand All @@ -61,8 +61,8 @@ void getInvalidIndexesOnDatabaseWithoutThem() {

@Test
void getInvalidIndexesOnDatabaseWithThem() {
executeTestOnDatabase(databasePopulator ->
databasePopulator.withReferences().withData().withInvalidIndex().populate(),
executeTestOnDatabase(dbp ->
dbp.withReferences().withData().withInvalidIndex().populate(),
() -> {
final var invalidIndexes = indexesHealth.getInvalidIndexes();
assertNotNull(invalidIndexes);
Expand All @@ -82,7 +82,7 @@ void getDuplicatedIndexesOnEmptyDatabase() {

@Test
void getDuplicatedIndexesOnDatabaseWithoutThem() {
executeTestOnDatabase(databasePopulator -> databasePopulator.withReferences().populate(),
executeTestOnDatabase(dbp -> dbp.withReferences().populate(),
() -> {
final var duplicatedIndexes = indexesHealth.getDuplicatedIndexes();
assertNotNull(duplicatedIndexes);
Expand All @@ -92,8 +92,8 @@ void getDuplicatedIndexesOnDatabaseWithoutThem() {

@Test
void getDuplicatedIndexesOnDatabaseWithThem() {
executeTestOnDatabase(databasePopulator ->
databasePopulator.withReferences().withData().withDuplicatedIndex().populate(),
executeTestOnDatabase(dbp ->
dbp.withReferences().withData().withDuplicatedIndex().populate(),
() -> {
final var duplicatedIndexes = indexesHealth.getDuplicatedIndexes();
assertNotNull(duplicatedIndexes);
Expand All @@ -119,7 +119,7 @@ void getIntersectedIndexesOnEmptyDatabase() {

@Test
void getIntersectedIndexesOnDatabaseWithoutThem() {
executeTestOnDatabase(databasePopulator -> databasePopulator.withReferences().populate(),
executeTestOnDatabase(dbp -> dbp.withReferences().populate(),
() -> {
final var intersectedIndexes = indexesHealth.getIntersectedIndexes();
assertNotNull(intersectedIndexes);
Expand All @@ -129,8 +129,8 @@ void getIntersectedIndexesOnDatabaseWithoutThem() {

@Test
void getIntersectedIndexesOnDatabaseWithThem() {
executeTestOnDatabase(databasePopulator ->
databasePopulator.withReferences().withData().withDuplicatedIndex().populate(),
executeTestOnDatabase(dbp ->
dbp.withReferences().withData().withDuplicatedIndex().populate(),
() -> {
final var intersectedIndexes = indexesHealth.getIntersectedIndexes();
assertNotNull(intersectedIndexes);
Expand All @@ -156,7 +156,7 @@ void getUnusedIndexesOnEmptyDatabase() {

@Test
void getUnusedIndexesOnDatabaseWithoutThem() {
executeTestOnDatabase(databasePopulator -> databasePopulator.withReferences().populate(),
executeTestOnDatabase(dbp -> dbp.withReferences().populate(),
() -> {
final var unusedIndexes = indexesHealth.getUnusedIndexes();
assertNotNull(unusedIndexes);
Expand All @@ -166,8 +166,8 @@ void getUnusedIndexesOnDatabaseWithoutThem() {

@Test
void getUnusedIndexesOnDatabaseWithThem() {
executeTestOnDatabase(databasePopulator ->
databasePopulator.withReferences().withData().withDuplicatedIndex().populate(),
executeTestOnDatabase(dbp ->
dbp.withReferences().withData().withDuplicatedIndex().populate(),
() -> {
final var unusedIndexes = indexesHealth.getUnusedIndexes();
assertNotNull(unusedIndexes);
Expand Down Expand Up @@ -196,7 +196,7 @@ void getForeignKeysNotCoveredWithIndexOnDatabaseWithoutThem() {

@Test
void getForeignKeysNotCoveredWithIndexOnDatabaseWithThem() {
executeTestOnDatabase(databasePopulator -> databasePopulator.withReferences().populate(),
executeTestOnDatabase(dbp -> dbp.withReferences().populate(),
() -> {
var foreignKeys = indexesHealth.getForeignKeysNotCoveredWithIndex();
assertNotNull(foreignKeys);
Expand All @@ -209,8 +209,8 @@ void getForeignKeysNotCoveredWithIndexOnDatabaseWithThem() {

@Test
void getForeignKeysNotCoveredWithIndexOnDatabaseWithNotSuitableIndex() {
executeTestOnDatabase(databasePopulator ->
databasePopulator.withReferences().withNonSuitableIndex().populate(),
executeTestOnDatabase(dbp ->
dbp.withReferences().withNonSuitableIndex().populate(),
() -> {
var foreignKeys = indexesHealth.getForeignKeysNotCoveredWithIndex();
assertNotNull(foreignKeys);
Expand All @@ -223,8 +223,8 @@ void getForeignKeysNotCoveredWithIndexOnDatabaseWithNotSuitableIndex() {

@Test
void getForeignKeysNotCoveredWithIndexOnDatabaseWithSuitableIndex() {
executeTestOnDatabase(databasePopulator ->
databasePopulator.withReferences().withSuitableIndex().populate(),
executeTestOnDatabase(dbp ->
dbp.withReferences().withSuitableIndex().populate(),
() -> {
var foreignKeys = indexesHealth.getForeignKeysNotCoveredWithIndex();
assertNotNull(foreignKeys);
Expand All @@ -241,8 +241,8 @@ void getTablesWithMissingIndexesOnEmptyDatabase() {

@Test
void getTablesWithMissingIndexesOnDatabaseWithoutThem() {
executeTestOnDatabase(databasePopulator ->
databasePopulator.withReferences().withData().populate(),
executeTestOnDatabase(dbp ->
dbp.withReferences().withData().populate(),
() -> {
final var tables = indexesHealth.getTablesWithMissingIndexes();
assertNotNull(tables);
Expand All @@ -252,9 +252,9 @@ void getTablesWithMissingIndexesOnDatabaseWithoutThem() {

@Test
void getTablesWithMissingIndexesOnDatabaseWithThem() {
executeTestOnDatabase(databasePopulator -> {
databasePopulator.withReferences().withData().populate();
databasePopulator.tryToFindAccountByClientId(101);
executeTestOnDatabase(dbp -> {
dbp.withReferences().withData().populate();
dbp.tryToFindAccountByClientId(101);
},
() -> {
final var tables = indexesHealth.getTablesWithMissingIndexes();
Expand All @@ -276,8 +276,8 @@ void getTablesWithoutPrimaryKeyOnEmptyDatabase() {

@Test
void getTablesWithoutPrimaryKeyOnDatabaseWithoutThem() {
executeTestOnDatabase(databasePopulator ->
databasePopulator.withReferences().withData().populate(),
executeTestOnDatabase(dbp ->
dbp.withReferences().withData().populate(),
() -> {
final var tables = indexesHealth.getTablesWithoutPrimaryKey();
assertNotNull(tables);
Expand All @@ -287,8 +287,8 @@ void getTablesWithoutPrimaryKeyOnDatabaseWithoutThem() {

@Test
void getTablesWithoutPrimaryKeyOnDatabaseWithThem() {
executeTestOnDatabase(databasePopulator ->
databasePopulator.withReferences().withData().withTableWithoutPrimaryKey().populate(),
executeTestOnDatabase(dbp ->
dbp.withReferences().withData().withTableWithoutPrimaryKey().populate(),
() -> {
final var tables = indexesHealth.getTablesWithoutPrimaryKey();
assertNotNull(tables);
Expand All @@ -307,7 +307,7 @@ void getIndexesWithNullValuesOnEmptyDatabase() {

@Test
void getIndexesWithNullValuesOnDatabaseWithoutThem() {
executeTestOnDatabase(databasePopulator -> databasePopulator.withReferences().withData().populate(),
executeTestOnDatabase(dbp -> dbp.withReferences().withData().populate(),
() -> {
final var indexes = indexesHealth.getIndexesWithNullValues();
assertNotNull(indexes);
Expand All @@ -317,8 +317,8 @@ void getIndexesWithNullValuesOnDatabaseWithoutThem() {

@Test
void getIndexesWithNullValuesOnDatabaseWithThem() {
executeTestOnDatabase(databasePopulator ->
databasePopulator.withReferences().withData().withNullValuesInIndex().populate(),
executeTestOnDatabase(dbp ->
dbp.withReferences().withData().withNullValuesInIndex().populate(),
() -> {
final var indexes = indexesHealth.getIndexesWithNullValues();
assertNotNull(indexes);
Expand All @@ -328,9 +328,9 @@ void getIndexesWithNullValuesOnDatabaseWithThem() {

@Test
void shouldResetCounters() {
executeTestOnDatabase(databasePopulator -> {
databasePopulator.withReferences().withData().populate();
databasePopulator.tryToFindAccountByClientId(101);
executeTestOnDatabase(dbp -> {
dbp.withReferences().withData().populate();
dbp.tryToFindAccountByClientId(101);
},
() -> {
waitForStatisticsCollector();
Expand Down
Loading