msfroh commented on code in PR #16173:
URL: https://github.com/apache/lucene/pull/16173#discussion_r3724464568


##########
lucene/core/src/test/org/apache/lucene/store/TestFilterDirectory.java:
##########
@@ -45,6 +42,21 @@ public void testOverrides() throws Exception {
     }
   }
 
+  public void testCopyFromDelegates() throws IOException {

Review Comment:
   You could try:
   
   ```
       try (Directory srcDir = new ByteBuffersDirectory();
           Directory destDir = new ByteBuffersDirectory()) {
         try (IndexOutput out = srcDir.createOutput("test.txt", 
IOContext.DEFAULT)) {
           out.writeString("hello");
         }
         boolean[] delegated = {false};
         FilterDirectory wrappedDestDir = new FilterDirectory(destDir) {
           @Override
           public void copyFrom(Directory from, String src, String dest, 
IOContext context) throws IOException {
             delegated[0] = true;
             in.copyFrom(from, src, dest, context);
           }
         };
         FilterDirectory filterDestDir = new FilterDirectory(wrappedDestDir) {};
         filterDestDir.copyFrom(srcDir, "test.txt", "copied.txt", 
IOContext.DEFAULT);
         assertTrue(delegated[0]);
         assertTrue(slowFileExists(destDir, "copied.txt"));
         try (IndexInput in = destDir.openInput("copied.txt", 
IOContext.DEFAULT)) {
           assertEquals("hello", in.readString());
         }
       }
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to