Java 类org.springframework.boot.loader.archive.Archive.Entry 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:PropertiesLauncher.java   
private void addNestedEntries(List<Archive> lib) {
    // The parent archive might have "BOOT-INF/lib/" and "BOOT-INF/classes/"
    // directories, meaning we are running from an executable JAR. We add nested
    // entries from there with low priority (i.e. at end).
    try {
        lib.addAll(this.parent.getNestedArchives(new EntryFilter() {

            @Override
            public boolean matches(Entry entry) {
                if (entry.isDirectory()) {
                    return entry.getName().startsWith(JarLauncher.BOOT_INF_CLASSES);
                }
                return entry.getName().startsWith(JarLauncher.BOOT_INF_LIB);
            }

        }));
    }
    catch (IOException ex) {
        // Ignore
    }
}
项目:spring-boot-concourse    文件:PropertiesLauncher.java   
private void addNestedEntries(List<Archive> lib) {
    // The parent archive might have "BOOT-INF/lib/" and "BOOT-INF/classes/"
    // directories, meaning we are running from an executable JAR. We add nested
    // entries from there with low priority (i.e. at end).
    try {
        lib.addAll(this.parent.getNestedArchives(new EntryFilter() {

            @Override
            public boolean matches(Entry entry) {
                if (entry.isDirectory()) {
                    return entry.getName().startsWith(JarLauncher.BOOT_INF_CLASSES);
                }
                return entry.getName().startsWith(JarLauncher.BOOT_INF_LIB);
            }

        }));
    }
    catch (IOException ex) {
        // Ignore
    }
}
项目:contestparser    文件:ExplodedArchiveTests.java   
@Test
public void getFilteredArchive() throws Exception {
    Archive filteredArchive = this.archive
            .getFilteredArchive(new Archive.EntryRenameFilter() {
                @Override
                public AsciiBytes apply(AsciiBytes entryName, Entry entry) {
                    if (entryName.toString().equals("1.dat")) {
                        return entryName;
                    }
                    return null;
                }
            });
    Map<String, Entry> entries = getEntriesMap(filteredArchive);
    assertThat(entries.size(), equalTo(1));
    URLClassLoader classLoader = new URLClassLoader(
            new URL[] { filteredArchive.getUrl() });
    assertThat(classLoader.getResourceAsStream("1.dat").read(), equalTo(1));
    assertThat(classLoader.getResourceAsStream("2.dat"), nullValue());
    classLoader.close();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:PropertiesLauncher.java   
@Override
public List<Archive> getNestedArchives(final EntryFilter filter)
        throws IOException {
    return this.parent.getNestedArchives(new EntryFilter() {
        @Override
        public boolean matches(Entry entry) {
            return FilteredArchive.this.filter.matches(entry)
                    && filter.matches(entry);
        }
    });
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ExecutableArchiveLauncher.java   
@Override
protected List<Archive> getClassPathArchives() throws Exception {
    List<Archive> archives = new ArrayList<Archive>(
            this.archive.getNestedArchives(new EntryFilter() {

                @Override
                public boolean matches(Entry entry) {
                    return isNestedArchive(entry);
                }

            }));
    postProcessClassPathArchives(archives);
    return archives;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ExplodedArchiveTests.java   
@Test
public void getNestedArchive() throws Exception {
    Entry entry = getEntriesMap(this.archive).get("nested.jar");
    Archive nested = this.archive.getNestedArchive(entry);
    assertThat(nested.getUrl().toString())
            .isEqualTo("jar:" + this.rootFolder.toURI() + "nested.jar!/");
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ExplodedArchiveTests.java   
@Test
public void nestedDirArchive() throws Exception {
    Entry entry = getEntriesMap(this.archive).get("d/");
    Archive nested = this.archive.getNestedArchive(entry);
    Map<String, Entry> nestedEntries = getEntriesMap(nested);
    assertThat(nestedEntries.size()).isEqualTo(1);
    assertThat(nested.getUrl().toString())
            .isEqualTo("file:" + this.rootFolder.toURI().getPath() + "d/");
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ExplodedArchiveTests.java   
@Test
public void getNonRecursiveManifest() throws Exception {
    ExplodedArchive archive = new ExplodedArchive(
            new File("src/test/resources/root"));
    assertThat(archive.getManifest()).isNotNull();
    Map<String, Archive.Entry> entries = getEntriesMap(archive);
    assertThat(entries.size()).isEqualTo(4);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ExplodedArchiveTests.java   
@Test
public void getNonRecursiveManifestEvenIfNonRecursive() throws Exception {
    ExplodedArchive archive = new ExplodedArchive(new File("src/test/resources/root"),
            false);
    assertThat(archive.getManifest()).isNotNull();
    Map<String, Archive.Entry> entries = getEntriesMap(archive);
    assertThat(entries.size()).isEqualTo(3);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ExplodedArchiveTests.java   
private Map<String, Archive.Entry> getEntriesMap(Archive archive) {
    Map<String, Archive.Entry> entries = new HashMap<String, Archive.Entry>();
    for (Archive.Entry entry : archive) {
        entries.put(entry.getName().toString(), entry);
    }
    return entries;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JarFileArchiveTests.java   
@Test
public void getNestedArchive() throws Exception {
    Entry entry = getEntriesMap(this.archive).get("nested.jar");
    Archive nested = this.archive.getNestedArchive(entry);
    assertThat(nested.getUrl().toString())
            .isEqualTo("jar:" + this.rootJarFileUrl + "!/nested.jar!/");
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JarFileArchiveTests.java   
@Test
public void getNestedUnpackedArchive() throws Exception {
    setup(true);
    Entry entry = getEntriesMap(this.archive).get("nested.jar");
    Archive nested = this.archive.getNestedArchive(entry);
    assertThat(nested.getUrl().toString()).startsWith("file:");
    assertThat(nested.getUrl().toString()).endsWith("/nested.jar");
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JarFileArchiveTests.java   
@Test
public void unpackedLocationsAreUniquePerArchive() throws Exception {
    setup(true);
    Entry entry = getEntriesMap(this.archive).get("nested.jar");
    URL firstNested = this.archive.getNestedArchive(entry).getUrl();
    setup(true);
    entry = getEntriesMap(this.archive).get("nested.jar");
    URL secondNested = this.archive.getNestedArchive(entry).getUrl();
    assertThat(secondNested).isNotEqualTo(firstNested);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JarFileArchiveTests.java   
private Map<String, Archive.Entry> getEntriesMap(Archive archive) {
    Map<String, Archive.Entry> entries = new HashMap<String, Archive.Entry>();
    for (Archive.Entry entry : archive) {
        entries.put(entry.getName().toString(), entry);
    }
    return entries;
}
项目:spring-boot-concourse    文件:PropertiesLauncher.java   
@Override
public List<Archive> getNestedArchives(final EntryFilter filter)
        throws IOException {
    return this.parent.getNestedArchives(new EntryFilter() {
        @Override
        public boolean matches(Entry entry) {
            return FilteredArchive.this.filter.matches(entry)
                    && filter.matches(entry);
        }
    });
}
项目:spring-boot-concourse    文件:ExecutableArchiveLauncher.java   
@Override
protected List<Archive> getClassPathArchives() throws Exception {
    List<Archive> archives = new ArrayList<Archive>(
            this.archive.getNestedArchives(new EntryFilter() {

                @Override
                public boolean matches(Entry entry) {
                    return isNestedArchive(entry);
                }

            }));
    postProcessClassPathArchives(archives);
    return archives;
}
项目:spring-boot-concourse    文件:ExplodedArchiveTests.java   
@Test
public void getNestedArchive() throws Exception {
    Entry entry = getEntriesMap(this.archive).get("nested.jar");
    Archive nested = this.archive.getNestedArchive(entry);
    assertThat(nested.getUrl().toString())
            .isEqualTo("jar:" + this.rootFolder.toURI() + "nested.jar!/");
}
项目:spring-boot-concourse    文件:ExplodedArchiveTests.java   
@Test
public void nestedDirArchive() throws Exception {
    Entry entry = getEntriesMap(this.archive).get("d/");
    Archive nested = this.archive.getNestedArchive(entry);
    Map<String, Entry> nestedEntries = getEntriesMap(nested);
    assertThat(nestedEntries.size()).isEqualTo(1);
    assertThat(nested.getUrl().toString())
            .isEqualTo("file:" + this.rootFolder.toURI().getPath() + "d/");
}
项目:spring-boot-concourse    文件:ExplodedArchiveTests.java   
@Test
public void getNonRecursiveManifest() throws Exception {
    ExplodedArchive archive = new ExplodedArchive(
            new File("src/test/resources/root"));
    assertThat(archive.getManifest()).isNotNull();
    Map<String, Archive.Entry> entries = getEntriesMap(archive);
    assertThat(entries.size()).isEqualTo(4);
}
项目:spring-boot-concourse    文件:ExplodedArchiveTests.java   
@Test
public void getNonRecursiveManifestEvenIfNonRecursive() throws Exception {
    ExplodedArchive archive = new ExplodedArchive(new File("src/test/resources/root"),
            false);
    assertThat(archive.getManifest()).isNotNull();
    Map<String, Archive.Entry> entries = getEntriesMap(archive);
    assertThat(entries.size()).isEqualTo(3);
}
项目:spring-boot-concourse    文件:ExplodedArchiveTests.java   
private Map<String, Archive.Entry> getEntriesMap(Archive archive) {
    Map<String, Archive.Entry> entries = new HashMap<String, Archive.Entry>();
    for (Archive.Entry entry : archive) {
        entries.put(entry.getName().toString(), entry);
    }
    return entries;
}
项目:spring-boot-concourse    文件:JarFileArchiveTests.java   
@Test
public void getNestedArchive() throws Exception {
    Entry entry = getEntriesMap(this.archive).get("nested.jar");
    Archive nested = this.archive.getNestedArchive(entry);
    assertThat(nested.getUrl().toString())
            .isEqualTo("jar:" + this.rootJarFileUrl + "!/nested.jar!/");
}
项目:spring-boot-concourse    文件:JarFileArchiveTests.java   
@Test
public void getNestedUnpackedArchive() throws Exception {
    setup(true);
    Entry entry = getEntriesMap(this.archive).get("nested.jar");
    Archive nested = this.archive.getNestedArchive(entry);
    assertThat(nested.getUrl().toString()).startsWith("file:");
    assertThat(nested.getUrl().toString()).endsWith("/nested.jar");
}
项目:spring-boot-concourse    文件:JarFileArchiveTests.java   
@Test
public void unpackedLocationsAreUniquePerArchive() throws Exception {
    setup(true);
    Entry entry = getEntriesMap(this.archive).get("nested.jar");
    URL firstNested = this.archive.getNestedArchive(entry).getUrl();
    setup(true);
    entry = getEntriesMap(this.archive).get("nested.jar");
    URL secondNested = this.archive.getNestedArchive(entry).getUrl();
    assertThat(secondNested).isNotEqualTo(firstNested);
}
项目:spring-boot-concourse    文件:JarFileArchiveTests.java   
private Map<String, Archive.Entry> getEntriesMap(Archive archive) {
    Map<String, Archive.Entry> entries = new HashMap<String, Archive.Entry>();
    for (Archive.Entry entry : archive) {
        entries.put(entry.getName().toString(), entry);
    }
    return entries;
}
项目:contestparser    文件:ExecutableArchiveLauncher.java   
@Override
protected List<Archive> getClassPathArchives() throws Exception {
    List<Archive> archives = new ArrayList<Archive>(
            this.archive.getNestedArchives(new EntryFilter() {
                @Override
                public boolean matches(Entry entry) {
                    return isNestedArchive(entry);
                }
            }));
    postProcessClassPathArchives(archives);
    return archives;
}
项目:contestparser    文件:ExplodedArchiveTests.java   
@Test
public void getNestedArchive() throws Exception {
    Entry entry = getEntriesMap(this.archive).get("nested.jar");
    Archive nested = this.archive.getNestedArchive(entry);
    assertThat(nested.getUrl().toString(),
            equalTo("jar:" + this.rootFolder.toURI() + "nested.jar!/"));
}
项目:contestparser    文件:ExplodedArchiveTests.java   
@Test
public void nestedDirArchive() throws Exception {
    Entry entry = getEntriesMap(this.archive).get("d/");
    Archive nested = this.archive.getNestedArchive(entry);
    Map<String, Entry> nestedEntries = getEntriesMap(nested);
    assertThat(nestedEntries.size(), equalTo(1));
    assertThat(nested.getUrl().toString(),
            equalTo("file:" + this.rootFolder.toURI().getPath() + "d/"));
}
项目:contestparser    文件:ExplodedArchiveTests.java   
@Test
public void getNonRecursiveManifest() throws Exception {
    ExplodedArchive archive = new ExplodedArchive(
            new File("src/test/resources/root"));
    assertNotNull(archive.getManifest());
    Map<String, Archive.Entry> entries = getEntriesMap(archive);
    assertThat(entries.size(), equalTo(4));
}
项目:contestparser    文件:ExplodedArchiveTests.java   
@Test
public void getNonRecursiveManifestEvenIfNonRecursive() throws Exception {
    ExplodedArchive archive = new ExplodedArchive(new File("src/test/resources/root"),
            false);
    assertNotNull(archive.getManifest());
    Map<String, Archive.Entry> entries = getEntriesMap(archive);
    assertThat(entries.size(), equalTo(3));
}
项目:contestparser    文件:ExplodedArchiveTests.java   
private Map<String, Archive.Entry> getEntriesMap(Archive archive) {
    Map<String, Archive.Entry> entries = new HashMap<String, Archive.Entry>();
    for (Archive.Entry entry : archive.getEntries()) {
        entries.put(entry.getName().toString(), entry);
    }
    return entries;
}
项目:contestparser    文件:JarFileArchiveTests.java   
@Test
public void getNestedArchive() throws Exception {
    Entry entry = getEntriesMap(this.archive).get("nested.jar");
    Archive nested = this.archive.getNestedArchive(entry);
    assertThat(nested.getUrl().toString(),
            equalTo("jar:" + this.rootJarFileUrl + "!/nested.jar!/"));
}
项目:contestparser    文件:JarFileArchiveTests.java   
@Test
public void getNestedUnpackedArchive() throws Exception {
    setup(true);
    Entry entry = getEntriesMap(this.archive).get("nested.jar");
    Archive nested = this.archive.getNestedArchive(entry);
    assertThat(nested.getUrl().toString(), startsWith("file:"));
    assertThat(nested.getUrl().toString(), endsWith("/nested.jar"));
}
项目:contestparser    文件:JarFileArchiveTests.java   
@Test
public void unpackedLocationsAreUniquePerArchive() throws Exception {
    setup(true);
    Entry entry = getEntriesMap(this.archive).get("nested.jar");
    URL firstNested = this.archive.getNestedArchive(entry).getUrl();
    setup(true);
    entry = getEntriesMap(this.archive).get("nested.jar");
    URL secondNested = this.archive.getNestedArchive(entry).getUrl();
    assertThat(secondNested, is(not(equalTo(firstNested))));
}
项目:contestparser    文件:JarFileArchiveTests.java   
@Test
public void getFilteredArchive() throws Exception {
    Archive filteredArchive = this.archive
            .getFilteredArchive(new Archive.EntryRenameFilter() {
                @Override
                public AsciiBytes apply(AsciiBytes entryName, Entry entry) {
                    if (entryName.toString().equals("1.dat")) {
                        return entryName;
                    }
                    return null;
                }
            });
    Map<String, Entry> entries = getEntriesMap(filteredArchive);
    assertThat(entries.size(), equalTo(1));
}
项目:contestparser    文件:JarFileArchiveTests.java   
private Map<String, Archive.Entry> getEntriesMap(Archive archive) {
    Map<String, Archive.Entry> entries = new HashMap<String, Archive.Entry>();
    for (Archive.Entry entry : archive.getEntries()) {
        entries.put(entry.getName().toString(), entry);
    }
    return entries;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:PropertiesLauncher.java   
@Override
public boolean matches(Entry entry) {
    return entry.getName().startsWith(this.prefix) && this.filter.matches(entry);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:PropertiesLauncher.java   
@Override
public boolean matches(Entry entry) {
    return entry.getName().endsWith(DOT_JAR) || entry.getName().endsWith(DOT_ZIP);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:PropertiesLauncher.java   
@Override
public Iterator<Entry> iterator() {
    throw new UnsupportedOperationException();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:ExplodedArchiveTests.java   
@Test
public void getEntries() throws Exception {
    Map<String, Archive.Entry> entries = getEntriesMap(this.archive);
    assertThat(entries.size()).isEqualTo(10);
}