Example #1
0
        public void CreateTempDir()
        {
            tempFolderFullPath = TempFileUtil.CreateTempDir(TEMP_FOLDER);

            //create mock files
            string rootLevelPath = TempFileUtil.CreateTempDir(Path.Combine(tempFolderFullPath, "RootLevel"));

            TempFileUtil.CreateTempFile(rootLevelPath, "FileB.txt");

            string firstLevelAPath = TempFileUtil.CreateTempDir(Path.Combine(rootLevelPath, "FirstLevelA"));

            TempFileUtil.CreateTempFile(firstLevelAPath, "FileA.txt");
            string firstLevelASecondLevelAPath = TempFileUtil.CreateTempDir(Path.Combine(firstLevelAPath, "SecondLevelA"));
            string firstLevelAThirdLevelAPath  = TempFileUtil.CreateTempDir(Path.Combine(firstLevelASecondLevelAPath, "ThirdLevelA"));

            TempFileUtil.CreateTempFile(firstLevelAThirdLevelAPath, "FileA.txt");

            string firstLevelBPath = TempFileUtil.CreateTempDir(Path.Combine(rootLevelPath, "FirstLevelB"));

            TempFileUtil.CreateTempFile(firstLevelBPath, "FileB.txt");
            string firstLevelBSecondLevelAPath = TempFileUtil.CreateTempDir(Path.Combine(firstLevelBPath, "SecondLevelA"));

            TempFileUtil.CreateTempFile(firstLevelBSecondLevelAPath, "FileA.txt");
            TempFileUtil.CreateTempFile(firstLevelBSecondLevelAPath, "FileB.txt");
            string firstLevelBSecondLevelAThirdLevelAPath = TempFileUtil.CreateTempDir(Path.Combine(firstLevelBSecondLevelAPath, "ThirdLevelA"));

            TempFileUtil.CreateTempFile(firstLevelBSecondLevelAThirdLevelAPath, "FileA.txt");
            TempFileUtil.CreateTempFile(firstLevelBSecondLevelAThirdLevelAPath, "FileB.txt");
            string firstLevelBSecondLevelBPath = TempFileUtil.CreateTempDir(Path.Combine(firstLevelBPath, "SecondLevelB"));

            TempFileUtil.CreateTempFile(firstLevelBSecondLevelBPath, "FileA.txt");
        }
        public void SetUp()
        {
            TempFileUtil.DeleteTempDir(FULL_CONFIGURED_LOG_DIR);
            TempFileUtil.DeleteTempDir(ARTIFACTS_DIR);
            TempFileUtil.CreateTempDir(ARTIFACTS_DIR);

            publisher = new ModificationHistoryPublisher();
        }
Example #3
0
        public void Setup()
        {
            processExecutorMock    = new Mock <ProcessExecutor>();
            processInfoCreatorMock = new Mock <IP4ProcessInfoCreator>();
            p4Purger = new ProcessP4Purger((ProcessExecutor)processExecutorMock.Object, (IP4ProcessInfoCreator)processInfoCreatorMock.Object);

            tempDirPath = TempFileUtil.CreateTempDir("tempDir");
        }
Example #4
0
        public void LoadConfiguration_BadXml()
        {
            FileInfo configFile = new FileInfo(TempFileUtil.CreateTempXmlFile(TempFileUtil.CreateTempDir(this), "loadernet.config"
                                                                              , "<test><a><b/></test>"));

            Assert.That(delegate { fileLoader.LoadConfiguration(configFile); },
                        Throws.TypeOf <ConfigurationException>());
        }
Example #5
0
 public void TestCreateTempDirOverride()
 {
     TempFileUtil.CreateTempDir(TempDir);
     TempFileUtil.CreateTempFiles(TempDir, new String[] { "test.tmp" });
     Assert.AreEqual(1, Directory.GetFiles(TempFileUtil.GetTempPath(TempDir)).Length);
     TempFileUtil.CreateTempDir(TempDir);
     Assert.AreEqual(0, Directory.GetFiles(TempFileUtil.GetTempPath(TempDir)).Length);
 }
        public void SetUp()
        {
            TempFileUtil.DeleteTempDir(FULL_CONFIGURED_LOG_DIR);
            TempFileUtil.DeleteTempDir(ARTIFACTS_DIR);
            TempFileUtil.CreateTempDir(ARTIFACTS_DIR);

            publisher = new XmlLogPublisher();
        }
        public void Setup()
        {
            processExecutorMock    = new DynamicMock(typeof(ProcessExecutor));
            processInfoCreatorMock = new DynamicMock(typeof(IP4ProcessInfoCreator));
            p4Purger = new ProcessP4Purger((ProcessExecutor)processExecutorMock.MockInstance, (IP4ProcessInfoCreator)processInfoCreatorMock.MockInstance);

            tempDirPath = TempFileUtil.CreateTempDir("tempDir");
        }
Example #8
0
        public void LoadConfigurationFile()
        {
            string      xml        = "<cruisecontrol />";
            FileInfo    configFile = new FileInfo(TempFileUtil.CreateTempXmlFile(TempFileUtil.CreateTempDir(this), "loadernet.config", xml));
            XmlDocument config     = fileLoader.LoadConfiguration(configFile);

            Assert.IsNotNull(config);
            Assert.AreEqual(xml, config.OuterXml);
        }
Example #9
0
        public void TestCreateTempXmlDoc()
        {
            TempFileUtil.CreateTempDir(TempDir);
            string path = TempFileUtil.CreateTempXmlFile(TempDir, "foobar.xml", "<test />");

            Assert.IsTrue(File.Exists(path));
            XmlDocument doc = new XmlDocument();

            doc.Load(path);
        }
Example #10
0
        public void IfExecutableIsFoundInWorkingDirectoryThenUseCombinedPathAsExecutablePath()
        {
            string workingDir     = TempFileUtil.CreateTempDir("working");
            string executablePath = TempFileUtil.CreateTempFile("working", "myExecutable");

            ProcessInfo infoWithoutPathQualifiedExecutable = new ProcessInfo("myExecutable", "", workingDir);
            ProcessInfo infoWithPreQualifiedExecutable     = new ProcessInfo(executablePath, "", workingDir);

            Assert.AreEqual(infoWithPreQualifiedExecutable, infoWithoutPathQualifiedExecutable);
        }
        protected void SetUp()
        {
            mockHistoryParser        = new DynamicMock(typeof(IHistoryParser));
            mockFileSystem           = new DynamicMock(typeof(IFileSystem));
            mockFileDirectoryDeleter = new DynamicMock(typeof(IFileDirectoryDeleter));
            CreateProcessExecutorMock(Mercurial.DefaultExecutable);
            from = new DateTime(2001, 1, 21, 20, 0, 0);
            to   = from.AddDays(1);

            tempWorkDir = TempFileUtil.CreateTempDir("ccnet-hg-test");
            tempHgDir   = Path.Combine(TempFileUtil.CreateTempDir("ccnet-hg-test"), ".hg");
            Directory.CreateDirectory(tempHgDir);
            outputTemplate = Path.Combine(tempHgDir, "ccnet.template");

            hg = new Mercurial((IHistoryParser)mockHistoryParser.MockInstance, (ProcessExecutor)mockProcessExecutor.MockInstance, new StubFileSystem(), new StubFileDirectoryDeleter());
            hg.WorkingDirectory = tempWorkDir;
        }
        public void SetUp()
        {
            workingDirPath  = TempFileUtil.CreateTempDir("workingDirectory");
            artifactDirPath = TempFileUtil.CreateTempDir("artifactDirectory");
            Assert.IsTrue(Directory.Exists(workingDirPath));
            Assert.IsTrue(Directory.Exists(artifactDirPath));

            mockery           = new Mockery();
            mockSourceControl = mockery.NewStrictMock(typeof(ISourceControl));
            mockStateManager  = mockery.NewStrictMock(typeof(IStateManager));
            mockTrigger       = mockery.NewStrictMock(typeof(ITrigger));
            mockLabeller      = mockery.NewStrictMock(typeof(ILabeller));
            mockPublisher     = mockery.NewStrictMock((typeof(ITask)));
            mockTask          = mockery.NewStrictMock((typeof(ITask)));

            project1 = new Project();
            project2 = new Project();
            SetupProjects();
        }
Example #13
0
        public void SetUp()
        {
            this.mocks      = new MockRepository();
            workingDirPath  = TempFileUtil.CreateTempDir("workingDir");
            artifactDirPath = TempFileUtil.CreateTempDir("artifactDir");
            Assert.IsTrue(Directory.Exists(workingDirPath));
            Assert.IsTrue(Directory.Exists(artifactDirPath));
            queue             = new IntegrationQueue("foo", new DefaultQueueConfiguration("foo"), null);
            mockery           = new Mockery();
            mockSourceControl = mockery.NewStrictMock(typeof(ISourceControl));
            mockStateManager  = mockery.NewStrictMock(typeof(IStateManager));
            mockTrigger       = mockery.NewStrictMock(typeof(ITrigger));
            mockLabeller      = mockery.NewStrictMock(typeof(ILabeller));
            mockPublisher     = mockery.NewStrictMock((typeof(ITask)));
            mockTask          = mockery.NewStrictMock((typeof(ITask)));

            project = new Project();
            SetupProject();
        }
Example #14
0
        public void SetUp()
        {
            TempFileUtil.DeleteTempDir(FULL_CONFIGURED_LOG_DIR);
            TempFileUtil.DeleteTempDir(ARTIFACTS_DIR);

            TempFileUtil.CreateTempDir(FULL_CONFIGURED_LOG_DIR);
            TempFileUtil.CreateTempDir(ARTIFACTS_DIR);
            TempFileUtil.CreateTempDir(SOURCE_DIR);

            TempFileUtil.CreateTempFile(SOURCE_DIR_PATH, "myfile.txt", "some content");

            logPublisher    = new XmlLogPublisher();
            buildPublisher  = new BuildPublisher();
            artifactCleaner = new ArtifactCleanUpTask();

            buildPublisher.AlwaysPublish        = true;
            buildPublisher.UseLabelSubDirectory = true;
            buildPublisher.SourceDir            = SOURCE_DIR_PATH;
        }
        public void ShouldBeAbleToSaveProjectsThatALoaderCanLoad()
        {
            ExecutableTask builder = new ExecutableTask();

            builder.Executable = "foo";
            FileSourceControl sourceControl = new FileSourceControl();

            sourceControl.RepositoryRoot = "bar";
            // Setup
            Project project1 = new Project();

            project1.Name          = "Project One";
            project1.SourceControl = sourceControl;
            Project project2 = new Project();

            project2.Name          = "Project Two";
            project2.SourceControl = sourceControl;
            ProjectList projectList = new ProjectList();

            projectList.Add(project1);
            projectList.Add(project2);

            var mockConfiguration = new Mock <IConfiguration>();

            mockConfiguration.SetupGet(_configuration => _configuration.Projects).Returns(projectList).Verifiable();

            FileInfo configFile = new FileInfo(TempFileUtil.CreateTempFile(TempFileUtil.CreateTempDir(this), "loadernet.config"));

            // Execute
            DefaultConfigurationFileSaver saver = new DefaultConfigurationFileSaver(new NetReflectorProjectSerializer());

            saver.Save((IConfiguration)mockConfiguration.Object, configFile);

            DefaultConfigurationFileLoader loader = new DefaultConfigurationFileLoader();
            IConfiguration configuration2         = loader.Load(configFile);

            // Verify
            Assert.IsNotNull(configuration2.Projects["Project One"]);
            Assert.IsNotNull(configuration2.Projects["Project Two"]);
            mockConfiguration.Verify();
        }
Example #16
0
        private string CreateTemporaryConfigurationFile()
        {
            string configXml = @"<configuration>
	<system.runtime.remoting>
		<application>
			<channels>
				<channel ref=""tcp"" port=""35354"" name=""ccnet"">
					<serverProviders>
						<formatter ref=""binary"" typeFilterLevel=""Full"" />
					</serverProviders>
				</channel>
				<channel ref=""http"" port=""35355"" name=""ccnet2"">
					<serverProviders>
						<formatter ref=""binary"" typeFilterLevel=""Full"" />
					</serverProviders>
				</channel>
			</channels>
		</application>
	</system.runtime.remoting>
</configuration>";

            TempFileUtil.CreateTempDir("RemoteCruiseServerTest");
            return(TempFileUtil.CreateTempXmlFile("RemoteCruiseServerTest", "remote.config", configXml));
        }
Example #17
0
 public void CreateTempDir()
 {
     tempFolderFullPath = TempFileUtil.CreateTempDir(TEMP_FOLDER);
 }
Example #18
0
 protected void SetUp()
 {
     TempFileUtil.CreateTempDir("FileChangedWatcherTest");
     monitor          = new ManualResetEvent(false);
     filechangedCount = 0;
 }
 protected void SetUp()
 {
     TempFileUtil.CreateTempDir(TEMP_DIR);
 }
 public void Setup()
 {
     TempFileUtil.CreateTempDir(TestFolder);
 }
Example #21
0
 public void TestCreateTempDir()
 {
     TempFileUtil.CreateTempDir(TempDir);
     Assert.IsTrue(Directory.Exists(TempFileUtil.GetTempPath(TempDir)));
     TempFileUtil.DeleteTempDir(TempDir);
 }
Example #22
0
 public static string CreateBuildFile(string content)
 {
     TempFileUtil.CreateTempDir(TEMP_DIR);
     return(TempFileUtil.CreateTempXmlFile(TEMP_DIR, NANT_TEST_BUILDFILE, content));
 }
Example #23
0
//		public static string CreateConfigFile()
//		{
//			return CreateConfigFile(ConfigurationMother.Content());
//		}

        public static string CreateConfigFile(string content)
        {
            TempFileUtil.CreateTempDir(TEMP_DIR, false);
            return(TempFileUtil.CreateTempXmlFile(TEMP_DIR, "testConfig.xml", content));
        }