Skip to content

Commit

Permalink
Code cleanup - joinSummaryDoubleLine (#354)
Browse files Browse the repository at this point in the history
Extract the formatting of the summary double-line to the separate
method `joinSummaryDoubleLine`.
  • Loading branch information
dawidxc authored Feb 8, 2024
1 parent b6b4126 commit 3a6be98
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,8 @@ default void println(String s, Object... parameters) {
println(String.format(s, parameters));
}
}

public static String joinSummaryDoubleLine(String firstLine, String secondLine) {
return firstLine + "\n " + secondLine;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package com.google.edwmigration.dumper.application.dumper.connector.redshift;

import static com.google.edwmigration.dumper.application.dumper.SummaryPrinter.joinSummaryDoubleLine;
import static java.util.stream.Collectors.toList;

import com.amazonaws.auth.AWSCredentialsProvider;
Expand Down Expand Up @@ -65,9 +66,7 @@ private String toCallDescription() {

@Override
public String describeSourceData() {
return "Write "
+ ClusterNodes.ZIP_ENTRY_NAME
+ " from AWS API request:\n "
+ toCallDescription();
return joinSummaryDoubleLine(
"Write " + ClusterNodes.ZIP_ENTRY_NAME + " from AWS API request:", toCallDescription());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.google.edwmigration.dumper.application.dumper.connector.redshift;

import static com.google.common.collect.ImmutableList.toImmutableList;
import static com.google.edwmigration.dumper.application.dumper.SummaryPrinter.joinSummaryDoubleLine;
import static java.util.stream.Collectors.groupingBy;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toMap;
Expand Down Expand Up @@ -212,6 +213,7 @@ private String toCallDescription() {

@Override
public String describeSourceData() {
return "Write " + zipEntryName + " from AWS API request:\n " + toCallDescription();
return joinSummaryDoubleLine(
"Write " + zipEntryName + " from AWS API request:", toCallDescription());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
*/
package com.google.edwmigration.dumper.application.dumper.task;

import static com.google.edwmigration.dumper.application.dumper.SummaryPrinter.joinSummaryDoubleLine;
import static java.lang.String.format;

import com.google.common.io.ByteSink;
Expand Down Expand Up @@ -120,7 +121,7 @@ protected String describeSourceData() {
* @return the source data description
*/
protected static String createSourceDataDescriptionForQuery(String query) {
return "from\n " + query;
return joinSummaryDoubleLine("from", query);
}

@Override
Expand Down

0 comments on commit 3a6be98

Please sign in to comment.