Add activity reporting SQL query generation code

This allows us to have a modular view of all tables used in activity reporting, to facilitate generating reports in BigQuery.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=161849007
This commit is contained in:
larryruili 2017-07-21 12:45:28 -04:00 committed by Ben McIlwain
parent 2521409e39
commit 4887811fc3
17 changed files with 743 additions and 1 deletions

View file

@ -14,8 +14,11 @@
package google.registry.reporting;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.io.ByteSource;
import com.google.common.io.Resources;
import java.io.IOException;
import java.net.URL;
/** Utility class providing easy access to contents of the {@code testdata/} directory. */
@ -26,7 +29,12 @@ public final class ReportingTestData {
return Resources.asByteSource(getUrl(filename));
}
private static URL getUrl(String filename) {
/** Returns a {@link String} from a file in the {@code reporting/testdata/} directory. */
public static String getString(String filename) throws IOException {
return Resources.asCharSource(getUrl(filename), UTF_8).read();
}
private static URL getUrl(String filename) {
return Resources.getResource(ReportingTestData.class, "testdata/" + filename);
}
}