Search in sources :

Example 1 with DelegateSystemReader

use of com.google.gerrit.server.util.git.DelegateSystemReader in project gerrit by GerritCodeReview.

the class StandaloneSiteTest method setFakeSystemReader.

private static SystemReader setFakeSystemReader(File tempDir) {
    SystemReader oldSystemReader = SystemReader.getInstance();
    SystemReader.setInstance(new DelegateSystemReader(oldSystemReader) {

        @Override
        public FileBasedConfig openJGitConfig(Config parent, FS fs) {
            return new FileBasedConfig(parent, new File(tempDir, "jgit.config"), FS.detect());
        }

        @Override
        public FileBasedConfig openUserConfig(Config parent, FS fs) {
            return new FileBasedConfig(parent, new File(tempDir, "user.config"), FS.detect());
        }

        @Override
        public FileBasedConfig openSystemConfig(Config parent, FS fs) {
            return new FileBasedConfig(parent, new File(tempDir, "system.config"), FS.detect());
        }
    });
    return oldSystemReader;
}
Also used : DelegateSystemReader(com.google.gerrit.server.util.git.DelegateSystemReader) Config(org.eclipse.jgit.lib.Config) FileBasedConfig(org.eclipse.jgit.storage.file.FileBasedConfig) DelegateSystemReader(com.google.gerrit.server.util.git.DelegateSystemReader) SystemReader(org.eclipse.jgit.util.SystemReader) FileBasedConfig(org.eclipse.jgit.storage.file.FileBasedConfig) FS(org.eclipse.jgit.util.FS) File(java.io.File)

Example 2 with DelegateSystemReader

use of com.google.gerrit.server.util.git.DelegateSystemReader in project gerrit by GerritCodeReview.

the class AbstractDaemonTest method setFakeSystemReader.

private static SystemReader setFakeSystemReader(File tempDir) {
    SystemReader oldSystemReader = SystemReader.getInstance();
    SystemReader.setInstance(new DelegateSystemReader(oldSystemReader) {

        @Override
        public FileBasedConfig openJGitConfig(Config parent, FS fs) {
            return new FileBasedConfig(parent, new File(tempDir, "jgit.config"), FS.detect());
        }

        @Override
        public FileBasedConfig openUserConfig(Config parent, FS fs) {
            return new FileBasedConfig(parent, new File(tempDir, "user.config"), FS.detect());
        }

        @Override
        public FileBasedConfig openSystemConfig(Config parent, FS fs) {
            return new FileBasedConfig(parent, new File(tempDir, "system.config"), FS.detect());
        }
    });
    return oldSystemReader;
}
Also used : DelegateSystemReader(com.google.gerrit.server.util.git.DelegateSystemReader) Config(org.eclipse.jgit.lib.Config) BooleanProjectConfig(com.google.gerrit.entities.BooleanProjectConfig) FileBasedConfig(org.eclipse.jgit.storage.file.FileBasedConfig) ProjectConfig(com.google.gerrit.server.project.ProjectConfig) GerritServerConfig(com.google.gerrit.server.config.GerritServerConfig) SystemReader(org.eclipse.jgit.util.SystemReader) DelegateSystemReader(com.google.gerrit.server.util.git.DelegateSystemReader) FileBasedConfig(org.eclipse.jgit.storage.file.FileBasedConfig) FS(org.eclipse.jgit.util.FS) File(java.io.File)

Aggregations

DelegateSystemReader (com.google.gerrit.server.util.git.DelegateSystemReader)2 File (java.io.File)2 Config (org.eclipse.jgit.lib.Config)2 FileBasedConfig (org.eclipse.jgit.storage.file.FileBasedConfig)2 FS (org.eclipse.jgit.util.FS)2 SystemReader (org.eclipse.jgit.util.SystemReader)2 BooleanProjectConfig (com.google.gerrit.entities.BooleanProjectConfig)1 GerritServerConfig (com.google.gerrit.server.config.GerritServerConfig)1 ProjectConfig (com.google.gerrit.server.project.ProjectConfig)1