java.lang.Object
org.eclipse.jgit.util.SystemReader
org.eclipse.jgit.junit.MockSystemReader
public class MockSystemReader
extends org.eclipse.jgit.util.SystemReader
Mock
SystemReader for tests.-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.jgit.util.SystemReader
org.eclipse.jgit.util.SystemReader.Delegate -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClear propertiesorg.eclipse.jgit.util.time.MonotonicClockgetClock()longgetDateTimeInstance(int dateStyle, int timeStyle) org.eclipse.jgit.storage.file.FileBasedConfiggetProperty(String key) getSimpleDateFormat(String pattern) org.eclipse.jgit.lib.StoredConfigintgetTimezone(long when) org.eclipse.jgit.lib.StoredConfigorg.eclipse.jgit.storage.file.FileBasedConfigopenJGitConfig(org.eclipse.jgit.lib.Config parent, org.eclipse.jgit.util.FS fs) org.eclipse.jgit.storage.file.FileBasedConfigopenSystemConfig(org.eclipse.jgit.lib.Config parent, org.eclipse.jgit.util.FS fs) org.eclipse.jgit.storage.file.FileBasedConfigopenUserConfig(org.eclipse.jgit.lib.Config parent, org.eclipse.jgit.util.FS fs) voidAssign some properties for the currently executing platformvoidsetJGitConfig(org.eclipse.jgit.storage.file.FileBasedConfig jgitConfig) Set the jgit config stored at $XDG_CONFIG_HOME/jgit/configvoidsetProperty(String key, String value) Set a propertyorg.eclipse.jgit.storage.file.FileBasedConfigsetSystemGitConfig(org.eclipse.jgit.storage.file.FileBasedConfig systemGitConfig) Set the system-level git configvoidsetUnix()Emulate Unixorg.eclipse.jgit.storage.file.FileBasedConfigsetUserGitConfig(org.eclipse.jgit.storage.file.FileBasedConfig userGitConfig) Set the user-level git configvoidEmulate Windowsvoidtick(int secDelta) Adjusts the current time in seconds.toString()Methods inherited from class org.eclipse.jgit.util.SystemReader
checkPath, checkPath, civilNow, getDefaultCharset, getInstance, getSimpleDateFormat, getTimeZoneAt, getXdgCacheDirectory, getXdgConfigDirectory, isLinux, isMacOS, isPerformanceTraceEnabled, isWindows, now, setInstance, setPlatformChecker
-
Constructor Details
-
MockSystemReader
public MockSystemReader()Constructor forMockSystemReader
-
-
Method Details
-
setUserGitConfig
public org.eclipse.jgit.storage.file.FileBasedConfig setUserGitConfig(org.eclipse.jgit.storage.file.FileBasedConfig userGitConfig) Set the user-level git config- Parameters:
userGitConfig- set another user-level git config- Returns:
- the old user-level git config
- Since:
- 5.1.9
-
setJGitConfig
public void setJGitConfig(org.eclipse.jgit.storage.file.FileBasedConfig jgitConfig) Set the jgit config stored at $XDG_CONFIG_HOME/jgit/config- Parameters:
jgitConfig- set the jgit configuration- Since:
- 5.5
-
setSystemGitConfig
public org.eclipse.jgit.storage.file.FileBasedConfig setSystemGitConfig(org.eclipse.jgit.storage.file.FileBasedConfig systemGitConfig) Set the system-level git config- Parameters:
systemGitConfig- the new system-level git config- Returns:
- the old system-level config
- Since:
- 5.1.9
-
clearProperties
public void clearProperties()Clear properties -
setProperty
Set a property- Parameters:
key- the keyvalue- the value
-
getenv
- Specified by:
getenvin classorg.eclipse.jgit.util.SystemReader
-
getProperty
- Specified by:
getPropertyin classorg.eclipse.jgit.util.SystemReader
-
openUserConfig
public org.eclipse.jgit.storage.file.FileBasedConfig openUserConfig(org.eclipse.jgit.lib.Config parent, org.eclipse.jgit.util.FS fs) - Specified by:
openUserConfigin classorg.eclipse.jgit.util.SystemReader
-
openSystemConfig
public org.eclipse.jgit.storage.file.FileBasedConfig openSystemConfig(org.eclipse.jgit.lib.Config parent, org.eclipse.jgit.util.FS fs) - Specified by:
openSystemConfigin classorg.eclipse.jgit.util.SystemReader
-
getUserConfig
public org.eclipse.jgit.lib.StoredConfig getUserConfig() throws IOException, org.eclipse.jgit.errors.ConfigInvalidException- Overrides:
getUserConfigin classorg.eclipse.jgit.util.SystemReader- Throws:
IOExceptionorg.eclipse.jgit.errors.ConfigInvalidException
-
getJGitConfig
public org.eclipse.jgit.storage.file.FileBasedConfig getJGitConfig()- Overrides:
getJGitConfigin classorg.eclipse.jgit.util.SystemReader
-
getSystemConfig
public org.eclipse.jgit.lib.StoredConfig getSystemConfig() throws IOException, org.eclipse.jgit.errors.ConfigInvalidException- Overrides:
getSystemConfigin classorg.eclipse.jgit.util.SystemReader- Throws:
IOExceptionorg.eclipse.jgit.errors.ConfigInvalidException
-
getHostname
- Specified by:
getHostnamein classorg.eclipse.jgit.util.SystemReader
-
getCurrentTime
public long getCurrentTime()- Specified by:
getCurrentTimein classorg.eclipse.jgit.util.SystemReader
-
getClock
public org.eclipse.jgit.util.time.MonotonicClock getClock()- Overrides:
getClockin classorg.eclipse.jgit.util.SystemReader
-
tick
public void tick(int secDelta) Adjusts the current time in seconds.- Parameters:
secDelta- number of seconds to add to the current time.- Since:
- 4.2
-
getTimezone
public int getTimezone(long when) - Specified by:
getTimezonein classorg.eclipse.jgit.util.SystemReader
-
getTimeZone
- Overrides:
getTimeZonein classorg.eclipse.jgit.util.SystemReader
-
getTimeZoneId
- Overrides:
getTimeZoneIdin classorg.eclipse.jgit.util.SystemReader
-
getLocale
- Overrides:
getLocalein classorg.eclipse.jgit.util.SystemReader
-
getSimpleDateFormat
- Overrides:
getSimpleDateFormatin classorg.eclipse.jgit.util.SystemReader
-
getDateTimeInstance
- Overrides:
getDateTimeInstancein classorg.eclipse.jgit.util.SystemReader
-
setCurrentPlatform
public void setCurrentPlatform()Assign some properties for the currently executing platform -
setWindows
public void setWindows()Emulate Windows -
setUnix
public void setUnix()Emulate Unix -
toString
-
openJGitConfig
public org.eclipse.jgit.storage.file.FileBasedConfig openJGitConfig(org.eclipse.jgit.lib.Config parent, org.eclipse.jgit.util.FS fs) - Specified by:
openJGitConfigin classorg.eclipse.jgit.util.SystemReader
-