Skip to content

Commit

Permalink
chore(tests): fine tune clirr exceptions
Browse files Browse the repository at this point in the history
Provide method level exception configuration in clirr-ignored-differences.
Implement default methods for new methods in Logging and LoggingRpc interfaces.
Following guidelines, remove serialVersionUID from LogNamePageFetcher.
  • Loading branch information
minherz committed Aug 8, 2021
1 parent 086b074 commit 3470716
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions google-cloud-logging/clirr-ignored-differences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<difference>
<differenceType>7012</differenceType>
<className>com/google/cloud/logging/Logging</className>
<method>*</method>
<method>* listLogs*(com.google.cloud.logging.Logging$ListOption[])</method>
</difference>
<!-- Added methods to com.google.cloud.logging.spi.v2.LoggingRpc interface with implementation in GrpcLoggingRpc is always okay -->
<difference>
<differenceType>7012</differenceType>
<className>com/google/cloud/logging/spi/v2/LoggingRpc</className>
<method>*</method>
<method>* list(com.google.logging.v2.ListLogsRequest)</method>
</difference>
</differences>
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,10 @@ public static EntryListOption folder(String folder) {
*
* @throws LoggingException upon failure
*/
Page<String> listLogs(ListOption... options);
default Page<String> listLogs(ListOption... options) {
throw new UnsupportedOperationException(
"method listLogs() does not have default implementation");
}

/**
* Sends a request for listing log names. This method returns a {@code ApiFuture} object to
Expand All @@ -453,7 +456,10 @@ public static EntryListOption folder(String folder) {
* }
* }</pre>
*/
ApiFuture<AsyncPage<String>> listLogsAsync(ListOption... options);
default ApiFuture<AsyncPage<String>> listLogsAsync(ListOption... options) {
throw new UnsupportedOperationException(
"method listLogsAsync() does not have default implementation");
}

/**
* Deletes a log and all its log entries. The log will reappear if new entries are written to it.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,6 @@ public ApiFuture<AsyncPage<Sink>> getNextPage() {

private static class LogNamePageFetcher extends BasePageFetcher<String> {

private static final long serialVersionUID = 7156613795615829594L;

LogNamePageFetcher(
LoggingOptions serviceOptions, String cursor, Map<Option.OptionType, ?> requestOptions) {
super(serviceOptions, cursor, requestOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ public interface LoggingRpc extends AutoCloseable, ServiceRpc {
*
* @param request the request object containing all of the parameters for the API call
*/
ApiFuture<ListLogsResponse> list(ListLogsRequest request);
default ApiFuture<ListLogsResponse> list(ListLogsRequest request) {
throw new UnsupportedOperationException(
"method list(ListLogsRequest request) does not have default implementation");
}

/**
* Sends a request to deletes a log. This method returns a {@code ApiFuture} object to consume the
Expand Down

0 comments on commit 3470716

Please sign in to comment.