mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 17:07:15 +02:00
Only inject @Parameter-created variables in the Action itself
Icann reports have 3 parameter-provided injections: - yearMonth - subdir - reportType We move all of them away from the "inner classes" and only @Inject them in the Actions themselves. This has 2 benefits: - it's much clearer what all the parameter inputs of the Actions are - the "inner injected classes" don't assume anything about the Action that uses them - they will work just as well for JSON actions as for "regular" actions. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=233625765
This commit is contained in:
parent
e6c46cab58
commit
4097dae3b2
20 changed files with 364 additions and 270 deletions
|
@ -27,9 +27,10 @@ import org.junit.runners.JUnit4;
|
|||
@RunWith(JUnit4.class)
|
||||
public class TransactionsReportingQueryBuilderTest {
|
||||
|
||||
private final YearMonth yearMonth = new YearMonth(2017, 9);
|
||||
|
||||
private TransactionsReportingQueryBuilder getQueryBuilder() {
|
||||
TransactionsReportingQueryBuilder queryBuilder = new TransactionsReportingQueryBuilder();
|
||||
queryBuilder.yearMonth = new YearMonth(2017, 9);
|
||||
queryBuilder.projectId = "domain-registry-alpha";
|
||||
return queryBuilder;
|
||||
}
|
||||
|
@ -37,7 +38,7 @@ public class TransactionsReportingQueryBuilderTest {
|
|||
@Test
|
||||
public void testAggregateQueryMatch() {
|
||||
TransactionsReportingQueryBuilder queryBuilder = getQueryBuilder();
|
||||
assertThat(queryBuilder.getReportQuery())
|
||||
assertThat(queryBuilder.getReportQuery(yearMonth))
|
||||
.isEqualTo(
|
||||
"#standardSQL\nSELECT * FROM "
|
||||
+ "`domain-registry-alpha.icann_reporting.transactions_report_aggregation_201709`");
|
||||
|
@ -56,7 +57,7 @@ public class TransactionsReportingQueryBuilderTest {
|
|||
TransactionsReportingQueryBuilder.ATTEMPTED_ADDS);
|
||||
|
||||
TransactionsReportingQueryBuilder queryBuilder = getQueryBuilder();
|
||||
ImmutableMap<String, String> actualQueries = queryBuilder.getViewQueryMap();
|
||||
ImmutableMap<String, String> actualQueries = queryBuilder.getViewQueryMap(yearMonth);
|
||||
for (String queryName : expectedQueryNames) {
|
||||
String actualTableName = String.format("%s_201709", queryName);
|
||||
String testFilename = String.format("%s_test.sql", queryName);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue