You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "keith-turner (via GitHub)" <gi...@apache.org> on 2026/01/13 22:46:18 UTC

[PR] tests external modification of cache dir [accumulo-classloaders]

keith-turner opened a new pull request, #38:
URL: https://github.com/apache/accumulo-classloaders/pull/38

   tests code added in #37


-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] tests external modification of cache dir [accumulo-classloaders]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #38:
URL: https://github.com/apache/accumulo-classloaders/pull/38#discussion_r2692595050


##########
modules/local-caching-classloader/src/test/java/org/apache/accumulo/classloader/lcc/LocalCachingContextClassLoaderFactoryTest.java:
##########
@@ -716,4 +716,38 @@ public void testGracePeriod() throws Exception {
 
   }
 
+  @Test
+  public void testExternalFileModification() throws Exception {
+    var def = ContextDefinition.create("update", MONITOR_INTERVAL_SECS, jarAOrigLocation,
+        jarBOrigLocation, jarCOrigLocation, jarDOrigLocation);
+    final Path update =
+        createContextDefinitionFile(fs, "UpdateChangingContextDefinition.json", def.toJson());
+    final URL updatedDefUrl = new URL(fs.getUri().toString() + update.toUri().toString());
+
+    final ClassLoader cl = FACTORY.getClassLoader(updatedDefUrl.toString());
+    testClassLoads(cl, classA);
+    testClassLoads(cl, classB);
+    testClassLoads(cl, classC);
+    testClassLoads(cl, classD);
+
+    var resources = tempDir.resolve("base").resolve("resources");
+    var files = resources.toFile().listFiles();
+    assertEquals(4, files.length);
+
+    // overwrite one downloaded jar with others content
+    Files.copy(files[0].toPath(), files[1].toPath(), StandardCopyOption.REPLACE_EXISTING);

Review Comment:
   Fixed



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] tests external modification of cache dir [accumulo-classloaders]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii merged PR #38:
URL: https://github.com/apache/accumulo-classloaders/pull/38


-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] tests external modification of cache dir [accumulo-classloaders]

Posted by "ctubbsii (via GitHub)" <gi...@apache.org>.
ctubbsii commented on code in PR #38:
URL: https://github.com/apache/accumulo-classloaders/pull/38#discussion_r2692043208


##########
modules/local-caching-classloader/src/test/java/org/apache/accumulo/classloader/lcc/LocalCachingContextClassLoaderFactoryTest.java:
##########
@@ -716,4 +716,38 @@ public void testGracePeriod() throws Exception {
 
   }
 
+  @Test
+  public void testExternalFileModification() throws Exception {
+    var def = ContextDefinition.create("update", MONITOR_INTERVAL_SECS, jarAOrigLocation,
+        jarBOrigLocation, jarCOrigLocation, jarDOrigLocation);
+    final Path update =
+        createContextDefinitionFile(fs, "UpdateChangingContextDefinition.json", def.toJson());
+    final URL updatedDefUrl = new URL(fs.getUri().toString() + update.toUri().toString());
+
+    final ClassLoader cl = FACTORY.getClassLoader(updatedDefUrl.toString());
+    testClassLoads(cl, classA);
+    testClassLoads(cl, classB);
+    testClassLoads(cl, classC);
+    testClassLoads(cl, classD);
+
+    var resources = tempDir.resolve("base").resolve("resources");
+    var files = resources.toFile().listFiles();
+    assertEquals(4, files.length);
+
+    // overwrite one downloaded jar with others content
+    Files.copy(files[0].toPath(), files[1].toPath(), StandardCopyOption.REPLACE_EXISTING);

Review Comment:
   This is making an assumption that the files here are used by this test, and aren't ones that were coming from a different test case. It would probably be better to use two different definitions, one that uses jars A, B, and C, and the other that uses A, B, C, and D, and then getting the file name from the def.getResources() rather than doing a directory listing, which may grab a file from a different test case.



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org