Index: web-module/profiles/dev/support.properties =================================================================== diff -u -rd774ff7bf7165a72f9807914bf1c0e97e93b26ac -r81a625197231c4d1dc3696cba807556fdced2246 --- web-module/profiles/dev/support.properties (.../support.properties) (revision d774ff7bf7165a72f9807914bf1c0e97e93b26ac) +++ web-module/profiles/dev/support.properties (.../support.properties) (revision 81a625197231c4d1dc3696cba807556fdced2246) @@ -13,6 +13,10 @@ Globals.SynchrnServerPath = C:/egovframework/upload/Synch/ system.uploadpath = C:/egovframework/upload/ +arms.jira.baseurl = http://www.313.co.kr/jira +arms.jira.id = admin +arms.jira.pass = flexjava + allinone.monitoring.baseurl = http://192.168.25.46:9200/ allinone.monitoring.metricbeatindex = metricbeat-* allinone.monitoring.heartbeatindex = heartbeat-* Index: web-module/profiles/live/support.properties =================================================================== diff -u -rd774ff7bf7165a72f9807914bf1c0e97e93b26ac -r81a625197231c4d1dc3696cba807556fdced2246 --- web-module/profiles/live/support.properties (.../support.properties) (revision d774ff7bf7165a72f9807914bf1c0e97e93b26ac) +++ web-module/profiles/live/support.properties (.../support.properties) (revision 81a625197231c4d1dc3696cba807556fdced2246) @@ -13,6 +13,10 @@ Globals.SynchrnServerPath = upload/sync/ system.uploadpath = upload/ +arms.jira.baseurl = http://www.313.co.kr/jira +arms.jira.id = admin +arms.jira.pass = flexjava + allinone.monitoring.baseurl = http://192.168.25.46:9200/ allinone.monitoring.metricbeatindex = metricbeat-* allinone.monitoring.heartbeatindex = heartbeat-* Index: web-module/src/main/java/egovframework/api/arms/module_armsscheduler/component/ArmsScheduler.java =================================================================== diff -u --- web-module/src/main/java/egovframework/api/arms/module_armsscheduler/component/ArmsScheduler.java (revision 0) +++ web-module/src/main/java/egovframework/api/arms/module_armsscheduler/component/ArmsScheduler.java (revision 81a625197231c4d1dc3696cba807556fdced2246) @@ -0,0 +1,119 @@ +/* + * @author Dongmin.lee + * @since 2022-12-01 + * @version 22.12.01 + * @see
+ *  Copyright (C) 2007 by 313 DEV GRP, Inc - All Rights Reserved
+ *  Unauthorized copying of this file, via any medium is strictly prohibited
+ *  Proprietary and confidential
+ *  Written by 313 developer group <313@313.co.kr>, December 2010
+ * 
+ */ +package egovframework.api.arms.module_armsscheduler.component; + +import com.atlassian.jira.rest.client.api.JiraRestClient; +import com.atlassian.jira.rest.client.api.domain.BasicProject; +import com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory; +import com.atlassian.util.concurrent.Promise; +import egovframework.api.arms.module_pdservice.model.PdServiceDTO; +import egovframework.api.arms.module_pdservicejira.model.PdServiceJiraDTO; +import egovframework.api.arms.module_pdservicejira.service.PdServiceJira; +import egovframework.api.arms.util.PropertiesReader; +import egovframework.com.cmm.service.EgovProperties; +import egovframework.com.ext.jstree.springHibernate.core.service.JsTreeHibernateServiceImpl; +import egovframework.com.ext.jstree.support.util.StringUtils; +import org.hibernate.criterion.Order; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; + +@Component +public class ArmsScheduler { + + private final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Autowired + @Qualifier("pdServiceJira") + private PdServiceJira pdServiceJira; + + public JiraRestClient getJiraRestClient() throws URISyntaxException, IOException { + + final AsynchronousJiraRestClientFactory factory = new AsynchronousJiraRestClientFactory(); + + PropertiesReader propertiesReader = new PropertiesReader("egovframework/egovProps/globals.properties"); + String jiraUrl = propertiesReader.getProperty("arms.jira.baseurl"); + String jiraID = propertiesReader.getProperty("arms.jira.id"); + String jiraPass = propertiesReader.getProperty("arms.jira.pass"); + + return factory.createWithBasicHttpAuthentication(new URI(jiraUrl), jiraID, jiraPass); + + } + + public void set_jiraServerInfo_toStatic() { + System.out.println( + "Fixed delay task - " + System.currentTimeMillis() / 1000); + } + + public void set_jiraIssueType_toStatic() { + System.out.println( + "Fixed delay task - " + System.currentTimeMillis() / 1000); + } + + @Scheduled(initialDelay = 1000, fixedDelay = 30000) //5m + public void set_jiraProject_toPdServiceJira() throws Exception { + final JiraRestClient restClient = getJiraRestClient(); + Promise> promise = restClient.getProjectClient().getAllProjects(); + Iterable allProject = promise.claim(); + + PdServiceJiraDTO pdServiceJiraDTOList = new PdServiceJiraDTO(); + pdServiceJiraDTOList.setOrder(Order.asc("c_id")); + List list = pdServiceJira.getChildNode(pdServiceJiraDTOList); + + for (BasicProject project: allProject) { + logger.info("project -> " + project.getName()); + logger.info("project -> " + project.getKey()); + logger.info("project -> " + project.getSelf()); + + boolean anyMatch = list.stream().anyMatch(dto -> + StringUtils.equals(dto.getC_jira_link(), project.getSelf().toString()) + ); + + if(anyMatch){ + logger.info("already registerd jira project = " + project.getSelf().toString()); + }else{ + PdServiceJiraDTO pdServiceJiraDTO = new PdServiceJiraDTO(); + pdServiceJiraDTO.setC_title(project.getName()); + pdServiceJiraDTO.setC_jira_id(project.getKey()); + pdServiceJiraDTO.setC_jira_key(project.getKey()); + pdServiceJiraDTO.setC_jira_name(project.getName()); + pdServiceJiraDTO.setC_jira_link(project.getSelf().toString()); + pdServiceJiraDTO.setRef(2L); + pdServiceJiraDTO.setC_type("default"); + + pdServiceJira.addNode(pdServiceJiraDTO); + } + } + } + + public void set_jiraProjectVersion_toPdServiceVersion() { + System.out.println( + "Fixed delay task - " + System.currentTimeMillis() / 1000); + } + + public void set_ReqAdd_toJiraReqIssue() { + System.out.println( + "Fixed delay task - " + System.currentTimeMillis() / 1000); + } + + +} \ No newline at end of file Index: web-module/src/main/resources/egovframework/egovProps/globals.properties =================================================================== diff -u -rd774ff7bf7165a72f9807914bf1c0e97e93b26ac -r81a625197231c4d1dc3696cba807556fdced2246 --- web-module/src/main/resources/egovframework/egovProps/globals.properties (.../globals.properties) (revision d774ff7bf7165a72f9807914bf1c0e97e93b26ac) +++ web-module/src/main/resources/egovframework/egovProps/globals.properties (.../globals.properties) (revision 81a625197231c4d1dc3696cba807556fdced2246) @@ -34,6 +34,10 @@ Globals.SynchrnServerPath = ${Globals.SynchrnServerPath} system.uploadpath = ${system.uploadpath} +arms.jira.baseurl = ${arms.jira.baseurl} +arms.jira.id = ${arms.jira.id} +arms.jira.pass = ${arms.jira.pass} + allinone.monitoring.baseurl = ${allinone.monitoring.baseurl} allinone.monitoring.metricbeatindex = ${allinone.monitoring.metricbeatindex} allinone.monitoring.heartbeatindex = ${allinone.monitoring.heartbeatindex} Index: web-module/src/test/java/egovframework/api/arms/module_pdservicejira/ArmsJiraClientTest.java =================================================================== diff -u -r3a5b0063766fee7f0faf0fe6b722954313fb4048 -r81a625197231c4d1dc3696cba807556fdced2246 --- web-module/src/test/java/egovframework/api/arms/module_pdservicejira/ArmsJiraClientTest.java (.../ArmsJiraClientTest.java) (revision 3a5b0063766fee7f0faf0fe6b722954313fb4048) +++ web-module/src/test/java/egovframework/api/arms/module_pdservicejira/ArmsJiraClientTest.java (.../ArmsJiraClientTest.java) (revision 81a625197231c4d1dc3696cba807556fdced2246) @@ -1,9 +1,7 @@ package egovframework.api.arms.module_pdservicejira; -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; @@ -17,10 +15,8 @@ import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; +import java.sql.Timestamp; import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; public class ArmsJiraClientTest { @@ -68,7 +64,7 @@ } @Test - public void getSingle_JiraProject() throws URISyntaxException { + public void get_JiraProject() throws URISyntaxException { final JiraRestClient restClient = getJiraRestClient(); String jira_Project_KEY = "SP"; Promise promise = restClient.getProjectClient().getProject(jira_Project_KEY); @@ -92,7 +88,8 @@ public void set_JiraVersion_ToProject() throws URISyntaxException { final JiraRestClient restClient = getJiraRestClient(); String projectKey = "JSTFFW"; - String name = "a-RMS_제품(서비스)_버전"; + Timestamp timestamp = new Timestamp(System.currentTimeMillis()); + String name = "a-RMS_제품(서비스)_버전" + timestamp.toString(); String description = "a-RMS 요구사항 관리 버전"; DateTime releaseDate = new DateTime("2022-12-31"); boolean isArchived = false; @@ -118,7 +115,6 @@ logger.info("serverInfo = " + serverInfo.getBaseUri()); logger.info("serverInfo = " + serverInfo.getBuildDate()); logger.info("serverInfo = " + serverInfo.getBuildNumber()); - logger.info("serverInfo = " + serverInfo.getBaseUri()); } //a-RMS :: 7 이상의 버전이면, 요구사항 이슈 타입이 없으면 생성해 준다. @@ -143,7 +139,7 @@ } @Test - public void getSingle_IssueType() throws URISyntaxException { + public void get_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();