Zubaidullo's Blog
Every self-respecting company getting good quality projects uses quality management platform like SonarQube, MetrixWare, Squale, etc.
Today, I'm going to share my knowledge about using SonarQube. SonarQube is an open source code quality management platform. Other definitions you can find from wiki. I'm going to share about how to work with SonarQube metrics, how to get metrics for your application. You can use some ways for getting metrics from SonarQube server. The easy way is using Java Sonar-ws-Client or using REST API. Java Sonar-ws-client Maven dependency: <dependency> <groupId>com.atlassian.jira</groupId> <artifactId>jira-rest-java-client</artifactId> <!--Put the version of SonarQube, which you're using--> <version>4.5.1</version> </dependency> Creating Sonar Client: Sonar sonarClient = Sonar.create("http://sonar.example.com", "user", "password"); Finding metrics by request: Resource blogProject = sonar.find (ResourceQuery.createForMetrics(project_name, "coverage", "tests", etc.. )) //here you will add metrics Getting metrics for use: String coverage = blogProject.getMeasure("coverage").getFormattedValue(); //here we can get on different format our metrics
0 Comments
I wanted to work with JIRA with making my own App. Searched how to use it with best way. Finally, stopped on JIRA REST Java Client. It's easy for use for Java users.
Maven dependency: <dependency> <groupId>com.atlassian.jira</groupId> <artifactId>jira-rest-java-client</artifactId> <version>0.6-m8</version> </dependency> Simple starting code: SearchResult searchResult = null; JerseyJiraRestClientFactory() factory = new JerseyJiraRestClientFactory(); URI jiraUri = new URI("http://example.com"); JiraRestClient restClient = factory.createWithBasicHttpAuthentication(jiraUri, user,password); SearchResult searchResult = restClient.getSearchClient().searchJql(jql_filte, progressMonitor); //Here you can get Issues, Projects, etc. Iterable<BasicIssue> issues = searchResult.getIssues(); //Then you will take every issue from issues and get anything about issue..... After the long time of searching (there is no about getting full user list in JIRA REST API Documentation) how to get JIRA Project users list, finally got answer. And wanted to share it.
For now, getting list of users in one request it's not possible, because it's in progress of developing. https://jira.atlassian.com/browse/JRA-29069 Solution: You can get list of projects in JIRA. By key of projects we can get users list. List of project by REST API: http://jira.your.address/rest/api/2/project List of users: https://jira.your.address/rest/api/2/user/assignable/search?project=YOUR_PROJECT |
AuthorJava developer and experienced Designer, Flash animator. Very good algorithmic programming skills. Participant of International Olympiads. Very good skilled in designing. Archives
September 2017
Categories |