Index: web-module/src/test/java/egovframework/api/arms/module_pdservicejira/ArmsJiraClientTest.java =================================================================== diff -u -re3ecbaaac8d23fc3a967b138af1b4c42956a87b4 -r3a5b0063766fee7f0faf0fe6b722954313fb4048 --- web-module/src/test/java/egovframework/api/arms/module_pdservicejira/ArmsJiraClientTest.java (.../ArmsJiraClientTest.java) (revision e3ecbaaac8d23fc3a967b138af1b4c42956a87b4) +++ web-module/src/test/java/egovframework/api/arms/module_pdservicejira/ArmsJiraClientTest.java (.../ArmsJiraClientTest.java) (revision 3a5b0063766fee7f0faf0fe6b722954313fb4048) @@ -3,6 +3,9 @@ import com.atlassian.jira.rest.client.api.GetCreateIssueMetadataOptions; import com.atlassian.jira.rest.client.api.JiraRestClient; import com.atlassian.jira.rest.client.api.domain.*; +import com.atlassian.jira.rest.client.api.domain.input.FieldInput; +import com.atlassian.jira.rest.client.api.domain.input.IssueInput; +import com.atlassian.jira.rest.client.api.domain.input.IssueInputBuilder; import com.atlassian.jira.rest.client.api.domain.input.VersionInput; import com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory; import com.atlassian.util.concurrent.Promise; @@ -14,7 +17,10 @@ import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; +import java.util.Collections; +import java.util.HashMap; import java.util.Iterator; +import java.util.Map; public class ArmsJiraClientTest { @@ -86,8 +92,8 @@ public void set_JiraVersion_ToProject() throws URISyntaxException { final JiraRestClient restClient = getJiraRestClient(); String projectKey = "JSTFFW"; - String name = "a-RMS 제품(서비스) 버전"; - String description = "a-RMS Desc"; + String name = "a-RMS_제품(서비스)_버전"; + String description = "a-RMS 요구사항 관리 버전"; DateTime releaseDate = new DateTime("2022-12-31"); boolean isArchived = false; boolean isReleased = false; @@ -136,26 +142,103 @@ } } - public void getSingle_IssueType() { + @Test + public void getSingle_IssueType() throws URISyntaxException { + final JiraRestClient restClient = getJiraRestClient(); + Promise promise = restClient.getMetadataClient().getIssueType(new URI("http://www.313.co.kr/jira/rest/api/latest/issuetype/10")); + IssueType issueType = promise.claim(); + logger.info("issueType => " + issueType.getId()); + logger.info("issueType => " + issueType.getName()); + logger.info("issueType => " + issueType.getSelf()); + logger.info("issueType => " + issueType.getDescription()); + logger.info("issueType => " + issueType.getIconUri()); + } + //a-RMS :: 우선순위를 조정 할 수 있다. ( 높음, 중간, 낮음 ) + @Test + public void getAll_Priority() throws URISyntaxException { + final JiraRestClient restClient = getJiraRestClient(); + Promise> promise = restClient.getMetadataClient().getPriorities(); + Iterable prioritys = promise.claim(); + for ( Priority priority : prioritys ){ + logger.info("priority = " + priority.getDescription()); + logger.info("priority = " + priority.getStatusColor()); + logger.info("priority = " + priority.getName()); + logger.info("priority = " + priority.getId()); + logger.info("priority = " + priority.getSelf()); + } } + @Test + public void get_Priority() throws URISyntaxException { + final JiraRestClient restClient = getJiraRestClient(); + Promise promise = restClient.getMetadataClient().getPriority(new URI("http://www.313.co.kr/jira/rest/api/2/priority/6")); + Priority priority = promise.claim(); + logger.info("priority = " + priority.getDescription()); + logger.info("priority = " + priority.getStatusColor()); + logger.info("priority = " + priority.getName()); + logger.info("priority = " + priority.getId()); + logger.info("priority = " + priority.getSelf()); + } + //이슈 타입은 7 버전 이상에서만 지원. //@Test //a-RMS :: Jira 에 이슈를 생성한다. ( 요구사항 타입 ) - public void set_RequirementIssue_aRMS() { + @Test + public void set_RequirementIssue_aRMS() throws URISyntaxException { + final JiraRestClient restClient = getJiraRestClient(); + + String jira_Project_KEY = "JSTFFW"; + Promise projectPromise = restClient.getProjectClient().getProject(jira_Project_KEY); + Project project = projectPromise.claim(); + + Promise issueTypePromise = restClient.getMetadataClient().getIssueType(new URI("http://www.313.co.kr/jira/rest/api/latest/issuetype/10")); + IssueType issueType = issueTypePromise.claim(); + + Promise versionPromise = restClient.getVersionRestClient().getVersion(new URI("http://www.313.co.kr/jira/rest/api/latest/version/12303")); + Version version = versionPromise.claim(); + + String summary = "요구사항 테스트"; + IssueInputBuilder issueInputBuilder = new IssueInputBuilder(project, issueType, summary); + issueInputBuilder.setFixVersions(Collections.singleton(version)); + issueInputBuilder.setPriorityId(6L); + DateTime dueDate = new DateTime("2022-12-30"); + issueInputBuilder.setDueDate(dueDate); + issueInputBuilder.setFieldValue(IssueFieldId.LABELS_FIELD.id, Collections.singleton(new String("a-RMS_요구사항_라벨"))); + issueInputBuilder.setDescription( + "a-RMS 에서 제공하는 요구사항 이슈 타입입니다.\n" + + "자동으로 관리되므로 이슈를 강제로 삭제하지 마세요\n"+ + "아래 링크에서 요구사항을 확인 할 수 있습니다.\n" + + "=========================================\n" + + "http://www.a-rms.net/auth-user/req/313\n" + + "=========================================\n" + + "본 이슈 하위로 Sub-Task를 만들어서 개발을 하시거나\n"+ + "관련한 이슈를 연결 하세요"); + IssueInput issueInput = issueInputBuilder.build(); + + Promise promise = restClient.getIssueClient().createIssue(issueInput); + BasicIssue issue = promise.claim(); + logger.info("issue = " + issue.getKey()); + logger.info("issue = " + issue.getId()); + logger.info("issue = " + issue.getSelf()); } //a-RMS :: 등록된 요구사항 이슈를 수집 할 수 있다. //a-RMS :: 주기적으로 요구사항을 확인하여, Jira 에 이슈를 생성한다. ( 요구사항 타입 )( 릴레이션, Sub-TASK 포함 ) - public void get_RequirementIssue_aRMS() { + @Test + public void get_RequirementIssue_aRMS() throws URISyntaxException { + //http://www.313.co.kr/jira/rest/api/latest/issue/18005 + final JiraRestClient restClient = getJiraRestClient(); + Issue issue = restClient.getIssueClient().getIssue("JSTFFW-9").claim(); + logger.info("issue = " + issue.getSubtasks()); + logger.info("issue = " + issue.getIssueLinks()); } //a-RMS :: 이후 스케쥴러를 동작해서 요구사항 이슈를 수집하여 ELK 에 적재한다. public void store_ReqIssue_ToELK_ByaRMS() { - + //차후 개발 } }