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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]