Skip to content

Commit

Permalink
Fix missing MockDateNowSupplier in Sql integration tests (#3207)
Browse files Browse the repository at this point in the history
  • Loading branch information
jnsrnhld authored Nov 13, 2023
1 parent 5805f86 commit 978f3c0
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ default List<SelectConverter<? extends Select>> customizeSelectConverters(List<S
return customize(getDefaultSelectConverters(), substitutes);
}

default List<FilterConverter<?, ?>> customizeFilterConverters(List<FilterConverter<?, ?>> substitutes) {
return customize(getDefaultFilterConverters(), substitutes);
}


default List<FilterConverter<?, ?>> getDefaultFilterConverters() {
return List.of(
new DateDistanceFilterConverter(DEFAULT_DATE_NOW_SUPPLIER),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import com.bakdata.conquery.models.config.SqlConnectorConfig;
import com.bakdata.conquery.models.datasets.concepts.select.Select;
import com.bakdata.conquery.sql.DslContextFactory;
import com.bakdata.conquery.sql.conversion.cqelement.concept.filter.DateDistanceFilterConverter;
import com.bakdata.conquery.sql.conversion.cqelement.concept.filter.FilterConverter;
import com.bakdata.conquery.sql.conversion.cqelement.concept.select.DateDistanceSelectConverter;
import com.bakdata.conquery.sql.conversion.cqelement.concept.select.SelectConverter;
import com.bakdata.conquery.sql.conversion.dialect.HanaSqlDialect;
Expand Down Expand Up @@ -107,14 +109,23 @@ public static void tearDownClass() {

private static class TestHanaDialect extends HanaSqlDialect implements TestSqlDialect {

public static final MockDateNowSupplier DATE_NOW_SUPPLIER = new MockDateNowSupplier();

public TestHanaDialect(DSLContext dslContext) {
super(dslContext);
}

@Override
public List<SelectConverter<? extends Select>> getSelectConverters() {
return this.customizeSelectConverters(List.of(
new DateDistanceSelectConverter(new MockDateNowSupplier())
new DateDistanceSelectConverter(DATE_NOW_SUPPLIER)
));
}

@Override
public List<FilterConverter<?, ?>> getFilterConverters() {
return this.customizeFilterConverters(List.of(
new DateDistanceFilterConverter(DATE_NOW_SUPPLIER)
));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import com.bakdata.conquery.sql.DslContextFactory;
import com.bakdata.conquery.sql.SqlQuery;
import com.bakdata.conquery.sql.conquery.SqlManagedQuery;
import com.bakdata.conquery.sql.conversion.cqelement.concept.filter.DateDistanceFilterConverter;
import com.bakdata.conquery.sql.conversion.cqelement.concept.filter.FilterConverter;
import com.bakdata.conquery.sql.conversion.cqelement.concept.select.DateDistanceSelectConverter;
import com.bakdata.conquery.sql.conversion.cqelement.concept.select.SelectConverter;
import com.bakdata.conquery.sql.conversion.dialect.PostgreSqlDialect;
Expand Down Expand Up @@ -92,14 +94,23 @@ public Stream<DynamicTest> sqlBackendTests() {

private static class TestPostgreSqlDialect extends PostgreSqlDialect implements TestSqlDialect {

public static final MockDateNowSupplier DATE_NOW_SUPPLIER = new MockDateNowSupplier();

public TestPostgreSqlDialect(DSLContext dslContext) {
super(dslContext);
}

@Override
public List<SelectConverter<? extends Select>> getSelectConverters() {
return this.customizeSelectConverters(List.of(
new DateDistanceSelectConverter(new MockDateNowSupplier())
new DateDistanceSelectConverter(DATE_NOW_SUPPLIER)
));
}

@Override
public List<FilterConverter<?, ?>> getFilterConverters() {
return this.customizeFilterConverters(List.of(
new DateDistanceFilterConverter(DATE_NOW_SUPPLIER)
));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pid,dates
6,{}
7,{}

0 comments on commit 978f3c0

Please sign in to comment.