[ 
https://issues.apache.org/jira/browse/BEAM-3606?focusedWorklogId=253956&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-253956
 ]

ASF GitHub Bot logged work on BEAM-3606:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 04/Jun/19 19:06
            Start Date: 04/Jun/19 19:06
    Worklog Time Spent: 10m 
      Work Description: youngoli commented on pull request #8759: [BEAM-3606] 
Remove guava-testlib from sdks/java/core main dependency set
URL: https://github.com/apache/beam/pull/8759#discussion_r290450318
 
 

 ##########
 File path: 
sdks/java/core/src/main/java/org/apache/beam/sdk/io/fs/ResourceIdTester.java
 ##########
 @@ -77,31 +80,58 @@ private static void validateResolvingIds(
     allResourceIds.add(dir2);
 
     // ResourceIds in equality groups.
-    new EqualsTester()
-        .addEqualityGroup(file1)
-        .addEqualityGroup(file2, file2a)
-        .addEqualityGroup(dir1, dir1.getCurrentDirectory())
-        .addEqualityGroup(dir2, dir2a, dir2.getCurrentDirectory())
-        .addEqualityGroup(baseDirectory, file1.getCurrentDirectory(), 
file2.getCurrentDirectory())
-        .testEquals();
+    assertEqualityGroups(
+        Arrays.asList(
+            Arrays.asList(file1),
+            Arrays.asList(file2, file2a),
+            Arrays.asList(dir1, dir1.getCurrentDirectory()),
+            Arrays.asList(dir2, dir2a, dir2.getCurrentDirectory()),
+            Arrays.asList(
+                baseDirectory, file1.getCurrentDirectory(), 
file2.getCurrentDirectory())));
 
     // ResourceId toString() in equality groups.
-    new EqualsTester()
-        .addEqualityGroup(file1.toString())
-        .addEqualityGroup(file2.toString(), file2a.toString())
-        .addEqualityGroup(dir1.toString(), 
dir1.getCurrentDirectory().toString())
-        .addEqualityGroup(dir2.toString(), dir2a.toString(), 
dir2.getCurrentDirectory().toString())
-        .addEqualityGroup(
-            baseDirectory.toString(),
-            file1.getCurrentDirectory().toString(),
-            file2.getCurrentDirectory().toString())
-        .testEquals();
+    assertEqualityGroups(
+        Arrays.asList(
+            Arrays.asList(file1.toString()),
+            Arrays.asList(file2.toString(), file2a.toString()),
+            Arrays.asList(dir1.toString(), 
dir1.getCurrentDirectory().toString()),
+            Arrays.asList(dir2.toString(), dir2a.toString(), 
dir2.getCurrentDirectory().toString()),
+            Arrays.asList(
+                baseDirectory.toString(),
+                file1.getCurrentDirectory().toString(),
+                file2.getCurrentDirectory().toString())));
 
     // TODO: test resolving strings that need to be escaped.
     //   Possible spec: https://tools.ietf.org/html/rfc3986#section-2
     //   May need options to be filesystem-independent, e.g., if filesystems 
ban certain chars.
   }
 
+  /**
+   * Asserts that all elements in each group are equal to each other but not 
equal to any other
+   * element in another group.
+   */
+  private static <T> void assertEqualityGroups(List<List<T>> equalityGroups) {
+    for (int i = 0; i < equalityGroups.size(); ++i) {
+      List<T> current = equalityGroups.get(i);
+      for (int j = 0; j < current.size(); ++j) {
+        for (int k = 0; k < current.size(); ++k) {
+          assertEquals(
+              "Value at " + j + " should equal value at " + k + " in equality 
group " + i,
+              current.get(j),
+              current.get(k));
+        }
+      }
+      for (int j = 0; j < equalityGroups.size(); ++j) {
 
 Review comment:
   Here too, it seems like you could just do `int j = i + 1` and avoid 
duplicate comparisons (and self comparisons)
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 253956)
    Time Spent: 50m  (was: 40m)

> Improve our relationship, or lack thereof, with Guava
> -----------------------------------------------------
>
>                 Key: BEAM-3606
>                 URL: https://issues.apache.org/jira/browse/BEAM-3606
>             Project: Beam
>          Issue Type: Improvement
>          Components: io-java-gcp, runner-core, sdk-java-core
>            Reporter: Kenneth Knowles
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> This is an umbrella task for things that might move us off Guava, such as 
> replicating our own little utilities or moving to Java 8 features.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to