Example #1
0
        public void Loads15Configuration()
        {
            // NOTE: The namespace is important - this identifies the version!
            var xml = "<package xmlns=\"http://thoughtworks.org/ccnet/1/5\">" +
                      "<name>Test</name>" +
                      "<files>" +
                      "<file>fileToLoad.1</file>" +
                      "<file>fileToLoad.2</file>" +
                      "</files>" +
                      "</package>";
            var publisher = NetReflector.Read(xml);

            Assert.IsNotNull(publisher);
            Assert.IsInstanceOf <PackagePublisher>(publisher);
            var packagePublisher = publisher as PackagePublisher;

            Assert.AreEqual("Test", packagePublisher.PackageName);
            Assert.AreEqual(2, packagePublisher.PackageList.Length);
            this.AssertFilesAreTheSame(new PackageFile("fileToLoad.1"), packagePublisher.PackageList[0]);
            this.AssertFilesAreTheSame(new PackageFile("fileToLoad.2"), packagePublisher.PackageList[1]);
        }
        public void PopulateFromReflectorWithAllOptions()
        {
            const string xml = @"
<httpRequest>
   <useDefaultCredentials>false</useDefaultCredentials>
   <credentials userName=""someUser"" password=""somePass"" domain=""someDomain"" />
   <method>POST</method>
   <uri>http://example.com/</uri>
   <timeout units=""seconds"">60</timeout>
   <readWriteTimeout units=""minutes"">5</readWriteTimeout>
   <headers>
      <header name=""header1"" value=""value1""/>
   </headers>
   <body>foo bar baz</body>
</httpRequest>
";

            HttpRequestSettings requestSettings = (HttpRequestSettings)NetReflector.Read(xml);

            Assert.AreEqual(false, requestSettings.UseDefaultCredentials);
            Assert.NotNull(requestSettings.Credentials, "Credentials was specified in the settings");
            Assert.AreEqual("someUser", requestSettings.Credentials.UserName);
            Assert.AreEqual("somePass", requestSettings.Credentials.Password);
            Assert.AreEqual("someDomain", requestSettings.Credentials.Domain);

            Assert.AreEqual("POST", requestSettings.Method);
            Assert.AreEqual("http://example.com/", requestSettings.Uri.ToString());
            Assert.AreEqual(60000, requestSettings.Timeout.Millis);
            Assert.AreEqual(300000, requestSettings.ReadWriteTimeout.Millis);

            Assert.NotNull(requestSettings.Headers, "Headers were specified in the settings");
            Assert.AreEqual(1, requestSettings.Headers.Length);
            Assert.AreEqual("header1", requestSettings.Headers[0].Name);
            Assert.AreEqual("value1", requestSettings.Headers[0].Value);

            Assert.IsFalse(requestSettings.HasSendFile);
            Assert.IsTrue(requestSettings.HasBody);
            Assert.AreEqual("foo bar baz", requestSettings.Body);
        }
Example #3
0
        public void ShouldLoadAllValuesFromConfiguration()
        {
            const string xml = @"
<devenv>
	<executable>c:\vs.net\devenv.com</executable>
	<version>9.0</version>
	<solutionfile>mySolution.sln</solutionfile>
	<configuration>Debug</configuration>
	<buildTimeoutSeconds>4</buildTimeoutSeconds>
	<project>MyProject</project>
	<buildtype>Clean</buildtype>
</devenv>";

            DevenvTask task2 = (DevenvTask)NetReflector.Read(xml);

            Assert.AreEqual(@"c:\vs.net\devenv.com", task2.Executable);
            Assert.AreEqual(@"mySolution.sln", task2.SolutionFile);
            Assert.AreEqual(@"Debug", task2.Configuration);
            Assert.AreEqual(4, task2.BuildTimeoutSeconds);
            Assert.AreEqual(@"Clean", task2.BuildType);
            Assert.AreEqual(@"MyProject", task2.Project);
        }
Example #4
0
        public void PopulateFromMinimallySpecifiedXml()
        {
            const string xml = @"
<git>
    <repository>c:\git\ccnet\mygitrepo</repository>
</git>";

            git = (Git)NetReflector.Read(xml);
            Assert.AreEqual(@"git", git.Executable, "#C1");
            Assert.AreEqual(@"c:\git\ccnet\mygitrepo", git.Repository, "#C2");
            Assert.AreEqual(@"master", git.Branch, "#C3");
            Assert.AreEqual(new Timeout(600000), git.Timeout, "#C4");
            Assert.AreEqual(null, git.WorkingDirectory, "#C5");
            Assert.AreEqual(false, git.TagOnSuccess, "#C6");
            Assert.AreEqual(true, git.AutoGetSource, "#C7");
            Assert.AreEqual("CCNet Build {0}", git.TagCommitMessage, "#C8");
            Assert.AreEqual("CCNet-Build-{0}", git.TagNameFormat, "#C9");
            Assert.AreEqual(null, git.CommitterName, "#C10");
            Assert.AreEqual(null, git.CommitterEMail, "#C11");
            Assert.AreEqual(false, git.CommitBuildModifications, "#C12");
            Assert.AreEqual(false, git.CommitUntrackedFiles, "#C13");
        }
Example #5
0
        public void PopulateFromFullySpecifiedXml()
        {
            string xml = @"
<git>
	<executable>git</executable>
	<repository>c:\git\ccnet\mygitrepo</repository>
	<branch>master</branch>
	<timeout>5</timeout>
	<workingDirectory>c:\git\working</workingDirectory>
	<tagOnSuccess>true</tagOnSuccess>
	<autoGetSource>true</autoGetSource>
</git>";

            git = (ThoughtWorks.CruiseControl.Core.Sourcecontrol.git)NetReflector.Read(xml);
            Assert.AreEqual(@"git", git.Executable);
            Assert.AreEqual(@"c:\git\ccnet\mygitrepo", git.Repository);
            Assert.AreEqual(@"master", git.Branch);
            Assert.AreEqual(new Timeout(5), git.Timeout);
            Assert.AreEqual(@"c:\git\working", git.WorkingDirectory);
            Assert.AreEqual(true, git.TagOnSuccess);
            Assert.AreEqual(true, git.AutoGetSource);
        }
        public void TestFixtureSetUp()
        {
            Synergy synergy = (Synergy)NetReflector.Read(SynergyMother.ConfigValues);

            connection                         = synergy.Connection;
            connection.Host                    = "localhost";
            connection.Username                = "******";
            connection.Password                = "******";
            connection.Role                    = "build_mgr";
            connection.Database                = @"\\server\share\dbname";
            connection.Delimiter               = '-';
            connection.WorkingDirectory        = @"C:\Program Files\Telelogic\CM Synergy 6.3\bin";
            connection.HomeDirectory           = @"C:\cmsynergy\jdoe";
            connection.ClientDatabaseDirectory = @"C:\cmsynergy\uidb";
            connection.SessionId               = "LOCALHOST:1234:127.0.0.1";
            project = synergy.Project;
            project.ProjectSpecification = "MyProject-MyProject_Int";
            project.ObjectName           = "MyProject-MyProject_Int:project:1";
            project.Purpose    = "Integration Testing";
            project.Release    = "MyProduct/1.0";
            project.TaskFolder = 1234;
        }
        public void PopulateFromConfiguration()
        {
            const string xml = @"<msbuild>
	<executable>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\MSBuild.exe</executable>
	<workingDirectory>C:\dev\ccnet</workingDirectory>
	<projectFile>CCNet.sln</projectFile>
	<buildArgs>/p:Configuration=Debug /v:diag</buildArgs>
	<targets>Build;Test</targets>
	<timeout>15</timeout>
	<logger>Kobush.Build.Logging.XmlLogger,Kobush.MSBuild.dll;buildresult.xml</logger>
    <priority>BelowNormal</priority>
</msbuild>";

            task = (MsBuildTask)NetReflector.Read(xml);
            Assert.AreEqual(@"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50215\MSBuild.exe", task.Executable);
            Assert.AreEqual(@"C:\dev\ccnet", task.WorkingDirectory);
            Assert.AreEqual("CCNet.sln", task.ProjectFile);
            Assert.AreEqual("Build;Test", task.Targets);
            Assert.AreEqual("/p:Configuration=Debug /v:diag", task.BuildArgs);
            Assert.AreEqual(15, task.Timeout);
            Assert.AreEqual("Kobush.Build.Logging.XmlLogger,Kobush.MSBuild.dll;buildresult.xml", task.Logger);
            Assert.AreEqual(ProcessPriorityClass.BelowNormal, task.Priority);
        }
Example #8
0
        private object Load(string xpath)
        {
            string dashboardConfig = "";

            using (StreamReader sr = new StreamReader(CalculateDashboardConfigPath()))
            {
                dashboardConfig = sr.ReadToEnd();
            }

            string OldCurrentDirectory = Environment.CurrentDirectory;

            Environment.CurrentDirectory = Path.GetDirectoryName(CalculateDashboardConfigPath());
            XmlNode node = XmlUtil.SelectNode(dashboardConfig, xpath);

            Environment.CurrentDirectory = OldCurrentDirectory;

            NetReflectorTypeTable typeTable = NetReflectorTypeTable.CreateDefault(instantiator);

            typeTable.Add(Path.GetDirectoryName(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, AppDomain.CurrentDomain.RelativeSearchPath)), "ccnet.*.plugin.dll");
            typeTable.Add(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ccnet.*.plugin.dll");

            return(NetReflector.Read(node, typeTable));
        }
        public void PopulateFromFullySpecifiedXml()
        {
            const string xml = @"
<git>
	<executable>git</executable>
	<repository>c:\git\ccnet\mygitrepo</repository>
	<branch>master</branch>
	<timeout>5</timeout>
	<workingDirectory>c:\git\working</workingDirectory>
	<tagOnSuccess>true</tagOnSuccess>
	<commitBuildModifications>true</commitBuildModifications>
	<commitUntrackedFiles>true</commitUntrackedFiles>
    <maxAmountOfModificationsToFetch>500</maxAmountOfModificationsToFetch>
	<autoGetSource>true</autoGetSource>
	<tagCommitMessage>CCNet Test Build {0}</tagCommitMessage>
	<tagNameFormat>{0}</tagNameFormat>
	<committerName>Max Mustermann</committerName>
	<committerEMail>[email protected]</committerEMail>
</git>";

            git = (Git)NetReflector.Read(xml);
            Assert.AreEqual("git", git.Executable, "#B1");
            Assert.AreEqual(@"c:\git\ccnet\mygitrepo", git.Repository, "#B2");
            Assert.AreEqual("master", git.Branch, "#B3");
            Assert.AreEqual(new Timeout(5), git.Timeout, "#B4");
            Assert.AreEqual(@"c:\git\working", git.WorkingDirectory, "#B5");
            Assert.AreEqual(true, git.TagOnSuccess, "#B6");
            Assert.AreEqual(true, git.AutoGetSource, "#B7");
            Assert.AreEqual("CCNet Test Build {0}", git.TagCommitMessage, "#B8");
            Assert.AreEqual("{0}", git.TagNameFormat, "#B9");
            Assert.AreEqual("Max Mustermann", git.CommitterName, "#B10");
            Assert.AreEqual("*****@*****.**", git.CommitterEMail, "#B11");
            Assert.AreEqual(true, git.CommitBuildModifications, "#B12");
            Assert.AreEqual(true, git.CommitUntrackedFiles, "#B13");
            Assert.AreEqual(500, git.MaxAmountOfModificationsToFetch, "#B14");
        }
        public void ValuePopulation()
        {
            //// EXECUTE
            NetReflector.Read(SourceControlXml, _filteredSourceControl);

            //// VERIFY
            Assert.IsTrue(_filteredSourceControl.SourceControlProvider != null);

            string optionalProp = ((SourceControlMock)_filteredSourceControl.SourceControlProvider).AnOptionalProperty;

            Assert.AreEqual(optionalProp, "foo", "Didn't find expected source control provider");

            Assert.AreEqual(_filteredSourceControl.InclusionFilters.Length, 1);

            string inclusionPattern = ((PathFilter)_filteredSourceControl.InclusionFilters[0]).Pattern;

            Assert.AreEqual(inclusionPattern, "/sources/**/*.*", "Didn't find expected inclusion path pattern");

            Assert.AreEqual(_filteredSourceControl.ExclusionFilters.Length, 1);

            string exclusionPattern = ((PathFilter)_filteredSourceControl.ExclusionFilters[0]).Pattern;

            Assert.AreEqual(exclusionPattern, "/sources/info/version.cs", "Didn't find expected exclusion path pattern");
        }
        public void PopulateFromConfigurationXml()
        {
            Synergy synergy = (Synergy)NetReflector.Read(SynergyMother.ConfigValues);

            Assert.AreEqual("ccm.cmd", synergy.Connection.Executable);
            Assert.AreEqual("myserver", synergy.Connection.Host);
            Assert.AreEqual(@"\\myserver\share\mydatabase", synergy.Connection.Database);
            Assert.AreEqual(600, synergy.Connection.Timeout);
            Assert.AreEqual("Product/1.0", synergy.Project.Release);
            Assert.AreEqual(1234, synergy.Project.TaskFolder);
            Assert.AreEqual("jdoe", synergy.Connection.Username);
            Assert.AreEqual("password", synergy.Connection.Password);
            Assert.AreEqual("developer", synergy.Connection.Role);
            Assert.IsTrue(synergy.Connection.PollingEnabled);
            Assert.IsTrue(synergy.Project.BaseliningEnabled);
            Assert.IsTrue(synergy.Project.TemplateEnabled);
            Assert.IsNotNull(synergy.Project.ReconcilePaths);
            Assert.AreEqual(2, synergy.Project.ReconcilePaths.Length);
            Assert.AreEqual(@"Product\bin", synergy.Project.ReconcilePaths[0]);
            Assert.AreEqual(@"Product\temp.txt", synergy.Project.ReconcilePaths[1]);
            Assert.AreEqual("Custom Purpose", synergy.Project.Purpose);
            Assert.AreEqual(@"D:\cmsynergy\jdoe", synergy.Connection.HomeDirectory);
            Assert.AreEqual(@"D:\cmsynergy\uidb", synergy.Connection.ClientDatabaseDirectory);
        }
        public void PopulateFromCompleteConfiguration()
        {
            const string xmlConfig = @"<FinalBuilder>
				<ProjectFile>C:\Dummy\Project.fbz3</ProjectFile>
                <ShowBanner>false</ShowBanner>
                <FBVariables>
                    <FBVariable name=""MyVariable"" value=""SomeValue"" />
                </FBVariables>
				<FBVersion>3</FBVersion>
                <FBCMDPath>C:\Program Files\MyFinalBuilderPath\FBCMD.EXE</FBCMDPath>
                <DontWriteToLog>true</DontWriteToLog>
                <Timeout>100</Timeout> 
				</FinalBuilder>"                ;

            NetReflector.Read(xmlConfig, _task);
            Assert.AreEqual(@"C:\Dummy\Project.fbz3", _task.ProjectFile);
            Assert.AreEqual(false, _task.ShowBanner);
            Assert.AreEqual(1, _task.FBVariables.Length);
            Assert.AreEqual("MyVariable", _task.FBVariables[0].Name);
            Assert.AreEqual("SomeValue", _task.FBVariables[0].Value);
            Assert.AreEqual(3, _task.FBVersion);
            Assert.AreEqual(@"C:\Program Files\MyFinalBuilderPath\FBCMD.EXE", _task.FBCMDPath);
            Assert.AreEqual(100, _task.Timeout);
        }
 public void RequiredPropertiesNotProvided()
 {
     Assert.That(delegate { NetReflector.Read(@"<FinalBuilder />", _task); },
                 Throws.TypeOf <NetReflectorException>());
 }
        public void ReadTestHashClassContainingElements()
        {
            HashTestClass actual = (HashTestClass)NetReflector.Read(HashTestClass.GetXmlForHashtableWithElements(), table);

            HashTestClass.AssertEquals(HashTestClass.CreateHashtableWithElements(), actual);
        }
 /// <summary>
 /// Deserializes the specified serialized project.
 /// </summary>
 /// <param name="serializedProject">The serialized project.</param>
 /// <returns></returns>
 /// <remarks></remarks>
 public IProject Deserialize(string serializedProject)
 {
     return(NetReflector.Read(serializedProject) as IProject);
 }
        public void ShouldConfigureWithBasicXml()
        {
            PlasticSCM plasticscm = new PlasticSCM();

            NetReflector.Read(PLASTICSCM_BASIC_XML, plasticscm);
        }
Example #17
0
 protected void SetUp()
 {
     surround = new Surround();
     NetReflector.Read(SSCM_XML, surround);
 }
Example #18
0
        protected override bool Accept(ClassMetadata classmetadata)
        {
            var type = NetReflector.ToNative(classmetadata.ClassReflector());

            return(type != null ? type.IsEnum : false);
        }
Example #19
0
        public void WriteCollectionTestClass()
        {
            string xml = NetReflector.Write(CollectionTestClass.Create());

            Assert.AreEqual(CollectionTestClass.GetXml(), xml);
        }
Example #20
0
        public void WriteArrayTestClass()
        {
            string xml = NetReflector.Write(ArrayTestClass.Create());

            Assert.AreEqual(ArrayTestClass.GetXml(), xml);
        }
Example #21
0
 public void ShouldFailToReadWithoutName()
 {
     Assert.That(delegate { NetReflector.Read(@"<user address=""*****@*****.**""/>"); },
                 Throws.TypeOf <NetReflectorException>().With.Message.EqualTo(
                     "Missing Xml node (name) for required member (ThoughtWorks.CruiseControl.Core.Publishers.EmailUser.Name).\r\nXml: <user address=\"[email protected]\" />"));
 }
Example #22
0
        public void ReadArrayTestClass()
        {
            ArrayTestClass actual = (ArrayTestClass)NetReflector.Read(ArrayTestClass.GetXml(), table);

            ArrayTestClass.AssertEquals(ArrayTestClass.Create(), actual);
        }
        public static object Deserialize(string serialized)
        {
            object Subject = NetReflector.Read(serialized);

            return(Subject);
        }
Example #24
0
        public void ReadCollectionTestClass()
        {
            CollectionTestClass actual = (CollectionTestClass)NetReflector.Read(CollectionTestClass.GetXml(), table);

            CollectionTestClass.AssertEquals(CollectionTestClass.Create(), actual);
        }
Example #25
0
        public void WriteCollectionTestClassContainingNulls()
        {
            string xml = NetReflector.Write(CollectionTestClass.CreateCollectionContainingNulls());

            Assert.AreEqual(CollectionTestClass.GetXmlWithMissingNullElements(), xml);
        }
 protected void Setup()
 {
     clearCase = new ClearCase();
     NetReflector.Read(CLEARCASE_XML, clearCase);
 }
 public void LoadFromMinimalConfigurationXml()
 {
     NetReflector.Read(@"<modificationWriter />");
 }
Example #28
0
        public void ReadArrayTestClassWithEnums()
        {
            ArrayTestClass actual = (ArrayTestClass)NetReflector.Read(ArrayTestClass.GetXmlForDays(), table);

            ArrayTestClass.AssertEquals(ArrayTestClass.CreateDays(), actual);
        }
Example #29
0
 public void ShouldPopulateWithMinimalConfiguration()
 {
     vss = (Vss)NetReflector.Read("<vss />");
     Assert.AreEqual(Vss.DefaultProject, vss.Project);
 }
Example #30
0
 public void ShouldFailToReadWithoutAddress()
 {
     Assert.That(delegate { NetReflector.Read(@"<user name=""username""/>"); },
                 Throws.TypeOf <NetReflectorException>());
 }