public virtual void SetUp()
		{
			mockSystemReader = new _MockSystemReader_62();
			SystemReader.SetInstance(mockSystemReader);
			ident = RawParseUtils.ParsePersonIdent("A U Thor <*****@*****.**> 1316560165 -0400"
				);
		}
        public virtual void SetUp()
        {
            lock (this)
            {
                if (shutdownHook == null)
                {
                    shutdownHook = new _Thread_117(this);
                    // On windows accidentally open files or memory
                    // mapped regions may prevent files from being deleted.
                    // Suggesting a GC increases the likelihood that our
                    // test repositories actually get removed after the
                    // tests, even in the case of failure.
                    Runtime.GetRuntime().AddShutdownHook(shutdownHook);
                }
            }
            RecursiveDelete(TestId(), trash, true, false);
            mockSystemReader = new MockSystemReader();
            mockSystemReader.userGitConfig = new FileBasedConfig(new FilePath(trash, "usergitconfig"
                                                                              ), FS.DETECTED);
            CeilTestDirectories(GetCeilings());
            SystemReader.SetInstance(mockSystemReader);
            long now = mockSystemReader.GetCurrentTime();
            int  tz  = mockSystemReader.GetTimezone(now);

            author    = new PersonIdent("J. Author", "*****@*****.**");
            author    = new PersonIdent(author, now, tz);
            committer = new PersonIdent("J. Committer", "*****@*****.**");
            committer = new PersonIdent(committer, now, tz);
            WindowCacheConfig c = new WindowCacheConfig();

            c.SetPackedGitLimit(128 * WindowCacheConfig.KB);
            c.SetPackedGitWindowSize(8 * WindowCacheConfig.KB);
            c.SetPackedGitMMAP(useMMAP);
            c.SetDeltaBaseCacheLimit(8 * WindowCacheConfig.KB);
            WindowCache.Reconfigure(c);
        }
Beispiel #3
0
 public MockConfig(MockSystemReader _enclosing, FilePath cfgLocation, FS fs) : base
         (cfgLocation, fs)
 {
     this._enclosing = _enclosing;
 }
Beispiel #4
0
 public virtual void Test007_readUserConfig()
 {
     MockSystemReader mockSystemReader = new MockSystemReader();
     SystemReader.SetInstance(mockSystemReader);
     string hostname = mockSystemReader.GetHostname();
     Config userGitConfig = mockSystemReader.OpenUserConfig(null, FS.DETECTED);
     Config localConfig = new Config(userGitConfig);
     mockSystemReader.ClearProperties();
     string authorName;
     string authorEmail;
     // no values defined nowhere
     authorName = localConfig.Get(UserConfig.KEY).GetAuthorName();
     authorEmail = localConfig.Get(UserConfig.KEY).GetAuthorEmail();
     NUnit.Framework.Assert.AreEqual(Constants.UNKNOWN_USER_DEFAULT, authorName);
     NUnit.Framework.Assert.AreEqual(Constants.UNKNOWN_USER_DEFAULT + "@" + hostname,
         authorEmail);
     NUnit.Framework.Assert.IsTrue(localConfig.Get(UserConfig.KEY).IsAuthorNameImplicit
         ());
     NUnit.Framework.Assert.IsTrue(localConfig.Get(UserConfig.KEY).IsAuthorEmailImplicit
         ());
     // the system user name is defined
     mockSystemReader.SetProperty(Constants.OS_USER_NAME_KEY, "os user name");
     localConfig.Uncache(UserConfig.KEY);
     authorName = localConfig.Get(UserConfig.KEY).GetAuthorName();
     NUnit.Framework.Assert.AreEqual("os user name", authorName);
     NUnit.Framework.Assert.IsTrue(localConfig.Get(UserConfig.KEY).IsAuthorNameImplicit
         ());
     if (hostname != null && hostname.Length != 0)
     {
         authorEmail = localConfig.Get(UserConfig.KEY).GetAuthorEmail();
         NUnit.Framework.Assert.AreEqual("os user name@" + hostname, authorEmail);
     }
     NUnit.Framework.Assert.IsTrue(localConfig.Get(UserConfig.KEY).IsAuthorEmailImplicit
         ());
     // the git environment variables are defined
     mockSystemReader.SetProperty(Constants.GIT_AUTHOR_NAME_KEY, "git author name");
     mockSystemReader.SetProperty(Constants.GIT_AUTHOR_EMAIL_KEY, "author@email");
     localConfig.Uncache(UserConfig.KEY);
     authorName = localConfig.Get(UserConfig.KEY).GetAuthorName();
     authorEmail = localConfig.Get(UserConfig.KEY).GetAuthorEmail();
     NUnit.Framework.Assert.AreEqual("git author name", authorName);
     NUnit.Framework.Assert.AreEqual("author@email", authorEmail);
     NUnit.Framework.Assert.IsFalse(localConfig.Get(UserConfig.KEY).IsAuthorNameImplicit
         ());
     NUnit.Framework.Assert.IsFalse(localConfig.Get(UserConfig.KEY).IsAuthorEmailImplicit
         ());
     // the values are defined in the global configuration
     userGitConfig.SetString("user", null, "name", "global username");
     userGitConfig.SetString("user", null, "email", "author@globalemail");
     authorName = localConfig.Get(UserConfig.KEY).GetAuthorName();
     authorEmail = localConfig.Get(UserConfig.KEY).GetAuthorEmail();
     NUnit.Framework.Assert.AreEqual("global username", authorName);
     NUnit.Framework.Assert.AreEqual("author@globalemail", authorEmail);
     NUnit.Framework.Assert.IsFalse(localConfig.Get(UserConfig.KEY).IsAuthorNameImplicit
         ());
     NUnit.Framework.Assert.IsFalse(localConfig.Get(UserConfig.KEY).IsAuthorEmailImplicit
         ());
     // the values are defined in the local configuration
     localConfig.SetString("user", null, "name", "local username");
     localConfig.SetString("user", null, "email", "author@localemail");
     authorName = localConfig.Get(UserConfig.KEY).GetAuthorName();
     authorEmail = localConfig.Get(UserConfig.KEY).GetAuthorEmail();
     NUnit.Framework.Assert.AreEqual("local username", authorName);
     NUnit.Framework.Assert.AreEqual("author@localemail", authorEmail);
     NUnit.Framework.Assert.IsFalse(localConfig.Get(UserConfig.KEY).IsAuthorNameImplicit
         ());
     NUnit.Framework.Assert.IsFalse(localConfig.Get(UserConfig.KEY).IsAuthorEmailImplicit
         ());
     authorName = localConfig.Get(UserConfig.KEY).GetCommitterName();
     authorEmail = localConfig.Get(UserConfig.KEY).GetCommitterEmail();
     NUnit.Framework.Assert.AreEqual("local username", authorName);
     NUnit.Framework.Assert.AreEqual("author@localemail", authorEmail);
     NUnit.Framework.Assert.IsFalse(localConfig.Get(UserConfig.KEY).IsCommitterNameImplicit
         ());
     NUnit.Framework.Assert.IsFalse(localConfig.Get(UserConfig.KEY).IsCommitterEmailImplicit
         ());
 }
Beispiel #5
0
 public MockConfig(MockSystemReader _enclosing, FilePath cfgLocation, FS fs)
     : base(cfgLocation, fs)
 {
     this._enclosing = _enclosing;
 }
Beispiel #6
0
		public virtual void SetUp()
		{
			MockSystemReader mockSystemReader = new MockSystemReader();
			SystemReader.SetInstance(mockSystemReader);
		}
Beispiel #7
0
		public ChangeIdUtilTest()
		{
			when = mockSystemReader.GetCurrentTime();
			tz = new MockSystemReader().GetTimezone(when);
			{
				author = new PersonIdent(author, when, tz);
			}
			{
				committer = new PersonIdent(committer, when, tz);
			}
		}