public override int Run(string[] remainingArguments) { var encodedCredentials = JiraApi.GetEncodedCredentials(_username, _password); Console.WriteLine("Encoded string for use as username/password: {0}", encodedCredentials); return(0); }
/// <summary> /// Override the BeginProcessingAsync to connect to our jira /// </summary> protected override Task BeginProcessingAsync() { JiraApi = new JiraApi(JiraUri); if (Username != null) { JiraApi.SetBasicAuthentication(Username, Password); } return Task.FromResult(true); }
public JiraProjectRepository(ISettingsService settingsService, IInputService inputService) : base(settingsService, inputService) { // the project and time repositories use different API's but the same user and password // question: how do I best go about getting the correct urls? // do I just assume that the last portion of the url will always be the same? // we'll go down that route for now _api = new JiraApi(JiraUser, ApiBaseUrl); }
/// <summary> /// Process the Projects output /// </summary> protected override async Task ProcessRecordAsync() { var projects = await JiraApi.GetProjectsAsync(); foreach (var projectDigest in projects) { WriteObject(projectDigest); } }
/// <summary> /// Override the BeginProcessingAsync to connect to our jira /// </summary> protected override Task BeginProcessingAsync() { JiraApi = new JiraApi(JiraUri); if (Username != null) { JiraApi.SetBasicAuthentication(Username, Password); } return(Task.FromResult(true)); }
public void CanFetchJiraIssueFromId() { var jira = new JiraApi(); var bug = jira.FromId("SDC-1604").Result; Assert.AreEqual("Projects occasionally blow up when loaded against dbs with schema differences", bug.Title); Assert.AreEqual("Open", bug.Status); Assert.AreEqual(1, bug.CommentCount); StringAssert.Contains("User has a source DB", bug.Description); }
private async void btnStartMigration_Click(object sender, EventArgs e) { completedProcesses = 0; progressBarMigration.Value = 0; progressBarMigration.Show(); progressBarMigration.Maximum = totalProcesses; lblInfo.Hide(); lblInfo.Text = ""; txtDetails.Text = ""; lblInfo.Show(); lblDetails.Show(); jiraClient = new JiraApi(jiraUrl, jiraUsername, jiraPassword); vsoClient = new VSOApi(vsoUrl, vsoUsername, vsoPassword); migration = new MigrationHelper(jiraClient, vsoClient); if (cbProjects.Checked) { lblInfo.Text = "Migrating projects..."; txtDetails.Text += await migration.MigrateProjects(); progressBarMigration.Value++; } if (cbSprints.Checked) { lblInfo.Text = "Migrating sprints..."; txtDetails.Text += await migration.MigrateSprints(); progressBarMigration.Value++; } if (cbStories.Checked) { lblInfo.Text = "Migrating stories..."; txtDetails.Text += await migration.MigrateStories(); progressBarMigration.Value++; } if (cbSprintStories.Checked) { lblInfo.Text = "Migrating sprint stories..."; txtDetails.Text += await migration.MigrateSprintsStories(); progressBarMigration.Value++; } if (totalProcesses == 0) { lblInfo.Text = "Nothing to Migrate"; } if (totalProcesses == progressBarMigration.Value && totalProcesses != 0) { lblInfo.Text = "Migration Finished, see details >>"; } }
public JiraTests(ITestOutputHelper testOutputHelper) { LogSettings.RegisterDefaultLogger <XUnitLogger>(LogLevels.Verbose, testOutputHelper); _jiraApi = new JiraApi(TestJiraUri); var username = Environment.GetEnvironmentVariable("jira_test_username"); var password = Environment.GetEnvironmentVariable("jira_test_password"); if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password)) { _jiraApi.SetBasicAuthentication(username, password); } }
public JiraTests(ITestOutputHelper testOutputHelper) { LogSettings.RegisterDefaultLogger<XUnitLogger>(LogLevels.Verbose, testOutputHelper); _jiraApi = new JiraApi(TestJiraUri); var username = Environment.GetEnvironmentVariable("jira_test_username"); var password = Environment.GetEnvironmentVariable("jira_test_password"); if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password)) { _jiraApi.SetBasicAuthentication(username, password); } }
public async Task <IActionResult> SetJiraAuth([FromBody] JiraApi auth) { if (string.IsNullOrWhiteSpace(auth.Authentication) || string.IsNullOrWhiteSpace(auth.JiraCloudUrl) || string.IsNullOrWhiteSpace(auth.ProjectKey)) { return(BadRequest("Please provide correct full info of auth for Jira")); } _testManagerService.SetJiraCloudApi(auth); return(Ok("Jira auth has been setup")); }
private async void MainWindow_Loaded(object sender, RoutedEventArgs e) { var jiraApi = new JiraApi(new Uri("https://greenshot.atlassian.net")); var projects = await jiraApi.GetProjectsAsync(); foreach (var project in projects) { // Demonstrate the Avatar and it's underlying GetAsAsync<BitmapSource> // could also be done with setting the source of the image, but this might not work without login var avatar = await jiraApi.GetAvatarAsync<BitmapSource>(project.Avatar); Projects.Add(new Project { Title = project.Name, Avatar = avatar }); } }
/// <summary> /// Do the actual uploading, return the attachment object(s) /// </summary> protected override async Task ProcessRecordAsync() { if (!Path.IsPathRooted(Filepath)) { var currentDirectory = CurrentProviderLocation("FileSystem").ProviderPath; Filepath = Path.Combine(currentDirectory, Filepath); } if (!File.Exists(Filepath)) { throw new FileNotFoundException($"Couldn't find file {Filepath}"); } using (var stream = File.OpenRead(Filepath)) { var attachment = await JiraApi.AttachAsync(IssueKey, stream, Filename, ContentType); WriteObject(attachment); } }
private async void MainWindow_Loaded(object sender, RoutedEventArgs e) { var jiraApi = new JiraApi(new Uri("https://greenshot.atlassian.net")); var projects = await jiraApi.GetProjectsAsync(); foreach (var project in projects) { // Demonstrate the Avatar and it's underlying GetAsAsync<BitmapSource> // could also be done with setting the source of the image, but this might not work without login var avatar = await jiraApi.GetAvatarAsync <BitmapSource>(project.Avatar); Projects.Add(new Project { Title = project.Name, Avatar = avatar }); } }
public JiraOAuthTests(ITestOutputHelper testOutputHelper) { // A demo Private key, to create a RSACryptoServiceProvider. // This was created from a .pem via a tool here http://www.jensign.com/opensslkey/index.html const string privateKeyXml = @"<RSAKeyValue><Modulus>tGIwsCH2KKa6vxUDupW92rF68S5SRbgr7Yp0xeadBsb0BruTt4GMrVL7QtiZWM8qUkY1ccMa7LkXD93uuNUnQEsH65s8ryID9P DeEtCBcxFEZFdcKfyKR+5B+NRLW5lJq10sHzWbJ0EROUmEjoYfi3CtsMkJHYHDL9dZeCqAZHM=</Modulus><Exponent>AQAB</Exponent><P>14DdDg26 CrLhAFQIQLT1KrKVPYr0Wusi2ovZApz2/RnM7a7CWUJuDR3ClW5g9hdi+KQ0ceD5oJYX5Vexv2uk+w==</P><Q>1kfU0+DkXc6I/jXHJ6pDLA5s7dBHzWgDs BzplSdkVQbKT3MbeYjeByOxzXhulOWLBQW/vxmW4HwU95KTRlj06Q==</Q><DP>SPoBYY3yb0cN/J94P/lHgJMDCNkyUEuJ/PoYndLrrN/8zow8kh91xwlJ6 HJ9cTiQMmTgwaOOxPuu0eI1df4M2w==</DP><DQ>klJaspRPXP877NssM5nAZMU0/O/NGCZ+3jPgDUno6WbJn5cqm8MqWhW1xGkImgRk+fkDBquiq4gPiT89 8jusgQ==</DQ><InverseQ>d5Zrr6Q8AO/0isr/3aa6O6NLQxISLKcPDk2NOccAfS/xOtfOz4sJYM3+Bs4Io9+dZGSDCA54Lw03eHTNQghS0A==</Inverse Q><D>WFlbZXlM2r5G6z48tE+RTKLvB1/btgAtq8vLw/5e3KnnbcDD6fZO07m4DRaPjRryrJdsp8qazmUdcY0O1oK4FQfpprknDjP+R1XHhbhkQ4WEwjmxPst ZMUZaDWF58d3otc23mCzwh3YcUWFu09KnMpzZsK59OfyjtkS44EDWpbE=</D></RSAKeyValue>"; // Create the RSACryptoServiceProvider for the XML above var rsaCryptoServiceProvider = new RSACryptoServiceProvider(); rsaCryptoServiceProvider.FromXmlString(privateKeyXml); // Configure the XUnitLogger for logging LogSettings.RegisterDefaultLogger <XUnitLogger>(LogLevels.Verbose, testOutputHelper); // Only a few settings for the Jira OAuth are important var oAuthSettings = new JiraOAuthSettings { // Is specified on the linked-applications as consumer key ConsumerKey = "lInXLgx6HbF9FFq1ZQN8iSEnhzO3JVuf", // This needs to have the private key, the represented public key is set in the linked-applications RsaSha1Provider = rsaCryptoServiceProvider, // Use a server at Localhost to redirect to, alternative an embedded browser can be used AuthorizeMode = AuthorizeModes.LocalhostServer, // When using the embbed browser this is directly visible, with the LocalhostServer it's in the info notice after a redirect CloudServiceName = "Greenshot Jira", // the IOAuth1Token implementation, here it's this, gets the tokens to store & retrieve for later Token = this }; // Create the JiraApi for the Uri and the settings _jiraApi = new JiraApi(TestJiraUri, oAuthSettings); }
public JiraOAuthTests(ITestOutputHelper testOutputHelper) { // A demo Private key, to create a RSACryptoServiceProvider. // This was created from a .pem via a tool here http://www.jensign.com/opensslkey/index.html const string privateKeyXml = @"<RSAKeyValue><Modulus>tGIwsCH2KKa6vxUDupW92rF68S5SRbgr7Yp0xeadBsb0BruTt4GMrVL7QtiZWM8qUkY1ccMa7LkXD93uuNUnQEsH65s8ryID9P DeEtCBcxFEZFdcKfyKR+5B+NRLW5lJq10sHzWbJ0EROUmEjoYfi3CtsMkJHYHDL9dZeCqAZHM=</Modulus><Exponent>AQAB</Exponent><P>14DdDg26 CrLhAFQIQLT1KrKVPYr0Wusi2ovZApz2/RnM7a7CWUJuDR3ClW5g9hdi+KQ0ceD5oJYX5Vexv2uk+w==</P><Q>1kfU0+DkXc6I/jXHJ6pDLA5s7dBHzWgDs BzplSdkVQbKT3MbeYjeByOxzXhulOWLBQW/vxmW4HwU95KTRlj06Q==</Q><DP>SPoBYY3yb0cN/J94P/lHgJMDCNkyUEuJ/PoYndLrrN/8zow8kh91xwlJ6 HJ9cTiQMmTgwaOOxPuu0eI1df4M2w==</DP><DQ>klJaspRPXP877NssM5nAZMU0/O/NGCZ+3jPgDUno6WbJn5cqm8MqWhW1xGkImgRk+fkDBquiq4gPiT89 8jusgQ==</DQ><InverseQ>d5Zrr6Q8AO/0isr/3aa6O6NLQxISLKcPDk2NOccAfS/xOtfOz4sJYM3+Bs4Io9+dZGSDCA54Lw03eHTNQghS0A==</Inverse Q><D>WFlbZXlM2r5G6z48tE+RTKLvB1/btgAtq8vLw/5e3KnnbcDD6fZO07m4DRaPjRryrJdsp8qazmUdcY0O1oK4FQfpprknDjP+R1XHhbhkQ4WEwjmxPst ZMUZaDWF58d3otc23mCzwh3YcUWFu09KnMpzZsK59OfyjtkS44EDWpbE=</D></RSAKeyValue>"; // Create the RSACryptoServiceProvider for the XML above var rsaCryptoServiceProvider = new RSACryptoServiceProvider(); rsaCryptoServiceProvider.FromXmlString(privateKeyXml); // Configure the XUnitLogger for logging LogSettings.RegisterDefaultLogger<XUnitLogger>(LogLevels.Verbose, testOutputHelper); // Only a few settings for the Jira OAuth are important var oAuthSettings = new JiraOAuthSettings { // Is specified on the linked-applications as consumer key ConsumerKey = "lInXLgx6HbF9FFq1ZQN8iSEnhzO3JVuf", // This needs to have the private key, the represented public key is set in the linked-applications RsaSha1Provider = rsaCryptoServiceProvider, // Use a server at Localhost to redirect to, alternative an embedded browser can be used AuthorizeMode = AuthorizeModes.LocalhostServer, // When using the embbed browser this is directly visible, with the LocalhostServer it's in the info notice after a redirect CloudServiceName = "Greenshot Jira", // the IOAuth1Token implementation, here it's this, gets the tokens to store & retrieve for later Token = this }; // Create the JiraApi for the Uri and the settings _jiraApi = new JiraApi(TestJiraUri, oAuthSettings); }
public JiraSessionTests(ITestOutputHelper testOutputHelper) { LogSettings.RegisterDefaultLogger<XUnitLogger>(LogLevels.Verbose, testOutputHelper); _jiraApi = new JiraApi(TestJiraUri); }
public AtlassianService(Zapi zapi, JiraApi jiraApi) { _zephyrCloudApi = new ZephyrCloudApi(zapi); _jiraCloudApi = new JiraCloudApi(jiraApi); }
public void InitializeForProject(Project project) { _baseJiraRepository.KeyModifier = project.Id; _api = new JiraApi(_baseJiraRepository.JiraUser, _baseJiraRepository.ApiBaseUrl); }
/// <summary> /// Override ProcessRecordAsync to get the issue data and output the object /// </summary> /// <returns></returns> protected override async Task ProcessRecordAsync() { var issue = await JiraApi.GetIssueAsync(IssueKey); WriteObject(issue.Fields); }
public JiraCommitEmulator(ILog log, JiraApi jiraApi) { _log = log; _jiraApi = jiraApi; }
public void ReturnsNullOnError() { var jira = new JiraApi(); Assert.Null(jira.FromId("UTF-8").Result); }
public JiraClient(String server, JiraCredentials credentials) { Server = server; Credentials = credentials; api = new JiraApi(server, credentials); }
public JiraCacheTests(ITestOutputHelper testOutputHelper) { LogSettings.RegisterDefaultLogger<XUnitLogger>(LogLevels.Verbose, testOutputHelper); _jiraApi = new JiraApi(TestJiraUri); _avatarCache = new AvatarCache(_jiraApi); }
public async Task <List <TimeEntryValidationResult> > Validate(Release release, List <TimeEntry> timeEntries) { var jiraStoriesInRelease = (await JiraApi.GetStoriesInReleaseAsync(release.ReleaseNumber)); var results = new List <TimeEntryValidationResult>(); foreach (var timeEntry in timeEntries) { var errors = new List <string>(); var warnings = new List <string>(); var isPlanned = (MavenlinkHelper.GetBillingClassification(timeEntry.TaskTitleOverride) == BillingClassificationEnum.Planned); var referencedStoryIds = MavenlinkHelper.GetJiraStoryIds(timeEntry.NotesOverride); if (referencedStoryIds.Count <= 1 && timeEntry.DurationMinutesOverride < 15) { warnings.Add($"Minimum billing increment is 15 minutes"); } else if (referencedStoryIds.Count > 1) { var timePerStory = (timeEntry.DurationMinutesOverride / referencedStoryIds.Count); if (timePerStory < 15m) { warnings.Add($"Each Jira story would receive {timePerStory} minutes of elapsed time, less than the 15-min minimum billing increment."); } } foreach (var jiraStoryId in referencedStoryIds) { var jiraStory = jiraStoriesInRelease .Where(x => x.Id == jiraStoryId) .FirstOrDefault(); // we're loading all of the stories in the release in a single load for performance, but if time is // billed to a story NOT in the release we still need to load it as a 1-off. if (jiraStory == null) { try { jiraStory = await JiraApi.GetStoryAsync(jiraStoryId); } catch (NotFoundException) { errors.Add($"Jira ID '{jiraStoryId}' was not found in Jira"); continue; } } // Billing time to a story not associated with the release is a warning; the time will be counted towards // the "undelivered" category and will not affect the metrics if (!jiraStory.FixVersions.Contains(release.ReleaseNumber)) { warnings.Add($"Jira {jiraStory.IssueType} '{jiraStoryId}' is not tagged to release {release.ReleaseNumber} and has status '{jiraStory.Status}'. Time will be counted towards 'undelivered'."); } var workItemType = JiraHelper.GetWorkItemType(jiraStory); var isEpic = (workItemType == WorkItemTypeEnum.Epic); var isDeclined = jiraStory.Status.EqualsIgnoringCase("Declined"); var isContingency = (workItemType == WorkItemTypeEnum.Contingency); var isFeatureRequest = (workItemType == WorkItemTypeEnum.FeatureRequest); if (isFeatureRequest) { warnings.Add($"'{jiraStoryId}' is a Feature Request; Feature Requests should not be billed as development, they should either be billed to a specific analysis ticket or to Unplanned Analysis."); } if (isDeclined) { warnings.Add($"Jira {jiraStory.IssueType} '{jiraStoryId}' is marked as 'DECLINED'. Time will be tracked towards 'undelivered'."); } if (isEpic && isPlanned) { warnings.Add($"'{jiraStoryId}' is an Epic; epics should generally have Overhead or Unplanned time instead of Planned."); } if (isContingency) { errors.Add($"'{jiraStoryId}' is a Contingency; Contingency cases should not have time billed to them. The time (and contingency points) should be moved to an actual feature."); } } if (errors.Any() || warnings.Any()) { results.Add( new TimeEntryValidationResult(timeEntry.Id, errors, warnings) ); } } return(results); }
public JiraCloudApi(JiraApi jiraApi) { _jiraApi = jiraApi; _restClient = new RestClient(jiraApi.JiraCloudUrl); _restClient.AddDefaultHeader("Authorization", jiraApi.Authentication); }
public MigrationHelper(JiraApi jiraClient, VSOApi vsoClient) { this.jiraClient = jiraClient; this.vsoClient = vsoClient; }
public JiraCacheTests(ITestOutputHelper testOutputHelper) { LogSettings.RegisterDefaultLogger <XUnitLogger>(LogLevels.Verbose, testOutputHelper); _jiraApi = new JiraApi(TestJiraUri); _avatarCache = new AvatarCache(_jiraApi); }
// // GET: /Browse/Project/{id} public ActionResult Project(string id) { var api = new JiraApi("jameym", "clemson95"); var project = api.GetProject(id); return View(project); }
public WorkLogTasksProcessor(ILog log, JiraApi jiraApi) { _log = log; _jiraApi = jiraApi; }
public MeetingProcessor(ILog log, JiraApi jiraApi) { _log = log; _jiraApi = jiraApi; }
public void SetJiraCloudApi(JiraApi jiraApi) => _jiraCloudApi = new JiraCloudApi(jiraApi);
static async Task RunAsync() { string jiraUrl = ConfigurationManager.AppSettings["jiraUrl"]; string jiraUsername = ConfigurationManager.AppSettings["jiraUsername"]; string jiraPassword = ConfigurationManager.AppSettings["jiraPassword"]; string vsoUrl = ConfigurationManager.AppSettings["vsoUrl"]; string vsoUsername = ConfigurationManager.AppSettings["vsoUsername"]; string vsoPassword = ConfigurationManager.AppSettings["vsoPassword"]; // Basic Auth JiraApi apiConsumer = new JiraApi(jiraUrl, jiraUsername, jiraPassword); VSOApi vsoApiConsumer = new VSOApi(vsoUrl, vsoUsername, vsoPassword); try { //Console.WriteLine("------------ Boards: "); //Boards boards = new Boards { }; //boards = await apiConsumer.GetBoards(); //Boards.Show(boards); //Console.WriteLine("------------ Board 1: "); //Board board = new Board { }; //board = await apiConsumer.GetBoard("1"); //Board.Show(board); //Console.WriteLine("------------ Board 1 Backlog: "); //Issues backlog = new Issues { }; //backlog = await apiConsumer.GetBoardBacklog("1"); //Issues.Show(backlog); //Console.WriteLine("------------ Board 1 Issues: "); //Issues boardIssues = new Issues { }; //boardIssues = await apiConsumer.GetBoardIssues("1"); //Issues.Show(boardIssues); //Console.WriteLine("------------ Board 1 Sprints: "); //Sprints sprints = null; //sprints = await apiConsumer.GetBoardSprints("1"); //Sprints.Show(sprints); //Models.Jira.Project[] projects = null; //projects = await apiConsumer.GetProjects(); //foreach (var i in projects) //{ // // Models.Jira.Project.Show(i); // Sprints sprints = null; // sprints = await apiConsumer.GetProjectSprints(i.id); // Console.WriteLine($"------------ Sprints from Project {i.id}: "); // foreach (var j in sprints.sprints){ // await vsoApiConsumer.createIteration(new Models.Vso.Project(i.name, i.description, "Git", "6b724908-ef14-45cf-84f8-768b5384da45"), new Models.Vso.Iteration(j.name, j.start, j.end)); // } // Sprints.Show(sprints); //} Models.Jira.Project[] projects = null; projects = await apiConsumer.GetProjects(); foreach (var i in projects) { // Models.Jira.Project.Show(i); Sprints sprints = null; sprints = await apiConsumer.GetProjectSprints(i.id); foreach (var j in sprints.sprints) { Issues issues = null; issues = await apiConsumer.GetProjectSprintIssues(j.id); foreach (var k in issues.issues) { await vsoApiConsumer.createIterationWorkItem(new Models.Vso.Project(i.name, i.description, "Git", "adcc42ab-9882-485e-a3ed-7678f01f66bc"), new Models.Vso.Iteration(j.name, j.start, j.end), k.fields.description); } } } //Console.WriteLine("------------ Current User: "******"------------ All Users: "); //User[] users = null; //users = await apiConsumer.GetUsers(); //foreach (var i in users) //{ // User.Show(i); //} //Console.WriteLine("------------ Workflows: "); //WorkFlow[] workflows = null; //workflows = await apiConsumer.GetWorkFlows(); //foreach (var i in workflows) //{ // WorkFlow.Show(i); //} //Console.WriteLine("------------ Issues: "); //Issues issues = null; //issues = await apiConsumer.GetProjectIssues("10000"); //Issues.Show(issues); //Console.WriteLine("------------ Permissions: "); //Permissions permissions = null; //permissions = await apiConsumer.GetPermissions(); //Permissions.Show(permissions); //Console.WriteLine("------------ Projects from board 1: "); //Models.Jira.Project[] projects = null; //projects = await apiConsumer.GetProjects(); //foreach (var i in projects) //{ // Models.Jira.Project.Show(i); // vsoApiConsumer.createProject(new Models.Vso.Project(i.name, i.description, "Git", "6b724908-ef14-45cf-84f8-768b5384da45")); //} //vsoApiConsumer.getProjects(); } catch (Exception e) { Console.WriteLine(e); } Console.ReadLine(); }
// // GET: /Browse/ public ActionResult Index() { var api = new JiraApi("jameym", "clemson95"); var projects = api.ListProjects(); return View(projects); }
/// <summary> /// Constructor /// </summary> /// <param name="jiraApi"></param> public AvatarCache(JiraApi jiraApi) { _jiraApi = jiraApi; }
// // GET: /Browse/Sprint/{id}?ver={versionId} public ActionResult Sprint(string id, string versionId) { var api = new JiraApi("jameym", "clemson95"); var sprint = api.Sprint(id, versionId); return View(sprint); }
public JiraIssueResolver(JiraApi api) { _api = api; }
public JiraSessionTests(ITestOutputHelper testOutputHelper) { LogSettings.RegisterDefaultLogger <XUnitLogger>(LogLevels.Verbose, testOutputHelper); _jiraApi = new JiraApi(TestJiraUri); }