Search in sources :

Example 1 with RevisionCacheType

use of jetbrains.buildServer.buildTriggers.vcs.git.RevisionCacheType in project teamcity-git by JetBrains.

the class RevisionsCacheTest method reset_negative_entries_different_types.

public void reset_negative_entries_different_types() 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());
    RepositoryRevisionCache hintCache = myCache.getRepositoryCache(repo, RevisionCacheType.HINT_CACHE);
    hintCache.saveRevision("v4", false, hintCache.getResetCounter());
    myCache.resetNegativeEntries(repo);
    for (RevisionCacheType type : RevisionCacheType.values()) {
        then(myCache.getRepositoryCache(repo, type).hasRevision("v1")).isNull();
        then(myCache.getRepositoryCache(repo, type).hasRevision("v3")).isNull();
        then(myCache.getRepositoryCache(repo, type).hasRevision("v4")).isNull();
    }
    then(commitCache).isEqualTo(new RevisionsCache(myConfig).getRepositoryCache(repo, RevisionCacheType.COMMIT_CACHE));
    then(hintCache).isEqualTo(new RevisionsCache(myConfig).getRepositoryCache(repo, RevisionCacheType.HINT_CACHE));
}
Also used : RevisionCacheType(jetbrains.buildServer.buildTriggers.vcs.git.RevisionCacheType) RepositoryRevisionCache(jetbrains.buildServer.buildTriggers.vcs.git.RepositoryRevisionCache) RevisionsCache(jetbrains.buildServer.buildTriggers.vcs.git.RevisionsCache) File(java.io.File)

Example 2 with RevisionCacheType

use of jetbrains.buildServer.buildTriggers.vcs.git.RevisionCacheType in project teamcity-git by JetBrains.

the class RevisionsCacheTest method reset_all_caches.

public void reset_all_caches() throws Exception {
    List<File> repos = new ArrayList<>();
    for (int i = 0; i < 4; i++) {
        File repo = repository(String.valueOf(i));
        repos.add(repo);
        for (RevisionCacheType type : RevisionCacheType.values()) {
            RepositoryRevisionCache repoCache = myCache.getRepositoryCache(repo, type);
            repoCache.saveRevision("v1", true, repoCache.getResetCounter());
        }
    }
    myCache.reset();
    for (File repo : repos) {
        for (RevisionCacheType type : RevisionCacheType.values()) {
            RepositoryRevisionCache repoCache = myCache.getRepositoryCache(repo, type);
            then(repoCache.hasRevision("v1")).isNull();
            then(RepositoryRevisionCache.getCacheFile(repo, type)).doesNotExist();
            repoCache.saveRevision("v2", false, 0);
            then(repoCache.hasRevision("v2")).isNull();
        }
    }
}
Also used : RevisionCacheType(jetbrains.buildServer.buildTriggers.vcs.git.RevisionCacheType) ArrayList(java.util.ArrayList) RepositoryRevisionCache(jetbrains.buildServer.buildTriggers.vcs.git.RepositoryRevisionCache) File(java.io.File)

Aggregations

File (java.io.File)2 RepositoryRevisionCache (jetbrains.buildServer.buildTriggers.vcs.git.RepositoryRevisionCache)2 RevisionCacheType (jetbrains.buildServer.buildTriggers.vcs.git.RevisionCacheType)2 ArrayList (java.util.ArrayList)1 RevisionsCache (jetbrains.buildServer.buildTriggers.vcs.git.RevisionsCache)1