public void ServerTest() { JenkinsModelHudson server = null; using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password)) { server = jenkins.GetServerAsync().Result; } Assert.IsNotNull(server); Assert.IsNotNull(server.AssignedLabels, "assignedLabels"); //Assert.AreEqual(this.serverMode, server.Mode, "mode"); Assert.AreEqual("the master Jenkins node", server.NodeDescription, "nodeDescription"); Assert.AreEqual("", server.NodeName, "nodeName"); Assert.AreEqual(4, server.NumExecutors, "numExecutors"); Assert.AreEqual(null, server.Description, "description"); Assert.IsNotNull(server.Jobs, "jobs"); Assert.IsNotNull(server.OverallLoad, "overallLoad"); Assert.IsNotNull(server.PrimaryView, "primaryView"); Assert.AreEqual(-1, server.SlaveAgentPort, "slaveAgentPort"); Assert.AreEqual(true, server.UseCrumbs, "useCrumbs"); Assert.AreEqual(true, server.UseSecurity, "useSecurity"); Assert.IsNotNull(server.Views, "views"); Assert.AreEqual("", server.NodeName, "nodeName"); }
public void ServerTest() { // Arrange JenkinsModelHudson server = null; // Act using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password)) { server = jenkins.GetServerAsync().Result; } // Assert Assert.IsNotNull(server, nameof(server)); Assert.AreEqual("hudson.model.Hudson", server.Class, nameof(server.Class)); Assert.AreEqual("Hello World", server.Description, nameof(server.Description)); Assert.AreEqual(0, server.SlaveAgentPort, nameof(server.SlaveAgentPort)); Assert.AreEqual($"{this.host}", server.Url, nameof(server.Url)); Assert.AreEqual(true, server.UseCrumbs, nameof(server.UseCrumbs)); Assert.AreEqual(true, server.UseSecurity, nameof(server.UseSecurity)); Assert.AreEqual(JenkinsModelNodeMode.Normal, server.Mode, nameof(server.Mode)); Assert.AreEqual("the master Jenkins node", server.NodeDescription, nameof(server.NodeDescription)); Assert.AreEqual("", server.NodeName, nameof(server.NodeName)); Assert.AreEqual(1, server.NumExecutors, nameof(server.NumExecutors)); Assert.IsNotNull(server.AssignedLabels, nameof(server.AssignedLabels)); Assert.IsNotNull(server.Jobs, nameof(server.Jobs)); Assert.IsNotNull(server.OverallLoad, nameof(server.OverallLoad)); Assert.IsNotNull(server.PrimaryView, nameof(server.PrimaryView)); Assert.IsNotNull(server.Views, nameof(server.Views)); }
public void BuildGetGenericTest() { // Arrange JenkinsModelFreeStyleBuild freeStyleBuild = null; //JenkinsBuildExternal externalBuild = null; JenkinsMatrixMatrixBuild matrixBuild = null; JenkinsJenkinsciWorkflowRun workflowBuild = null; //JenkinsBuildWorkflowMultiBranch multiBranchBuild = null; //JenkinsBuildFolder folderBuild = null; //JenkinsBuildOrganizationFolder organizationFolderBuild = null; // Act using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password)) { freeStyleBuild = jenkins.GetLastBuildAsync <JenkinsModelFreeStyleBuild>("Freestyle").Result; //externalBuild = jenkins.GetBuildAsync("ExternalJob", 1).Result as JenkinsBuildExternal; matrixBuild = jenkins.GetBuildAsync <JenkinsMatrixMatrixBuild>("Multiconfiguration", 1).Result; workflowBuild = jenkins.GetBuildAsync <JenkinsJenkinsciWorkflowRun>("Pipeline", 1).Result; //multiBranchBuild = jenkins.GetBuildAsync("MultibranchPipeline", 1).Result as JenkinsBuildWorkflowMultiBranch; //folderBuild = jenkins.GetBuildAsync("Folder", 1).Result as JenkinsBuildFolder; //organizationFolderBuild = jenkins.GetBuildAsync("GitHubOrganization", 1).Result as JenkinsBuildOrganizationFolder; } // Assert Assert.IsNotNull(freeStyleBuild); //Assert.IsNotNull(externalBuild); Assert.IsNotNull(matrixBuild); Assert.IsNotNull(workflowBuild); //Assert.IsNotNull(multiBranchBuild); //Assert.IsNotNull(folderBuild); //Assert.IsNotNull(organizationFolderBuild); }
public void CanApplyCurrentContextWhenEnvironmentVariableIsSet() { SetEnvironmentVariableForDetection(); var j = new Jenkins(); j.CanApplyToCurrentContext().ShouldBe(true); }
public static MaterialDefinition LoadFromXPathNavigator(XPathNavigator navigator) { if (navigator == null) { return(null); } MaterialDefinition materialDefinition = new MaterialDefinition(); //name materialDefinition.Name = navigator.GetAttribute("Name", string.Empty); materialDefinition.NameHash = Jenkins.OneAtATime(materialDefinition.Name); //type materialDefinition.Type = navigator.GetAttribute("Type", string.Empty); materialDefinition.TypeHash = Jenkins.OneAtATime(materialDefinition.Type); //draw styles XPathNodeIterator entries = navigator.Select("./Array[@Name='DrawStyles']/Object[@Class='DrawStyle']"); while (entries.MoveNext()) { DrawStyle drawStyle = DrawStyle.LoadFromXPathNavigator(entries.Current); if (drawStyle != null) { materialDefinition.DrawStyles.Add(drawStyle); } } return(materialDefinition); }
public void GenerateSetVersionMessageReturnsVersionAsIs_AlthoughThisIsNotUsedByJenkins() { var j = new Jenkins(); var vars = new TestableVersionVariables(fullSemVer: "0.0.0-Beta4.7"); j.GenerateSetVersionMessage(vars).ShouldBe("0.0.0-Beta4.7"); }
static void AssertVariablesAreWrittenToFile(string f) { var writes = new List <string>(); var semanticVersion = new SemanticVersion { Major = 1, Minor = 2, Patch = 3, PreReleaseTag = "beta1", BuildMetaData = "5" }; semanticVersion.BuildMetaData.CommitDate = DateTimeOffset.Parse("2014-03-06 23:59:59Z"); semanticVersion.BuildMetaData.Sha = "commitSha"; var config = new TestEffectiveConfiguration(); var variables = VariableProvider.GetVariablesFor(semanticVersion, config, false); var j = new Jenkins(f); j.WriteIntegration(writes.Add, variables); writes[1].ShouldBe("1.2.3-beta.1+5"); File.Exists(f).ShouldBe(true); var props = File.ReadAllText(f); props.ShouldContain("GitVersion_Major=1"); props.ShouldContain("GitVersion_Minor=2"); }
public void CanNotApplyCurrentContextWhenEnvironmentVariableIsNotSet() { ClearEnvironmentVariableForDetection(); var j = new Jenkins(); j.CanApplyToCurrentContext().ShouldBe(false); }
protected override async Task RunTestAsync() { Jenkins.MainLog.WriteLine("Running XI on '{0}' ({2}) for {1}", Device?.Name, ProjectFile, Device?.UDID); ExecutionResult = ExecutionResult & ~TestExecutingResult.InProgressMask | TestExecutingResult.Running; await BuildTask.RunAsync(); if (!BuildTask.Succeeded) { ExecutionResult = TestExecutingResult.BuildFailure; return; } using (var resource = await NotifyBlockingWaitAsync(AcquireResourceAsync())) { if (runner == null) { await SelectSimulatorAsync(); } await runner.RunAsync(); } ExecutionResult = runner.Result; KnownFailure = null; if (Jenkins.IsHE0038Error(runner.MainLog)) { KnownFailure = $"<a href='https://github.com/xamarin/maccore/issues/581'>HE0038</a>"; } }
internal JenkinsBuild(Jenkins jenkins, JenkinsJob job, JenkinsModelRun modelRun) { this.jenkins = jenkins; this.job = job; this.modelRun = modelRun; this.isCompleteLoaded = false; }
public void JobGetGenericTest() { // Arrange JenkinsModelFreeStyleProject freeStyleJob = null; JenkinsModelExternalJob externalJob = null; JenkinsMatrixMatrixProject matrixJob = null; JenkinsJenkinsciWorkflowJob workflowJob = null; //JenkinsJenkinsciWorkflowMultiBranchProject multiBranchJob = null; //JenkinsCloudbeesFolder folderJob = null; //JenkinsBranchOrganizationFolder organizationFolderJob = null; // Act using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password)) { freeStyleJob = jenkins.GetJobAsync <JenkinsModelFreeStyleProject>("FreeStyle").Result; externalJob = jenkins.GetJobAsync <JenkinsModelExternalJob>("ExternalJob").Result; matrixJob = jenkins.GetJobAsync <JenkinsMatrixMatrixProject>("Multiconfiguration").Result; workflowJob = jenkins.GetJobAsync <JenkinsJenkinsciWorkflowJob>("Pipeline").Result; //multiBranchJob = jenkins.GetJobAsync<JenkinsJenkinsciWorkflowMultiBranchProject>("MultibranchPipeline").Result; //folderJob = jenkins.GetJobAsync<JenkinsCloudbeesFolder>("Folder").Result; //organizationFolderJob = jenkins.GetJobAsync<JenkinsBranchOrganizationFolder>("GitHubOrganization").Result; } // Assert Assert.IsNotNull(freeStyleJob); Assert.IsNotNull(externalJob); Assert.IsNotNull(matrixJob); Assert.IsNotNull(workflowJob); //Assert.IsNotNull(multiBranchJob); //Assert.IsNotNull(folderJob); //Assert.IsNotNull(organizationFolderJob); }
protected override async Task RunTestAsync() { Jenkins.MainLog.WriteLine("Running XI on '{0}' ({2}) for {1}", Device?.Name, ProjectFile, Device?.UDID); ExecutionResult = ExecutionResult & ~TestExecutingResult.InProgressMask | TestExecutingResult.Running; await BuildTask.RunAsync(); if (!BuildTask.Succeeded) { ExecutionResult = TestExecutingResult.BuildFailure; return; } using (var resource = await NotifyBlockingWaitAsync(AcquireResourceAsync())) { if (runner == null) { await SelectSimulatorAsync(); } await runner.RunAsync(); } ExecutionResult = runner.Result; KnownFailure = null; if (Jenkins.IsKnownTestIssue(runner.MainLog, out KnownFailure)) { Jenkins.MainLog.WriteLine($"Test run has a known failure: '{KnownFailure}'"); } }
public void BuildTest() { JenkinsModelFreeStyleBuild freeStyleBuild = null; //JenkinsBuildExternal externalBuild = null; JenkinsMatrixMatrixBuild matrixBuild = null; JenkinsOrgJenkinsciPluginsWorkflowJobWorkflowRun workflowBuild = null; //JenkinsBuildWorkflowMultiBranch multiBranchBuild = null; //JenkinsBuildFolder folderBuild = null; //JenkinsBuildOrganizationFolder organizationFolderBuild = null; using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password)) { freeStyleBuild = jenkins.GetLastBuildAsync("Freestyle Test Pure").Result as JenkinsModelFreeStyleBuild; //externalBuild = jenkins.GetBuildAsync("External Job", 1).Result as JenkinsBuildExternal; matrixBuild = jenkins.GetBuildAsync("Multiconfiguration", 1).Result as JenkinsMatrixMatrixBuild; workflowBuild = jenkins.GetBuildAsync("Pipeline", 1).Result as JenkinsOrgJenkinsciPluginsWorkflowJobWorkflowRun; //multiBranchBuild = jenkins.GetBuildAsync("Multibranch", 1).Result as JenkinsBuildWorkflowMultiBranch; //folderBuild = jenkins.GetBuildAsync("Folder", 1).Result as JenkinsBuildFolder; //organizationFolderBuild = jenkins.GetBuildAsync("GitHub", 1).Result as JenkinsBuildOrganizationFolder; } Assert.IsNotNull(freeStyleBuild); //Assert.IsNotNull(externalBuild); Assert.IsNotNull(matrixBuild); //Assert.IsNotNull(workflowBuild); //Assert.IsNotNull(multiBranchBuild); //Assert.IsNotNull(folderBuild); //Assert.IsNotNull(organizationFolderBuild); }
internal JenkinsBuild(Jenkins jenkins, JenkinsJob job, int buildNum) { this.jenkins = jenkins; this.job = job; this.modelRun = JenkinsRun.Run(() => jenkins.GetBuildAsync <JenkinsModelRun>(this.JobName, buildNum).Result); this.isCompleteLoaded = true; }
public JenkinsGetCommand(IJenkinsContext context) { if (context == null) { throw new ArgumentNullException(nameof(context)); } Url = NetPath.Combine(context.BaseUrl, "api/xml"); UserName = context.UserName; Password = context.Password; Crumb = context.Crumb; OnWrite = request => { request.Method = "GET"; }; OnRead = response => { var document = ReadXml(response); Result = new Jenkins(document.Root); }; #if NET_ASYNC OnWriteAsync = async(request, token) => { request.Method = "GET"; }; OnReadAsync = async(response, token) => { var document = await ReadXmlAsync(response); Result = new Jenkins(document.Root); }; #endif }
public void InstancesTest() { List <JenkinsInstance> list = Jenkins.GetJenkinsInstancesAsync().Result?.ToList(); Assert.IsNotNull(list, "list"); Assert.IsTrue(list.Count > 0, "list.Count"); }
public void ViewGetGenericTest() { // Arrange JenkinsModelListView listView = null; JenkinsModelMyView myView = null; JenkinsModelAllView allView = null; JenkinsJenkinsciCategorizedJobsView categorizedJobsView = null; JenkinsPluginsViewDashboardDashboard dashboard = null; JenkinsTikalMultiJobView multiJobView = null; // Act using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password)) { listView = jenkins.GetViewAsync <JenkinsModelListView>("ListView").Result; myView = jenkins.GetViewAsync <JenkinsModelMyView>("MyView").Result; allView = jenkins.GetViewAsync <JenkinsModelAllView>("all").Result; categorizedJobsView = jenkins.GetViewAsync <JenkinsJenkinsciCategorizedJobsView>("Categorization").Result; dashboard = jenkins.GetViewAsync <JenkinsPluginsViewDashboardDashboard>("Dashboard").Result; multiJobView = jenkins.GetViewAsync <JenkinsTikalMultiJobView>("MultiJob").Result; } // Assert Assert.IsNotNull(listView, nameof(listView)); Assert.AreEqual("hudson.model.ListView", listView.Class, nameof(listView.Class)); Assert.AreEqual("ListView", listView.Name, nameof(listView.Name)); Assert.AreEqual("ListView Description", listView.Description, nameof(listView.Description)); Assert.AreEqual($"{this.host}view/ListView/", listView.Url, nameof(listView.Url)); Assert.IsNotNull(myView, nameof(myView)); Assert.IsNotNull(allView, nameof(allView)); Assert.IsNotNull(categorizedJobsView, nameof(categorizedJobsView)); Assert.IsNotNull(dashboard, nameof(dashboard)); Assert.IsNotNull(multiJobView, nameof(multiJobView)); }
public void JobConfigTest() { // Arrange string orgConfig = null; //string updConfig = null; //string cngConfig = null; //string descOrg = null; //string descCng = null; // Act using (Jenkins jenkins = new Jenkins(host, this.login, this.password)) { orgConfig = jenkins.GetJobConfigAsync("FreestyleConfig", CancellationToken.None).Result; //descOrg = GetConfigDescription(orgConfig); //cngConfig = SetConfigDescription(orgConfig, "Test Description"); //jenkins.SetJobConfigAsync("FreeStyleConfig", cngConfig, CancellationToken.None).Wait(); //updConfig = jenkins.GetJobConfigAsync("FreeStyleConfig", CancellationToken.None).Result; //descCng = GetConfigDescription(updConfig); //jenkins.SetJobConfigAsync("FreeStyleConfig", orgConfig, CancellationToken.None).Wait(); } // Assert Assert.IsNotNull(orgConfig); //Assert.IsNotNull(updConfig); //Assert.IsNotNull(cngConfig); //Assert.AreEqual("Default Description", descOrg, nameof(descOrg)); //Assert.AreEqual("Test Description", descCng, nameof(descCng)); }
public void JobRunFileTest() { // Arrange MemoryStream stream = new MemoryStream(); StreamWriter writer = new StreamWriter(stream); writer.WriteLine("This is a test file!"); stream.Position = 0; JenkinsRunProgress progress; JenkinsBuildParameters par = new JenkinsBuildParameters(); par.Add("ParamA", ""); par.Add("ParamB", ""); par.Add("ParamC", ""); par.Add("CheckD", true); par.Add("CheckE", false); par.Add("TextBoxF", "Dies ist ein\r\nkleines Beispiel"); par.Add("TestFile", stream, "FileName.bin"); // Act using (Jenkins jenkins = new Jenkins(host, this.login, this.password)) { progress = jenkins.RunJobAsync("FreestyleFile", par).Result; } // Assert Assert.IsNotNull(progress, nameof(progress)); //Assert.IsNotNull(item.Url, "build.Result"); }
public void GetComputerSetTest() { using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password)) { JenkinsModelComputerSet set = jenkins.GetComputerSetAsync().Result; } }
private static TextureType GetTextureType(uint parameterHash) { uint baseDiffuseHash = Jenkins.OneAtATime("baseDiffuse"); uint BaseDiffuseHash = Jenkins.OneAtATime("BaseDiffuse"); uint basediffuseHash = Jenkins.OneAtATime("basediffuse"); uint SpecHash = Jenkins.OneAtATime("Spec"); uint specHash = Jenkins.OneAtATime("spec"); uint BumpHash = Jenkins.OneAtATime("Bump"); uint BumpMapHash = Jenkins.OneAtATime("BumpMap"); if (parameterHash == baseDiffuseHash || parameterHash == BaseDiffuseHash || parameterHash == basediffuseHash) { return(TextureType.Diffuse); } if (parameterHash == SpecHash || parameterHash == specHash) { return(TextureType.Spec); } if (parameterHash == BumpHash || parameterHash == BumpMapHash) { return(TextureType.Bump); } return(TextureType.Invalid); }
public void UpdateClass() { // structure textureDictionary.VFT = 0x0000000140570fd0; textureDictionary.PagesInfoPointer = 0x0000000000000000; textureDictionary.Count = 0x00000001; textureDictionary.Unknown_1Ch = 0x00000000; // references textureDictionary.PagesInfo = null; if (textureDictionary.Values.Entries != null) { var theHashList = new List <uint>(); foreach (var texture in textureDictionary.Values.Entries) { uint hash = Jenkins.Hash((string)texture.Name); theHashList.Add(hash); } theHashList.Sort(); var bak = textureDictionary.Values.Entries; textureDictionary.Hashes.Entries = new SimpleArray <uint>(theHashList.ToArray()); textureDictionary.Values.Entries = new ResourcePointerArray64 <TextureDX11>(); foreach (uint x in theHashList) { foreach (var g in bak) { uint tx = Jenkins.Hash((string)g.Name); if (tx == x) { textureDictionary.Values.Entries.Add(g); } } } //textureDictionary.Hashes = new SimpleArray<uint>(); //foreach (var texture in textureDictionary.Textures) //{ // uint hash = Jenkins.Hash((string)texture.Name); // textureDictionary.Hashes.Add((uint_r)hash); //} //var bak = textureDictionary.Textures; //textureDictionary.Textures = new ResourcePointerArray64<Texture_GTA5_pc>(); foreach (var texture in textureDictionary.Values.Entries) { (new TextureWrapper_GTA5_pc(texture)).UpdateClass(); } } else { } }
static void HandleGenericOptions(string[] args) { CommandLine.Parse <GenericOptions>(args, (opts, gOpts) => { int level = DLCList.Length - 1; if (opts.DlcLevel != null) { level = Array.IndexOf(DLCList, opts.DlcLevel.ToLowerInvariant()); if (level == -1) { level = DLCList.Length - 1; } } EnsureFiles(level); // EnsureArchetypes(level); if (opts.Mods != null) { Console.WriteLine("Loading mods"); var infos = Utils.Expand(opts.Mods); int count = 0; for (int i = 0; i < infos.Length; i++) { var name = Path.GetFileNameWithoutExtension(infos[i].Name); var ext = Path.GetExtension(infos[i].Name); if (ext.Length > 0) { ext = ext.Substring(1); } var hash = Jenkins.Hash(name.ToLowerInvariant()); switch (ext) { case "ydr": { var ydr = new YdrFile(); ydr.Load(infos[i].FullName); DrawableCache[hash] = ydr.Drawable; count++; break; } default: break; } } Console.Error.WriteLine("Loaded " + count + " mods"); } return; }); }
public HtmlReportWriter(Jenkins jenkins, IResourceManager resourceManager, IResultParser resultParser, string?linksPrefix = null, bool embeddedResources = false) { this.jenkins = jenkins ?? throw new ArgumentNullException(nameof(jenkins)); this.resourceManager = resourceManager ?? throw new ArgumentNullException(nameof(resourceManager)); this.resultParser = resultParser ?? throw new ArgumentNullException(nameof(resultParser)); this.linksPrefix = linksPrefix; this.embededResources = embeddedResources; }
public void GenerateMessageTest() { var j = new Jenkins(); var generatedParameterMessages = j.GenerateSetParameterMessage("name", "value"); generatedParameterMessages.Length.ShouldBe(1); generatedParameterMessages[0].ShouldBe("GitVersion_name=value"); }
public void SetUp() { sp = ConfigureServices(services => { services.AddSingleton <Jenkins>(); }); environment = sp.GetService <IEnvironment>(); buildServer = sp.GetService <Jenkins>(); }
public void RunUserTest() { using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password)) { string user = jenkins.GetComputerUserAsync("(master)").Result; } //Assert.AreEqual(JenkinsResult.Success, build.Result, "build.Result"); }
public static uint Hash(string str) { if (!uint.TryParse(str, out uint hash)) { hash = Jenkins.Hash(str); Jenkins.Ensure(str); } return(hash); }
public void RunTest() { JenkinsModelRun build; using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password)) { build = jenkins.RunJobComplete("Freestyle Test Pure"); } //Assert.AreEqual(JenkinsResult.Success, build.Result, "build.Result"); }
public void CredentialsTest() { JenkinsComCloudbeesPluginsCredentialsViewCredentialsActionRootActionImpl credentials; using (Jenkins jenkins = new Jenkins(this.host, this.login, this.password)) { credentials = jenkins.GetCredentialsAsync().Result; } Assert.IsNotNull(credentials, "credentials"); }
public Configuration(Jenkins.Jenkins jenkins, string password = null) { this.jenkins = jenkins; InitializeComponent(); AcceptButton = btnSave; chbRemoteExec.CheckedChanged +=new EventHandler(delegate (object o, EventArgs args) { panelRemote.Enabled = chbRemoteExec.Checked; }); panelRemote.Enabled = chbRemoteExec.Checked; this.txtUsername.Text = Properties.Settings.Default.UserID; if (string.IsNullOrEmpty(password) == false) { // auto-configure this.mtbPassword.Text = password; Properties.Settings.Default.RemoteExecution = true; } comboVehicleForgeURL.Items.Add("https://gamma.vehicleforge.org"); comboVehicleForgeURL.Items.Add("https://beta.vehicleforge.org"); }