Merge remote-tracking branch 'origin/jenkins_with_weblogic' into jenkins_with_weblogic
This commit is contained in:
+44
-19
@@ -438,19 +438,36 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
|
|||||||
resultSet = sis.readLine(arg, total, 1024);
|
resultSet = sis.readLine(arg, total, 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
param.put("recvData", new String(arg, "UTF-8"));
|
// ===== 인코딩 확인 로그 시작 =====
|
||||||
|
logger.info("========== 인코딩 디버깅 정보 ==========");
|
||||||
|
logger.info("request.getCharacterEncoding(): " + request.getCharacterEncoding());
|
||||||
|
logger.info("request.getContentType(): " + request.getContentType());
|
||||||
|
logger.info("Content Length: " + arg.length + " bytes");
|
||||||
|
|
||||||
|
// 다양한 인코딩으로 읽어보기
|
||||||
|
String asDefaultEncoding = new String(arg);
|
||||||
|
String asUtf8 = new String(arg, "UTF-8");
|
||||||
|
String asEucKr = new String(arg, "EUC-KR");
|
||||||
|
|
||||||
|
logger.info("Default Encoding 전체 내용:\n" + asDefaultEncoding);
|
||||||
|
logger.info("UTF-8 전체 내용:\n" + asUtf8);
|
||||||
|
logger.info("EUC-KR 전체 내용:\n" + asEucKr);
|
||||||
|
logger.info("========================================");
|
||||||
|
// ===== 인코딩 확인 로그 끝 =====
|
||||||
|
|
||||||
|
param.put("recvData", new String(arg, "EUC-KR"));
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
logger.error("MessageSync.err - don't read the XML File - " + new String(arg), e);
|
logger.error("MessageSync.err - don't read the XML File - " + new String(arg, "EUC-KR"), e);
|
||||||
param.put("recvData", "");
|
param.put("recvData", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
// byte[]로부터 XML 파싱 (BOM 제거)
|
// byte[]로부터 XML 파싱 (BOM 제거) - EUC-KR로 읽기
|
||||||
String xmlContent = new String(arg, "UTF-8").trim();
|
String xmlContent = new String(arg, "EUC-KR").trim();
|
||||||
// BOM 제거 (UTF-8 BOM: EF BB BF)
|
// BOM 제거 (UTF-8 BOM: EF BB BF)
|
||||||
if (xmlContent.startsWith("\uFEFF")) {
|
if (xmlContent.startsWith("\uFEFF")) {
|
||||||
xmlContent = xmlContent.substring(1);
|
xmlContent = xmlContent.substring(1);
|
||||||
}
|
}
|
||||||
Document doc = builder.build(new ByteArrayInputStream(xmlContent.getBytes("UTF-8")));
|
Document doc = builder.build(new ByteArrayInputStream(xmlContent.getBytes("EUC-KR")));
|
||||||
|
|
||||||
param.put("logPrcssSeqno", UUIDGenerator.getUUID());
|
param.put("logPrcssSeqno", UUIDGenerator.getUUID());
|
||||||
// xml 1.1
|
// xml 1.1
|
||||||
@@ -512,7 +529,7 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
|
|||||||
if (!"EAI".equalsIgnoreCase(useSystem) && !"FEP".equalsIgnoreCase(useSystem)) {
|
if (!"EAI".equalsIgnoreCase(useSystem) && !"FEP".equalsIgnoreCase(useSystem)) {
|
||||||
String errorMessage = "사용 시스템(" + useSystem + ")인 전문레이아웃은 EAI, FEP로 배포 안됨.";
|
String errorMessage = "사용 시스템(" + useSystem + ")인 전문레이아웃은 EAI, FEP로 배포 안됨.";
|
||||||
logger.error(errorMessage);
|
logger.error(errorMessage);
|
||||||
throw new Exception(errorMessage);
|
throw new UseSystemException(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( "ASCII".equals(format.getAttributeValue("msgType")) ) {
|
if( "ASCII".equals(format.getAttributeValue("msgType")) ) {
|
||||||
@@ -587,9 +604,15 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
|
|||||||
logger.error("",e.getStackTrace()[0]);
|
logger.error("",e.getStackTrace()[0]);
|
||||||
try {
|
try {
|
||||||
if( results != null ) {
|
if( results != null ) {
|
||||||
results.getChild("Result").setText("False");
|
if (e instanceof UseSystemException) {
|
||||||
|
results.getChild("Result").setText("True");
|
||||||
|
} else {
|
||||||
|
results.getChild("Result").setText("False");
|
||||||
|
}
|
||||||
results.getChild("ResultMessage").setText( e.getMessage() );
|
results.getChild("ResultMessage").setText( e.getMessage() );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
resultS = StringUtils.toXMLString(rDoc, true);
|
resultS = StringUtils.toXMLString(rDoc, true);
|
||||||
}
|
}
|
||||||
if( param.get("logPrcssSeqno") == null ) {
|
if( param.get("logPrcssSeqno") == null ) {
|
||||||
@@ -607,10 +630,11 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
|
|||||||
|
|
||||||
ServletOutputStream sos = null;
|
ServletOutputStream sos = null;
|
||||||
try {
|
try {
|
||||||
|
response.setContentType("application/xml; charset=EUC-KR");
|
||||||
sos = response.getOutputStream();
|
sos = response.getOutputStream();
|
||||||
sos.write(resultS.getBytes());
|
sos.write(resultS.getBytes("EUC-KR"));
|
||||||
} catch( Exception e ) {
|
} catch( Exception e ) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
if( sis != null ) sis.close();
|
if( sis != null ) sis.close();
|
||||||
if( sos != null ) sos.close();
|
if( sos != null ) sos.close();
|
||||||
@@ -644,16 +668,16 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
|
|||||||
|
|
||||||
// 초기화
|
// 초기화
|
||||||
DataSourceContextHolder.setDataSourceType(DataSourceTypeManager.getDataSourceType(schema));
|
DataSourceContextHolder.setDataSourceType(DataSourceTypeManager.getDataSourceType(schema));
|
||||||
try {
|
try {
|
||||||
// // 요청 전문
|
// // 요청 전문
|
||||||
sis = request.getInputStream();
|
sis = request.getInputStream();
|
||||||
|
|
||||||
JSONObject json = (JSONObject) JSONValue.parse(new InputStreamReader(sis));
|
JSONObject json = (JSONObject) JSONValue.parse(new InputStreamReader(sis, "EUC-KR"));
|
||||||
|
|
||||||
// JJB 향후제거 shkim 2020-05-13 연계 테스트 체크
|
// JJB 향후제거 shkim 2020-05-13 연계 테스트 체크
|
||||||
logger.error("\n\n MMI SYNC Request : " + json.toString());
|
logger.error("\n\n MMI SYNC Request : " + json.toString());
|
||||||
|
|
||||||
// log 기록
|
// log 기록
|
||||||
byte[] arg = new byte[request.getContentLength()];
|
byte[] arg = new byte[request.getContentLength()];
|
||||||
int resultSet =0;
|
int resultSet =0;
|
||||||
int total = 0;
|
int total = 0;
|
||||||
@@ -663,10 +687,10 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
|
|||||||
total += resultSet;
|
total += resultSet;
|
||||||
resultSet = sis.readLine(arg, total, 1024);
|
resultSet = sis.readLine(arg, total, 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
param.put("recvData", new String(arg));
|
param.put("recvData", new String(arg, "EUC-KR"));
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
logger.error("MessageSync.err - don't read the JSON File - " + new String(arg), e);
|
logger.error("MessageSync.err - don't read the JSON File - " + new String(arg, "EUC-KR"), e);
|
||||||
param.put("recvData", "");
|
param.put("recvData", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -707,10 +731,11 @@ public class LayoutSyncController extends OnlBaseAnnotationController implements
|
|||||||
|
|
||||||
ServletOutputStream sos = null;
|
ServletOutputStream sos = null;
|
||||||
try {
|
try {
|
||||||
|
response.setContentType("application/json; charset=EUC-KR");
|
||||||
sos = response.getOutputStream();
|
sos = response.getOutputStream();
|
||||||
sos.write(resultS.toString().getBytes());
|
sos.write(resultS.toString().getBytes("EUC-KR"));
|
||||||
} catch( Exception e ) {
|
} catch( Exception e ) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
if( sis != null ) sis.close();
|
if( sis != null ) sis.close();
|
||||||
if( sos != null ) sos.close();
|
if( sos != null ) sos.close();
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.eactive.eai.rms.onl.manage.rule.layoutsync;
|
||||||
|
|
||||||
|
import com.eactive.eai.rms.onl.common.exception.EMSRuntimeException;
|
||||||
|
|
||||||
|
public class UseSystemException extends EMSRuntimeException {
|
||||||
|
|
||||||
|
public UseSystemException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -10,9 +10,11 @@ import java.util.List;
|
|||||||
import org.quartz.Job;
|
import org.quartz.Job;
|
||||||
import org.quartz.JobExecutionContext;
|
import org.quartz.JobExecutionContext;
|
||||||
import org.quartz.JobExecutionException;
|
import org.quartz.JobExecutionException;
|
||||||
|
import org.quartz.SchedulerException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -39,7 +41,6 @@ public class DailyToMonthlyAggregationJob implements Job {
|
|||||||
|
|
||||||
private ApiStatsDayService apiStatsDayService;
|
private ApiStatsDayService apiStatsDayService;
|
||||||
private ApiStatsMonthService apiStatsMonthService;
|
private ApiStatsMonthService apiStatsMonthService;
|
||||||
private DailyToMonthlyAggregationJob self;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public void setApiStatsDayService(ApiStatsDayService apiStatsDayService) {
|
public void setApiStatsDayService(ApiStatsDayService apiStatsDayService) {
|
||||||
@@ -51,18 +52,24 @@ public class DailyToMonthlyAggregationJob implements Job {
|
|||||||
this.apiStatsMonthService = apiStatsMonthService;
|
this.apiStatsMonthService = apiStatsMonthService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public void setSelf(DailyToMonthlyAggregationJob self) {
|
|
||||||
this.self = self;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||||
|
|
||||||
|
ApplicationContext appContext = null;
|
||||||
|
final DailyToMonthlyAggregationJob selfJob;
|
||||||
|
try {
|
||||||
|
appContext = (ApplicationContext) context.getScheduler().getContext().get("applicationContext");
|
||||||
|
selfJob = appContext.getBean(DailyToMonthlyAggregationJob.class);
|
||||||
|
} catch (SchedulerException e) {
|
||||||
|
log.error("applicationContext get module error",e);
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
DataSourceType dataType = DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.APIGW);
|
DataSourceType dataType = DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.APIGW);
|
||||||
DataSourceContextHolder.setDataSourceType(dataType);
|
DataSourceContextHolder.setDataSourceType(dataType);
|
||||||
try {
|
try {
|
||||||
YearMonth targetMonth = YearMonth.now().minusMonths(1);
|
YearMonth targetMonth = YearMonth.now().minusMonths(1);
|
||||||
self.executeManual(targetMonth);
|
selfJob.executeManual(targetMonth);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new JobExecutionException(e);
|
throw new JobExecutionException(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
@@ -9,9 +9,11 @@ import java.util.List;
|
|||||||
import org.quartz.Job;
|
import org.quartz.Job;
|
||||||
import org.quartz.JobExecutionContext;
|
import org.quartz.JobExecutionContext;
|
||||||
import org.quartz.JobExecutionException;
|
import org.quartz.JobExecutionException;
|
||||||
|
import org.quartz.SchedulerException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -38,7 +40,6 @@ public class HourlyToDailyAggregationJob implements Job {
|
|||||||
|
|
||||||
private ApiStatsHourService apiStatsHourService;
|
private ApiStatsHourService apiStatsHourService;
|
||||||
private ApiStatsDayService apiStatsDayService;
|
private ApiStatsDayService apiStatsDayService;
|
||||||
private HourlyToDailyAggregationJob self;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public void setApiStatsHourService(ApiStatsHourService apiStatsHourService) {
|
public void setApiStatsHourService(ApiStatsHourService apiStatsHourService) {
|
||||||
@@ -50,18 +51,23 @@ public class HourlyToDailyAggregationJob implements Job {
|
|||||||
this.apiStatsDayService = apiStatsDayService;
|
this.apiStatsDayService = apiStatsDayService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public void setSelf(HourlyToDailyAggregationJob self) {
|
|
||||||
this.self = self;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||||
|
ApplicationContext appContext = null;
|
||||||
|
final HourlyToDailyAggregationJob selfJob;
|
||||||
|
try {
|
||||||
|
appContext = (ApplicationContext) context.getScheduler().getContext().get("applicationContext");
|
||||||
|
selfJob = appContext.getBean(HourlyToDailyAggregationJob.class);
|
||||||
|
} catch (SchedulerException e) {
|
||||||
|
log.error("applicationContext get module error",e);
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
DataSourceType dataType = DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.APIGW);
|
DataSourceType dataType = DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.APIGW);
|
||||||
DataSourceContextHolder.setDataSourceType(dataType);
|
DataSourceContextHolder.setDataSourceType(dataType);
|
||||||
try {
|
try {
|
||||||
LocalDate targetDate = LocalDate.now().minusDays(1);
|
LocalDate targetDate = LocalDate.now().minusDays(1);
|
||||||
self.executeManual(targetDate);
|
selfJob.executeManual(targetDate);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new JobExecutionException(e);
|
throw new JobExecutionException(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
+14
-7
@@ -8,9 +8,11 @@ import java.util.List;
|
|||||||
import org.quartz.Job;
|
import org.quartz.Job;
|
||||||
import org.quartz.JobExecutionContext;
|
import org.quartz.JobExecutionContext;
|
||||||
import org.quartz.JobExecutionException;
|
import org.quartz.JobExecutionException;
|
||||||
|
import org.quartz.SchedulerException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -37,7 +39,6 @@ public class MonthlyToYearlyAggregationJob implements Job {
|
|||||||
|
|
||||||
private ApiStatsMonthService apiStatsMonthService;
|
private ApiStatsMonthService apiStatsMonthService;
|
||||||
private ApiStatsYearService apiStatsYearService;
|
private ApiStatsYearService apiStatsYearService;
|
||||||
private MonthlyToYearlyAggregationJob self;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public void setApiStatsMonthService(ApiStatsMonthService apiStatsMonthService) {
|
public void setApiStatsMonthService(ApiStatsMonthService apiStatsMonthService) {
|
||||||
@@ -49,18 +50,24 @@ public class MonthlyToYearlyAggregationJob implements Job {
|
|||||||
this.apiStatsYearService = apiStatsYearService;
|
this.apiStatsYearService = apiStatsYearService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public void setSelf(MonthlyToYearlyAggregationJob self) {
|
|
||||||
this.self = self;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||||
|
|
||||||
|
ApplicationContext appContext = null;
|
||||||
|
final MonthlyToYearlyAggregationJob selfJob;
|
||||||
|
try {
|
||||||
|
appContext = (ApplicationContext) context.getScheduler().getContext().get("applicationContext");
|
||||||
|
selfJob = appContext.getBean(MonthlyToYearlyAggregationJob.class);
|
||||||
|
} catch (SchedulerException e) {
|
||||||
|
log.error("applicationContext get module error",e);
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
DataSourceType dataType = DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.APIGW);
|
DataSourceType dataType = DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.APIGW);
|
||||||
DataSourceContextHolder.setDataSourceType(dataType);
|
DataSourceContextHolder.setDataSourceType(dataType);
|
||||||
try {
|
try {
|
||||||
Year targetYear = Year.now().minusYears(1);
|
Year targetYear = Year.now().minusYears(1);
|
||||||
self.executeManual(targetYear);
|
selfJob.executeManual(targetYear);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new JobExecutionException(e);
|
throw new JobExecutionException(e);
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
+4
-2
@@ -9,6 +9,8 @@ import org.springframework.http.MediaType;
|
|||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,9 +39,9 @@ class LayoutSyncControllerTest {
|
|||||||
|
|
||||||
String url = BASE_URL + "?cmd=Message&schema=APIGW";
|
String url = BASE_URL + "?cmd=Message&schema=APIGW";
|
||||||
|
|
||||||
// HTTP 헤더 설정
|
// HTTP 헤더 설정 (EUC-KR)
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.setContentType(MediaType.APPLICATION_XML);
|
headers.setContentType(new MediaType("application", "xml", Charset.forName("EUC-KR")));
|
||||||
|
|
||||||
// 요청 생성
|
// 요청 생성
|
||||||
HttpEntity<String> request = new HttpEntity<>(requestXml, headers);
|
HttpEntity<String> request = new HttpEntity<>(requestXml, headers);
|
||||||
|
|||||||
Reference in New Issue
Block a user