Use relative paths in classpath to shorten execution line on large apps

This commit is contained in:
Benjamin König
2022-02-18 14:28:29 +01:00
parent bb4b9e3390
commit 9a99f4e27d
4 changed files with 13 additions and 20 deletions
@@ -36,8 +36,8 @@ public class ClassPathTest
@Test public void shouldCreateValidArgumentString ()
{
assertEquals(
_firstJar.getAbsolutePath() + File.pathSeparator + _secondJar.getAbsolutePath(),
_classPath.asArgumentString());
"a.jar:b.jar",
_classPath.asArgumentString(_folder.getRoot()));
}
@Test public void shouldProvideJarUrls () throws MalformedURLException, URISyntaxException
@@ -36,9 +36,7 @@ public class PathBuilderTest
@Test public void shouldBuildDefaultClassPath () throws IOException
{
ClassPath classPath = PathBuilder.buildDefaultClassPath(_application);
String expectedClassPath = _firstJarFile.getAbsolutePath() + File.pathSeparator +
_secondJarFile.getAbsolutePath();
assertEquals(expectedClassPath, classPath.asArgumentString());
assertEquals("a.jar:b.jar", classPath.asArgumentString(_appdir.getRoot()));
}
@Test public void shouldBuildCachedClassPath () throws IOException
@@ -47,17 +45,8 @@ public class PathBuilderTest
when(_application.getDigest(_secondJar)).thenReturn("second");
when(_application.getCodeCacheRetentionDays()).thenReturn(1);
Path firstCachedJarFile = _appdir.getRoot().toPath().
resolve(PathBuilder.CODE_CACHE_DIR).resolve("fi").resolve("first.jar");
Path secondCachedJarFile = _appdir.getRoot().toPath().
resolve(PathBuilder.CODE_CACHE_DIR).resolve("se").resolve("second.jar");
String expectedClassPath = firstCachedJarFile.toAbsolutePath() + File.pathSeparator +
secondCachedJarFile.toAbsolutePath();
ClassPath classPath = PathBuilder.buildCachedClassPath(_application);
assertEquals(expectedClassPath, classPath.asArgumentString());
assertEquals(".cache/fi/first.jar:.cache/se/second.jar", classPath.asArgumentString(_appdir.getRoot()));
}
@Mock protected Application _application;