Search in sources :

Example 6 with ExplodedArchive

use of org.springframework.boot.loader.archive.ExplodedArchive in project spring-boot by spring-projects.

the class JarLauncherTests method explodedJarHasOnlyBootInfClassesAndContentsOfBootInfLibOnClasspath.

@Test
public void explodedJarHasOnlyBootInfClassesAndContentsOfBootInfLibOnClasspath() throws Exception {
    File explodedRoot = explode(createJarArchive("archive.jar", "BOOT-INF"));
    JarLauncher launcher = new JarLauncher(new ExplodedArchive(explodedRoot, true));
    List<Archive> archives = launcher.getClassPathArchives();
    assertThat(archives).hasSize(2);
    assertThat(getUrls(archives)).containsOnly(new File(explodedRoot, "BOOT-INF/classes").toURI().toURL(), new URL("jar:" + new File(explodedRoot, "BOOT-INF/lib/foo.jar").toURI().toURL() + "!/"));
}
Also used : ExplodedArchive(org.springframework.boot.loader.archive.ExplodedArchive) JarFileArchive(org.springframework.boot.loader.archive.JarFileArchive) ExplodedArchive(org.springframework.boot.loader.archive.ExplodedArchive) Archive(org.springframework.boot.loader.archive.Archive) File(java.io.File) URL(java.net.URL) Test(org.junit.Test)

Aggregations

ExplodedArchive (org.springframework.boot.loader.archive.ExplodedArchive)6 JarFileArchive (org.springframework.boot.loader.archive.JarFileArchive)5 File (java.io.File)4 Archive (org.springframework.boot.loader.archive.Archive)4 URL (java.net.URL)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 URI (java.net.URI)1 CodeSource (java.security.CodeSource)1 ProtectionDomain (java.security.ProtectionDomain)1 Manifest (java.util.jar.Manifest)1 JarFile (org.springframework.boot.loader.jar.JarFile)1