Search in sources :

Example 16 with RepositoryRevisionCache

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

the class RevisionsCacheTest method reset_negative_entries.

public void reset_negative_entries() 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());
    myCache.resetNegativeEntries(repo);
    then(commitCache.hasRevision("v1")).isNull();
    then(commitCache.hasRevision("v3")).isNull();
    then(commitCache).isEqualTo(new RevisionsCache(myConfig).getRepositoryCache(repo, RevisionCacheType.COMMIT_CACHE));
}
Also used : RepositoryRevisionCache(jetbrains.buildServer.buildTriggers.vcs.git.RepositoryRevisionCache) RevisionsCache(jetbrains.buildServer.buildTriggers.vcs.git.RevisionsCache) File(java.io.File)

Example 17 with RepositoryRevisionCache

use of jetbrains.buildServer.buildTriggers.vcs.git.RepositoryRevisionCache 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

RepositoryRevisionCache (jetbrains.buildServer.buildTriggers.vcs.git.RepositoryRevisionCache)17 File (java.io.File)15 RevisionsCache (jetbrains.buildServer.buildTriggers.vcs.git.RevisionsCache)9 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 RevisionCacheType (jetbrains.buildServer.buildTriggers.vcs.git.RevisionCacheType)2 Test (org.testng.annotations.Test)2 Semaphore (java.util.concurrent.Semaphore)1 ServerPluginConfig (jetbrains.buildServer.buildTriggers.vcs.git.ServerPluginConfig)1 TestFor (jetbrains.buildServer.util.TestFor)1