static void Test_SaveFromUIElements(FormSyncMain form)
        {
            var prevConfig = form.GetCurrentConfigFromUI();
            var config1    = SyncConfiguration.Deserialize(Testing.GetTestFile("test_cfg_01.xml"));

            form.SetCurrentConfigToUI(config1);
            var config2 = SyncConfiguration.Deserialize(Testing.GetTestFile("test_cfg_02.xml"));

            Test_SetUIElements(config2, form);
            var config2FromForm = form.GetCurrentConfigFromUI();

            File.Delete(Testing.GetTestTempFile("test_cfg_02_got.xml"));
            SyncConfiguration.Serialize(config2FromForm, Testing.GetTestTempFile("test_cfg_02_got.xml"));
            string sExpected = File.ReadAllText(Testing.GetTestFile("test_cfg_02.xml"));
            string sGot      = File.ReadAllText(Testing.GetTestTempFile("test_cfg_02_got.xml"));

            form.SetCurrentConfigToUI(prevConfig);
        }
Ejemplo n.º 2
0
        public static void RunTests()
        {
            if (!File.Exists(Testing.GetTestDirectory() + @"\testsync\src\Images\b.png"))
            {
                MessageBox.Show("Please unzip testFiles.zip to " + Path.GetFullPath(Testing.GetTestDirectory()) + @"\testsync");
                throw new Exception("Path not found.");
            }

            SyncConfiguration.s_disableMessageBox = true;
            try
            {
                Testing.CallAllTestMethods(typeof(RbcpyTests), null);
            }
            finally
            {
                SyncConfiguration.s_disableMessageBox = false;
            }
        }
Ejemplo n.º 3
0
        static void TestMethod_SyncConfiguration_Deserialize()
        {
            var config = SyncConfiguration.Deserialize(Testing.GetTestFile("test_cfg_01.xml"));

            Utils.AssertEq(config.m_src, "chg1");
            Utils.AssertEq(config.m_destination, "chg2");
            Utils.AssertEq(config.m_excludeDirs, "chg3");
            Utils.AssertEq(config.m_excludeFiles, "chg4");
            Utils.AssertEq(config.m_mirror, true);
            Utils.AssertEq(config.m_copySubDirsAndEmptySubdirs, false);
            Utils.AssertEq(config.m_copyFlags, "#1");
            Utils.AssertEq(config.m_directoryCopyFlags, "#2");
            Utils.AssertEq(config.m_ipg, "#3");
            Utils.AssertEq(config.m_nRetries, "#4");
            Utils.AssertEq(config.m_waitBetweenRetries, "#5");
            Utils.AssertEq(config.m_nThreads, "#6");
            Utils.AssertEq(config.m_custom, "#7");
            Utils.AssertEq(config.m_symlinkNotTarget, true);
            Utils.AssertEq(config.m_fatTimes, false);
            Utils.AssertEq(config.m_compensateDst, true);
        }
Ejemplo n.º 4
0
        static void TestActualSync(string sDirectory, int nThreads)
        {
            var    config       = GetRealConfig(sDirectory, nThreads);
            string sLogFilename = RunImplementation.GetLogFilename();

            RunImplementation.Go(config, sLogFilename, false /*preview*/, false);
            var results = CCreateSyncResultsSet.ParseFromLogFile(config, sLogFilename, false /*preview*/);

            File.Delete(sLogFilename);
            // the number of skipped dirs is 3 instead of the 2 it used to be, but not important right now
            Utils.AssertEq("Total    Copied   Skipped  Mismatch    Failed    Extras\r\n    Dirs :         5         5         3         0         0         2\r\n   Files :        22         8        14         0         0         2\r\n   Bytes :   632.0 k   126.6 k   505.4 k         0         0    30.7 k", results.sSummary.Trim());

            // check files
            string[]      filesExpected = @"..\..\test\testsync\dest
..\..\test\testsync\dest\Images
..\..\test\testsync\dest\Images\a.png
..\..\test\testsync\dest\Images\addempty
..\..\test\testsync\dest\Images\addir
..\..\test\testsync\dest\Images\addir\a.PNG
..\..\test\testsync\dest\Images\b.png
..\..\test\testsync\dest\Images\c.png
..\..\test\testsync\dest\Images\d.png
..\..\test\testsync\dest\Images\DB44-20-x64.jpg
..\..\test\testsync\dest\Images\e.png
..\..\test\testsync\dest\Images\f.gif
..\..\test\testsync\dest\Licenses
..\..\test\testsync\dest\Licenses\.weirdext
..\..\test\testsync\dest\Licenses\Apr-License.txt
..\..\test\testsync\dest\Licenses\Apr-Util-License.txt
..\..\test\testsync\dest\Licenses\BerkeleyDB-License.txt
..\..\test\testsync\dest\Licenses\Cyrus-Sasl-License.txt
..\..\test\testsync\dest\Licenses\GetText-Runtime-License.txt
..\..\test\testsync\dest\Licenses\noext
..\..\test\testsync\dest\Licenses\OpenSsl-License.txt
..\..\test\testsync\dest\Licenses\Serf-License.txt
..\..\test\testsync\dest\Licenses\SharpSvn-License.txt
..\..\test\testsync\dest\Licenses\Subversion-License.txt
..\..\test\testsync\dest\loren.html
..\..\test\testsync\dest\loren.txt
..\..\test\testsync\dest\pic1.png
..\..\test\testsync\src
..\..\test\testsync\src\Images
..\..\test\testsync\src\Images\a.png
..\..\test\testsync\src\Images\addempty
..\..\test\testsync\src\Images\addir
..\..\test\testsync\src\Images\addir\a.PNG
..\..\test\testsync\src\Images\b.png
..\..\test\testsync\src\Images\c.png
..\..\test\testsync\src\Images\d.png
..\..\test\testsync\src\Images\DB44-20-x64.jpg
..\..\test\testsync\src\Images\e.png
..\..\test\testsync\src\Images\f.gif
..\..\test\testsync\src\Licenses
..\..\test\testsync\src\Licenses\.weirdext
..\..\test\testsync\src\Licenses\Apr-License.txt
..\..\test\testsync\src\Licenses\Apr-Util-License.txt
..\..\test\testsync\src\Licenses\BerkeleyDB-License.txt
..\..\test\testsync\src\Licenses\Cyrus-Sasl-License.txt
..\..\test\testsync\src\Licenses\GetText-Runtime-License.txt
..\..\test\testsync\src\Licenses\noext
..\..\test\testsync\src\Licenses\OpenSsl-License.txt
..\..\test\testsync\src\Licenses\Serf-License.txt
..\..\test\testsync\src\Licenses\SharpSvn-License.txt
..\..\test\testsync\src\Licenses\Subversion-License.txt
..\..\test\testsync\src\loren.html
..\..\test\testsync\src\loren.txt
..\..\test\testsync\src\pic1.png".Replace("\r\n", "\n").Replace(@"..\..\test\testsync\", sDirectory + "\\").Split(new char[] { '\n' });
            List <string> filesGot      = Directory.GetFileSystemEntries(sDirectory, "*", SearchOption.AllDirectories).ToList();

            filesGot.Sort();
            Testing.AssertStringArrayEqual(filesExpected, filesGot);
            Utils.AssertEq(new FileInfo(sDirectory + "\\src\\Licenses\\Cyrus-Sasl-License.txt").Length, 1861L);
            Utils.AssertEq(new FileInfo(sDirectory + "\\src\\Licenses\\OpenSsl-License.txt").Length, 6286L);
            Utils.AssertEq(new FileInfo(sDirectory + "\\src\\Licenses\\Apr-License.txt").Length, 18324L);
            Utils.AssertEq(new FileInfo(sDirectory + "\\src\\Licenses\\Serf-License.txt").Length, 11562L);
            Utils.AssertEq(new FileInfo(sDirectory + "\\dest\\Licenses\\Cyrus-Sasl-License.txt").Length, 1861L);
            Utils.AssertEq(new FileInfo(sDirectory + "\\dest\\Licenses\\OpenSsl-License.txt").Length, 6286L);
            Utils.AssertEq(new FileInfo(sDirectory + "\\dest\\Licenses\\Apr-License.txt").Length, 18324L);
            Utils.AssertEq(new FileInfo(sDirectory + "\\dest\\Licenses\\Serf-License.txt").Length, 11562L);
        }