@Override public final boolean equals(Object obj) { return obj == this || obj != null && obj.getClass().equals(ExtractStatistics.class) && baseEquals((ExtractStatistics) obj); }
@Override public final int hashCode() { return Objects.hash(baseHashCode(), destinationUriFileCounts); }
@SuppressWarnings("unchecked") static <T extends JobStatistics> T fromPb(com.google.api.services.bigquery.model.Job jobPb) { JobConfiguration jobConfigPb = jobPb.getConfiguration(); com.google.api.services.bigquery.model.JobStatistics statisticPb = jobPb.getStatistics(); if (jobConfigPb.getLoad() != null) { return (T) LoadStatistics.fromPb(statisticPb); } else if (jobConfigPb.getExtract() != null) { return (T) ExtractStatistics.fromPb(statisticPb); } else if (jobConfigPb.getQuery() != null) { return (T) QueryStatistics.fromPb(statisticPb); } else if (jobConfigPb.getCopy() != null) { return (T) CopyStatistics.fromPb(statisticPb); } else { throw new IllegalArgumentException("unknown job configuration: " + jobConfigPb); } } }
@SuppressWarnings("unchecked") static <T extends JobStatistics> T fromPb( com.google.api.services.bigquery.model.JobStatistics statisticPb) { if (statisticPb.getLoad() != null) { return (T) LoadStatistics.fromPb(statisticPb); } else if (statisticPb.getExtract() != null) { return (T) ExtractStatistics.fromPb(statisticPb); } else if (statisticPb.getQuery() != null) { return (T) QueryStatistics.fromPb(statisticPb); } else { return (T) CopyStatistics.fromPb(statisticPb); } } }
@Override public final int hashCode() { return Objects.hash(baseHashCode(), destinationUriFileCounts); }
@Override public final int hashCode() { return Objects.hash(baseHashCode(), destinationUriFileCounts); }
@Override public final boolean equals(Object obj) { return obj == this || obj != null && obj.getClass().equals(ExtractStatistics.class) && baseEquals((ExtractStatistics) obj); }
@Override ExtractStatistics build() { return new ExtractStatistics(this); } }
@Override public final boolean equals(Object obj) { return obj == this || obj != null && obj.getClass().equals(ExtractStatistics.class) && baseEquals((ExtractStatistics) obj); }
@Override ExtractStatistics build() { return new ExtractStatistics(this); } }
@Test public void testBuilder() { assertEquals(CREATION_TIME, EXTRACT_STATISTICS.getCreationTime()); assertEquals(START_TIME, EXTRACT_STATISTICS.getStartTime()); assertEquals(END_TIME, EXTRACT_STATISTICS.getEndTime()); assertEquals(FILE_COUNT, EXTRACT_STATISTICS.getDestinationUriFileCounts());
@SuppressWarnings("unchecked") static <T extends JobStatistics> T fromPb(com.google.api.services.bigquery.model.Job jobPb) { JobConfiguration jobConfigPb = jobPb.getConfiguration(); com.google.api.services.bigquery.model.JobStatistics statisticPb = jobPb.getStatistics(); if (jobConfigPb.getLoad() != null) { return (T) LoadStatistics.fromPb(statisticPb); } else if (jobConfigPb.getExtract() != null) { return (T) ExtractStatistics.fromPb(statisticPb); } else if (jobConfigPb.getQuery() != null) { return (T) QueryStatistics.fromPb(statisticPb); } else if (jobConfigPb.getCopy() != null) { return (T) CopyStatistics.fromPb(statisticPb); } else { throw new IllegalArgumentException("unknown job configuration: " + jobConfigPb); } } }
@Override ExtractStatistics build() { return new ExtractStatistics(this); } }
private void compareExtractStatistics(ExtractStatistics expected, ExtractStatistics value) { assertEquals(expected, value); compareStatistics(expected, value); assertEquals(expected.getDestinationUriFileCounts(), value.getDestinationUriFileCounts()); }
@Test public void testToPbAndFromPb() { compareExtractStatistics( EXTRACT_STATISTICS, ExtractStatistics.fromPb(EXTRACT_STATISTICS.toPb())); compareLoadStatistics(LOAD_STATISTICS, LoadStatistics.fromPb(LOAD_STATISTICS.toPb())); compareQueryStatistics(QUERY_STATISTICS, QueryStatistics.fromPb(QUERY_STATISTICS.toPb())); compareStatistics(COPY_STATISTICS, CopyStatistics.fromPb(COPY_STATISTICS.toPb())); compareLoadStatistics( LOAD_STATISTICS_INCOMPLETE, LoadStatistics.fromPb(LOAD_STATISTICS_INCOMPLETE.toPb())); compareQueryStatistics( QUERY_STATISTICS_INCOMPLETE, QueryStatistics.fromPb(QUERY_STATISTICS_INCOMPLETE.toPb())); }