@Test void testInvalidMirrors() { metaRepo.commit(Revision.HEAD, 0, Author.SYSTEM, "", Change.ofJsonUpsert(PATH_MIRRORS, "{}")).join(); assertThatThrownBy(() -> metaRepo.mirrors()).isInstanceOf(RepositoryMetadataException.class); metaRepo.commit(Revision.HEAD, 0, Author.SYSTEM, "", Change.ofJsonUpsert(PATH_MIRRORS, "\"oops\"")).join(); assertThatThrownBy(() -> metaRepo.mirrors()).isInstanceOf(RepositoryMetadataException.class); metaRepo.commit(Revision.HEAD, 0, Author.SYSTEM, "", Change.ofJsonUpsert(PATH_MIRRORS, "[ null ]")).join(); assertThatThrownBy(() -> metaRepo.mirrors()).isInstanceOf(RepositoryMetadataException.class); }
@Override public Set<Mirror> mirrors() { mirrorLock.lock(); try { final int headRev = normalizeNow(Revision.HEAD).major(); final Set<String> repos = parent().repos().list().keySet(); if (headRev > mirrorRev || !mirrorRepos.equals(repos)) { mirrors = loadMirrors(headRev); mirrorRev = headRev; mirrorRepos = repos; } return mirrors; } finally { mirrorLock.unlock(); } }
DefaultMetaRepository extends RepositoryWrapper implements MetaRepository { @Override public Set<Mirror> mirrors() { mirrorLock.lock(); try { final int headRev = normalizeNow(Revision.HEAD).major(); final Set<String> repos = parent().repos().list().keySet(); if (headRev > mirrorRev || !mirrorRepos.equals(repos)) { mirrors = loadMirrors(headRev); mirrorRev = headRev; mirrorRepos = repos; } return mirrors; } finally { mirrorLock.unlock(); } } }
DefaultMetaRepository extends RepositoryWrapper implements MetaRepository { @Override public Set<Mirror> mirrors() { mirrorLock.lock(); try { final int headRev = normalizeNow(Revision.HEAD).major(); final Set<String> repos = parent().repos().list().keySet(); if (headRev > mirrorRev || !mirrorRepos.equals(repos)) { mirrors = loadMirrors(headRev); mirrorRev = headRev; mirrorRepos = repos; } return mirrors; } finally { mirrorLock.unlock(); } } DefaultMetaRepository(Repository repo); }
DefaultMetaRepository extends RepositoryWrapper implements MetaRepository { @Override public Set<Mirror> mirrors() { mirrorLock.lock(); try { final int headRev = normalizeNow(Revision.HEAD).major(); final Set<String> repos = parent().repos().list().keySet(); if (headRev > mirrorRev || !mirrorRepos.equals(repos)) { mirrors = loadMirrors(headRev); mirrorRev = headRev; mirrorRepos = repos; } return mirrors; } finally { mirrorLock.unlock(); } } DefaultMetaRepository(Repository repo); @Override Set<Mirror> mirrors(); }
DefaultMetaRepository extends RepositoryWrapper implements MetaRepository { @Override public Set<Mirror> mirrors() { mirrorLock.lock(); try { final int headRev = normalizeNow(Revision.HEAD).major(); final Set<String> repos = parent().repos().list().keySet(); if (headRev > mirrorRev || !mirrorRepos.equals(repos)) { mirrors = loadMirrors(headRev); mirrorRev = headRev; mirrorRepos = repos; } return mirrors; } finally { mirrorLock.unlock(); } } DefaultMetaRepository(Repository repo); @Override Set<Mirror> mirrors();  }