Exemplo n.º 1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void checkLogTimeZone(int hoursShift, String timeZoneSuffix) throws Exception
        private void CheckLogTimeZone(int hoursShift, string timeZoneSuffix)
        {
            TimeZone.Default = TimeZone.getTimeZone(ZoneOffset.ofHours(hoursShift));
            Config      timeZoneConfig = Config.defaults(GraphDatabaseSettings.db_timezone, LogTimeZone.SYSTEM.name());
            SecurityLog securityLog    = new SecurityLog(timeZoneConfig, FileSystemRule.get(), ThreadStart.run);

            securityLog.Info("line 1");

            FileSystemAbstraction fs = FileSystemRule.get();
            File activeLogFile       = timeZoneConfig.Get(SecuritySettings.security_log_filename);

            string[] activeLines = ReadLogFile(fs, activeLogFile);
            assertThat(activeLines, array(containsString(timeZoneSuffix)));
            FileSystemRule.clear();
        }
Exemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRotateLog() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRotateLog()
        {
            SecurityLog securityLog = new SecurityLog(_config, FileSystemRule.get(), ThreadStart.run);

            securityLog.Info("line 1");
            securityLog.Info("line 2");

            FileSystemAbstraction fs = FileSystemRule.get();

            File activeLogFile = _config.get(SecuritySettings.security_log_filename);

            assertThat(fs.FileExists(activeLogFile), equalTo(true));
            assertThat(fs.FileExists(Archive(1)), equalTo(true));
            assertThat(fs.FileExists(Archive(2)), equalTo(false));

            string[] activeLines = ReadLogFile(fs, activeLogFile);
            assertThat(activeLines, array(containsString("line 2")));

            string[] archiveLines = ReadLogFile(fs, Archive(1));
            assertThat(archiveLines, array(containsString("line 1")));
        }