Search in sources :

Example 1 with RevisionsCache

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

the class RevisionsCacheTest method disabled_persist_remove_cache_file.

public void disabled_persist_remove_cache_file() throws Exception {
    // in order to not load stale data after restart
    File repo = repository("1");
    RepositoryRevisionCache repoCache = myCache.getRepositoryCache(repo, RevisionCacheType.COMMIT_CACHE);
    repoCache.saveRevision("v1", false, repoCache.getResetCounter());
    myConfigBuilder.setPersistentCacheEnabled(false);
    repoCache.saveRevision("v1", true, repoCache.getResetCounter());
    myConfigBuilder.setPersistentCacheEnabled(true);
    RepositoryRevisionCache repoCache2 = new RevisionsCache(myConfig).getRepositoryCache(repo, RevisionCacheType.COMMIT_CACHE);
    // should have no information on v1 after restart, especially 'false'
    then(repoCache2.hasRevision("v1")).isNull();
}
Also used : RepositoryRevisionCache(jetbrains.buildServer.buildTriggers.vcs.git.RepositoryRevisionCache) RevisionsCache(jetbrains.buildServer.buildTriggers.vcs.git.RevisionsCache) File(java.io.File)

Example 2 with RevisionsCache

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

the class RevisionsCacheTest method reset_negative_entries_with_new_commits.

public void reset_negative_entries_with_new_commits() throws Exception {
    File repo = repository("1");
    RepositoryRevisionCache repoCache = myCache.getRepositoryCache(repo, RevisionCacheType.COMMIT_CACHE);
    repoCache.saveRevision("v1", false, repoCache.getResetCounter());
    repoCache.saveRevision("v2", true, repoCache.getResetCounter());
    repoCache.saveRevision("v3", false, repoCache.getResetCounter());
    myCache.resetNegativeEntries(repo, setOf("v3", "v4"));
    then(repoCache.hasRevision("v1")).isFalse();
    then(repoCache.hasRevision("v2")).isTrue();
    then(repoCache.hasRevision("v3")).isTrue();
    then(repoCache).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 3 with RevisionsCache

use of jetbrains.buildServer.buildTriggers.vcs.git.RevisionsCache 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));
}
Also used : RepositoryRevisionCache(jetbrains.buildServer.buildTriggers.vcs.git.RepositoryRevisionCache) RevisionsCache(jetbrains.buildServer.buildTriggers.vcs.git.RevisionsCache) File(java.io.File)

Example 4 with RevisionsCache

use of jetbrains.buildServer.buildTriggers.vcs.git.RevisionsCache 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));
}
Also used : RepositoryRevisionCache(jetbrains.buildServer.buildTriggers.vcs.git.RepositoryRevisionCache) RevisionsCache(jetbrains.buildServer.buildTriggers.vcs.git.RevisionsCache) File(java.io.File)

Example 5 with RevisionsCache

use of jetbrains.buildServer.buildTriggers.vcs.git.RevisionsCache 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));
}
Also used : RepositoryRevisionCache(jetbrains.buildServer.buildTriggers.vcs.git.RepositoryRevisionCache) RevisionsCache(jetbrains.buildServer.buildTriggers.vcs.git.RevisionsCache) File(java.io.File)

Aggregations

RevisionsCache (jetbrains.buildServer.buildTriggers.vcs.git.RevisionsCache)10 File (java.io.File)9 RepositoryRevisionCache (jetbrains.buildServer.buildTriggers.vcs.git.RepositoryRevisionCache)9 ArrayList (java.util.ArrayList)1 RevisionCacheType (jetbrains.buildServer.buildTriggers.vcs.git.RevisionCacheType)1 ServerPluginConfig (jetbrains.buildServer.buildTriggers.vcs.git.ServerPluginConfig)1 BeforeMethod (org.testng.annotations.BeforeMethod)1 Test (org.testng.annotations.Test)1