use of jetbrains.buildServer.buildTriggers.vcs.git.RepositoryRevisionCache in project teamcity-git by JetBrains.
the class RevisionsCacheTest method get_repo_cache_by_dir.
public void get_repo_cache_by_dir() throws Exception {
RepositoryRevisionCache repoCache1 = myCache.getRepositoryCache(repository("1"), RevisionCacheType.COMMIT_CACHE);
RepositoryRevisionCache repoCache2 = myCache.getRepositoryCache(repository("2"), RevisionCacheType.COMMIT_CACHE);
then(repoCache1).isNotNull();
then(repoCache2).isNotNull();
then(repoCache1).isNotSameAs(repoCache2);
then(repoCache1).isSameAs(myCache.getRepositoryCache(repository("1"), RevisionCacheType.COMMIT_CACHE));
}
use of jetbrains.buildServer.buildTriggers.vcs.git.RepositoryRevisionCache in project teamcity-git by JetBrains.
the class RevisionsCacheTest method save_revision_entry.
public void save_revision_entry() throws Exception {
File repo = repository("1");
RepositoryRevisionCache commitCache = myCache.getRepositoryCache(repo, RevisionCacheType.COMMIT_CACHE);
commitCache.saveRevision("v1", false, commitCache.getResetCounter());
commitCache.saveRevision("v2", true, commitCache.getResetCounter());
commitCache.saveRevision("v3", false, commitCache.getResetCounter());
then(commitCache.hasRevision("v1")).isFalse();
then(commitCache.hasRevision("v2")).isTrue();
then(commitCache.hasRevision("v3")).isFalse();
then(commitCache).isEqualTo(new RevisionsCache(myConfig).getRepositoryCache(repo, RevisionCacheType.COMMIT_CACHE));
}
use of jetbrains.buildServer.buildTriggers.vcs.git.RepositoryRevisionCache in project teamcity-git by JetBrains.
the class RevisionsCacheTest method save_revision_entry_different_types.
public void save_revision_entry_different_types() throws Exception {
File repo = repository("1");
RepositoryRevisionCache commitCache = myCache.getRepositoryCache(repo, RevisionCacheType.COMMIT_CACHE);
RepositoryRevisionCache hintCache = myCache.getRepositoryCache(repo, RevisionCacheType.HINT_CACHE);
commitCache.saveRevision("v1", false, commitCache.getResetCounter());
hintCache.saveRevision("v2", true, hintCache.getResetCounter());
then(commitCache.hasRevision("v1")).isFalse();
then(commitCache.hasRevision("v2")).isNull();
then(hintCache.hasRevision("v1")).isNull();
then(hintCache.hasRevision("v2")).isTrue();
then(commitCache).isEqualTo(new RevisionsCache(myConfig).getRepositoryCache(repo, RevisionCacheType.COMMIT_CACHE));
then(hintCache).isEqualTo(new RevisionsCache(myConfig).getRepositoryCache(repo, RevisionCacheType.HINT_CACHE));
}
use of jetbrains.buildServer.buildTriggers.vcs.git.RepositoryRevisionCache in project teamcity-git by JetBrains.
the class RevisionsCacheTest method should_write_empty_cache.
public void should_write_empty_cache() throws Exception {
File repo = repository("1");
RepositoryRevisionCache repoCache = myCache.getRepositoryCache(repo, RevisionCacheType.COMMIT_CACHE);
repoCache.saveRevision("v1", false, repoCache.getResetCounter());
myCache.resetNegativeEntries(repo);
then(repoCache).isEqualTo(new RevisionsCache(myConfig).getRepositoryCache(repo, RevisionCacheType.COMMIT_CACHE));
}
use of jetbrains.buildServer.buildTriggers.vcs.git.RepositoryRevisionCache in project teamcity-git by JetBrains.
the class RevisionsCacheTest method should_write_to_disk_only_if_cache_was_updated.
public void should_write_to_disk_only_if_cache_was_updated() throws Exception {
File repo = repository("1");
RepositoryRevisionCache repoCache = myCache.getRepositoryCache(repo, RevisionCacheType.COMMIT_CACHE);
File cacheFile = RepositoryRevisionCache.getCacheFile(repo, RevisionCacheType.COMMIT_CACHE);
repoCache.saveRevision("v1", true, repoCache.getResetCounter());
then(cacheFile).exists();
FileUtil.delete(cacheFile);
repoCache.saveRevision("v1", true, repoCache.getResetCounter());
then(cacheFile).doesNotExist();
myCache.resetNegativeEntries(repo);
then(cacheFile).doesNotExist();
myCache.resetNegativeEntries(repo, setOf("v2"));
then(cacheFile).doesNotExist();
}
Aggregations