논리 아키텍처 Job Topic 명칭 변경

- ai-job → ai 이벤트 생성
- image-job → 이미지 생성
- logical-architecture.md 및 .mmd 파일 업데이트
- 테스트용 스크립트 및 파일 정리

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
cherry2250 2025-10-22 16:47:27 +09:00
parent 65a9f8161b
commit cef51c9848
21 changed files with 23 additions and 578 deletions

View File

@ -1,52 +0,0 @@
#!/bin/bash
# PlantUML par/and/end를 group/end로 변환하는 스크립트
# PlantUML 서버가 par/and 문법을 지원하지 않으므로 group으로 대체
echo "Converting par/and/end blocks to group/end blocks..."
# Inner sequence files
cd design/backend/sequence/inner
for file in ai-트렌드분석및추천.puml content-이미지생성.puml distribution-다중채널배포.puml event-대시보드조회.puml; do
if [ -f "$file" ]; then
echo "Processing: $file"
# 1. Replace 'par' with 'group parallel'
sed -i.bak6 's/^ par$/ group parallel/' "$file"
sed -i.bak6 's/^par$/group parallel/' "$file"
# 2. Remove standalone 'and' lines (they don't exist in group syntax)
sed -i.bak6 '/^ and$/d' "$file"
sed -i.bak6 '/^and$/d' "$file"
echo " Converted: $file"
fi
done
cd - > /dev/null
# Outer sequence files
cd design/backend/sequence/outer
if [ -f "이벤트생성플로우.puml" ]; then
echo "Processing: 이벤트생성플로우.puml"
# 1. Replace 'par' with 'group parallel'
sed -i.bak6 's/^par$/group parallel/' "이벤트생성플로우.puml"
# 2. Remove standalone 'and' lines
sed -i.bak6 '/^and$/d' "이벤트생성플로우.puml"
echo " Converted: 이벤트생성플로우.puml"
fi
cd - > /dev/null
echo ""
echo "All par/and blocks converted to group blocks."
echo "Running validation..."
echo ""
# Run validation
./validate-puml-fixed.sh

View File

@ -49,7 +49,7 @@
#### Kafka 통합 전략 #### Kafka 통합 전략
- **Event Topics**: 도메인 이벤트 발행/구독 (EventCreated, ParticipantRegistered 등) - **Event Topics**: 도메인 이벤트 발행/구독 (EventCreated, ParticipantRegistered 등)
- **Job Topics**: 비동기 작업 요청/처리 (ai-job, image-job) - **Job Topics**: 비동기 작업 요청/처리 (ai 이벤트 생성, 이미지 생성)
- **단일 메시징 플랫폼**: 운영 복잡도 감소 및 일관된 메시지 처리 - **단일 메시징 플랫폼**: 운영 복잡도 감소 및 일관된 메시지 처리
#### Resilience 패턴 적용 #### Resilience 패턴 적용
@ -88,12 +88,12 @@
#### Async Services (비동기 처리) #### Async Services (비동기 처리)
1. **AI Service**: AI 기반 이벤트 추천 1. **AI Service**: AI 기반 이벤트 추천
- Kafka Job 구독 (ai-job) - Kafka Job 구독 (ai 이벤트 생성)
- 외부 AI API 호출 (Circuit Breaker, Timeout 30초) - 외부 AI API 호출 (Circuit Breaker, Timeout 30초)
- 결과 캐싱 (Redis, TTL 24시간) - 결과 캐싱 (Redis, TTL 24시간)
2. **Content Service**: SNS 이미지 생성 2. **Content Service**: SNS 이미지 생성
- Kafka Job 구독 (image-job) - Kafka Job 구독 (이미지 생성)
- 외부 이미지 생성 API 호출 (Circuit Breaker, Timeout 20초) - 외부 이미지 생성 API 호출 (Circuit Breaker, Timeout 20초)
- CDN 업로드 및 캐싱 (Redis, TTL 7일) - CDN 업로드 및 캐싱 (Redis, TTL 7일)
@ -110,8 +110,8 @@
- **DistributionCompleted**: 배포 완료 시 - **DistributionCompleted**: 배포 완료 시
**Job Topics** (비동기 작업): **Job Topics** (비동기 작업):
- **ai-job**: AI 추천 작업 - **ai 이벤트 생성**: AI 추천 작업
- **image-job**: 이미지 생성 작업 - **이미지 생성**: 이미지 생성 작업
**특징**: **특징**:
- At-Least-Once Delivery 보장 - At-Least-Once Delivery 보장
@ -169,16 +169,16 @@
- 구독자: Analytics Service - 구독자: Analytics Service
**Kafka Job 발행**: **Kafka Job 발행**:
1. **ai-job**: AI 추천 요청 1. **ai 이벤트 생성**: AI 추천 요청
2. **image-job**: 이미지 생성 요청 2. **이미지 생성**: 이미지 생성 요청
**서비스 간 호출**: **서비스 간 호출**:
- **Distribution Service**: 다중 채널 배포 (동기 호출, Circuit Breaker 적용) - **Distribution Service**: 다중 채널 배포 (동기 호출, Circuit Breaker 적용)
**주요 플로우**: **주요 플로우**:
1. 이벤트 목적 선택 → Event DB 저장 → EventCreated 발행 1. 이벤트 목적 선택 → Event DB 저장 → EventCreated 발행
2. AI 추천 요청 → ai-job 발행 2. AI 추천 요청 → ai 이벤트 생성 발행
3. 이미지 생성 요청 → image-job 발행 3. 이미지 생성 요청 → 이미지 생성 발행
4. 배포 승인 → Distribution Service 동기 호출 4. 배포 승인 → Distribution Service 동기 호출
**데이터 저장**: **데이터 저장**:
@ -248,7 +248,7 @@
**관련 유저스토리**: UFR-AI-010 **관련 유저스토리**: UFR-AI-010
**Kafka Job 구독**: **Kafka Job 구독**:
- **ai-job**: AI 추천 작업 요청 - **ai 이벤트 생성**: AI 추천 작업 요청
**Resilience 패턴**: **Resilience 패턴**:
- **Circuit Breaker**: AI API 호출 시 (실패율 50% 초과 시 Open) - **Circuit Breaker**: AI API 호출 시 (실패율 50% 초과 시 Open)
@ -273,7 +273,7 @@
**관련 유저스토리**: UFR-CONT-010, 020 **관련 유저스토리**: UFR-CONT-010, 020
**Kafka Job 구독**: **Kafka Job 구독**:
- **image-job**: 이미지 생성 작업 요청 - **이미지 생성**: 이미지 생성 작업 요청
**Resilience 패턴**: **Resilience 패턴**:
- **Circuit Breaker**: 이미지 생성 API 호출 시 (실패율 50% 초과 시 Open) - **Circuit Breaker**: 이미지 생성 API 호출 시 (실패율 50% 초과 시 Open)
@ -342,8 +342,8 @@
| 토픽명 | 발행자 | 구독자 | Payload | 용도 | | 토픽명 | 발행자 | 구독자 | Payload | 용도 |
|---------|--------|--------|---------|------| |---------|--------|--------|---------|------|
| **ai-job** | Event Service | AI Service | eventId, objective, industry, region | AI 트렌드 분석 및 이벤트 추천 요청 | | **ai 이벤트 생성** | Event Service | AI Service | eventId, objective, industry, region | AI 트렌드 분석 및 이벤트 추천 요청 |
| **image-job** | Event Service | Content Service | eventId, content, style | SNS 이미지 생성 요청 (3가지 스타일) | | **이미지 생성** | Event Service | Content Service | eventId, content, style | SNS 이미지 생성 요청 (3가지 스타일) |
#### 통신 패턴별 설계 #### 통신 패턴별 설계
@ -489,13 +489,13 @@
┌─────────────────────────────────────────────────────────────┐ ┌─────────────────────────────────────────────────────────────┐
│ Client → Event Service │ │ Client → Event Service │
│ - POST /api/events/{id}/ai-recommendations │ │ - POST /api/events/{id}/ai-recommendations │
│ - Kafka ai-job 토픽 발행 (AI 작업 요청) │ │ - Kafka ai 이벤트 생성 토픽 발행 (AI 작업 요청) │
│ - Job ID 즉시 반환 (0.1초) │ │ - Job ID 즉시 반환 (0.1초) │
└─────────────────────────────────────────────────────────────┘ └─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐ ┌─────────────────────────────────────────────────────────────┐
│ AI Service (Background) │ │ AI Service (Background) │
│ - Kafka ai-job 토픽 구독 │ │ - Kafka ai 이벤트 생성 토픽 구독 │
│ - Redis 캐시 확인 (Cache-Aside) │ │ - Redis 캐시 확인 (Cache-Aside) │
│ - 캐시 MISS: Claude API 호출 (10초) [Circuit Breaker] │ │ - 캐시 MISS: Claude API 호출 (10초) [Circuit Breaker] │
│ - 결과 캐싱 (TTL 24시간) │ │ - 결과 캐싱 (TTL 24시간) │
@ -512,13 +512,13 @@
┌─────────────────────────────────────────────────────────────┐ ┌─────────────────────────────────────────────────────────────┐
│ Client → Event Service │ │ Client → Event Service │
│ - POST /api/events/{id}/content-generation │ │ - POST /api/events/{id}/content-generation │
│ - Kafka image-job 토픽 발행 (이미지 생성 요청) │ │ - Kafka 이미지 생성 토픽 발행 (이미지 생성 요청) │
│ - Job ID 즉시 반환 (0.1초) │ │ - Job ID 즉시 반환 (0.1초) │
└─────────────────────────────────────────────────────────────┘ └─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐ ┌─────────────────────────────────────────────────────────────┐
│ Content Service (Background) │ │ Content Service (Background) │
│ - Kafka image-job 토픽 구독 │ │ - Kafka 이미지 생성 토픽 구독 │
│ - Redis 캐시 확인 │ │ - Redis 캐시 확인 │
│ - 캐시 MISS: Stable Diffusion API (5초) [Circuit Breaker] │ │ - 캐시 MISS: Stable Diffusion API (5초) [Circuit Breaker] │
│ - 이미지 CDN 업로드 │ │ - 이미지 CDN 업로드 │
@ -858,7 +858,7 @@
1. **Kafka 통합 메시징 플랫폼 채택**: Event Bus와 Job Queue를 Kafka로 통합하여 운영 복잡도 감소 1. **Kafka 통합 메시징 플랫폼 채택**: Event Bus와 Job Queue를 Kafka로 통합하여 운영 복잡도 감소
2. **Event-Driven 아키텍처 채택**: Kafka를 통한 서비스 간 느슨한 결합 및 비동기 통신 2. **Event-Driven 아키텍처 채택**: Kafka를 통한 서비스 간 느슨한 결합 및 비동기 통신
3. **도메인 이벤트 정의**: 4개 Event Topics (EventCreated, ParticipantRegistered, WinnerSelected, DistributionCompleted) 3. **도메인 이벤트 정의**: 4개 Event Topics (EventCreated, ParticipantRegistered, WinnerSelected, DistributionCompleted)
4. **Job Topics 정의**: 2개 Job Topics (ai-job, image-job)로 장시간 비동기 작업 처리 4. **Job Topics 정의**: 2개 Job Topics (ai 이벤트 생성, 이미지 생성)로 장시간 비동기 작업 처리
5. **Resilience 패턴 전면 적용**: Circuit Breaker, Retry, Timeout, Bulkhead, Fallback 5. **Resilience 패턴 전면 적용**: Circuit Breaker, Retry, Timeout, Bulkhead, Fallback
6. **At-Least-Once Delivery**: Kafka 메시지 보장 및 멱등성 설계 6. **At-Least-Once Delivery**: Kafka 메시지 보장 및 멱등성 설계
7. **Cache-Aside 패턴**: AI/이미지 생성 결과 캐싱으로 응답 시간 90% 개선 7. **Cache-Aside 패턴**: AI/이미지 생성 결과 캐싱으로 응답 시간 90% 개선

View File

@ -17,7 +17,7 @@ graph TB
end end
%% Kafka (Event Bus + Job Queue) %% Kafka (Event Bus + Job Queue)
Kafka["Kafka<br/>━━━━━━━━━━<br/><Event Topics><br/>• EventCreated<br/>• ParticipantRegistered<br/>• WinnerSelected<br/>• DistributionCompleted<br/>━━━━━━━━━━<br/><Job Topics><br/>• ai-job<br/>• image-job"] Kafka["Kafka<br/>━━━━━━━━━━<br/><Event Topics><br/>• EventCreated<br/>• ParticipantRegistered<br/>• WinnerSelected<br/>• DistributionCompleted<br/>━━━━━━━━━━<br/><Job Topics><br/>• ai 이벤트 생성<br/>• 이미지 생성"]
%% External System %% External System
External["외부시스템<br/>[Circuit Breaker]<br/>━━━━━━━━━━<br/>• 국세청 API<br/>• AI API<br/>• 이미지 생성 API<br/>• 배포 채널 APIs<br/>(비동기)"] External["외부시스템<br/>[Circuit Breaker]<br/>━━━━━━━━━━<br/>• 국세청 API<br/>• AI API<br/>• 이미지 생성 API<br/>• 배포 채널 APIs<br/>(비동기)"]
@ -29,8 +29,8 @@ graph TB
DistSvc ==>|"DistributionCompleted<br/>발행"| Kafka DistSvc ==>|"DistributionCompleted<br/>발행"| Kafka
%% Job Publishing (비동기 작업 요청) %% Job Publishing (비동기 작업 요청)
EventSvc -->|"ai-job 발행"| Kafka EventSvc -->|"ai 이벤트 생성 발행"| Kafka
EventSvc -->|"image-job 발행"| Kafka EventSvc -->|"이미지 생성 발행"| Kafka
%% Event Subscription %% Event Subscription
Kafka -.->|"EventCreated<br/>구독"| AnalSvc Kafka -.->|"EventCreated<br/>구독"| AnalSvc
@ -38,8 +38,8 @@ graph TB
Kafka -.->|"DistributionCompleted<br/>구독"| AnalSvc Kafka -.->|"DistributionCompleted<br/>구독"| AnalSvc
%% Job Subscription %% Job Subscription
Kafka -.->|"ai-job 구독"| AISvc Kafka -.->|"ai 이벤트 생성 구독"| AISvc
Kafka -.->|"image-job 구독"| ContentSvc Kafka -.->|"이미지 생성 구독"| ContentSvc
%% Service to Service (동기 호출) %% Service to Service (동기 호출)
EventSvc -->|"다중 채널 배포<br/>[Circuit Breaker]"| DistSvc EventSvc -->|"다중 채널 배포<br/>[Circuit Breaker]"| DistSvc

View File

@ -1,40 +0,0 @@
#!/bin/bash
# PlantUML and 키워드 앞 공백 라인 제거 스크립트
# par/and 블록에서 and 키워드 앞의 빈 줄을 제거
echo "Removing blank lines before 'and' keywords..."
# Inner sequence files
cd design/backend/sequence/inner
for file in ai-트렌드분석및추천.puml content-이미지생성.puml distribution-다중채널배포.puml event-대시보드조회.puml; do
if [ -f "$file" ]; then
echo "Processing: $file"
# Remove blank line immediately before 'and' keyword
# Look for pattern: empty line + line with spaces + 'and'
perl -i.bak5 -pe 's/^\s*\n(\s+and\s*$)/$1/g' "$file"
echo " Fixed: $file"
fi
done
cd - > /dev/null
# Outer sequence files
cd design/backend/sequence/outer
if [ -f "이벤트생성플로우.puml" ]; then
echo "Processing: 이벤트생성플로우.puml"
perl -i.bak5 -pe 's/^\s*\n(\s+and\s*$)/$1/g' "이벤트생성플로우.puml"
echo " Fixed: 이벤트생성플로우.puml"
fi
cd - > /dev/null
echo ""
echo "Blank lines before 'and' keywords removed."
echo "Running validation..."
echo ""
# Run validation
./validate-puml-fixed.sh

View File

@ -1,51 +0,0 @@
#!/bin/bash
# PlantUML and 키워드 레이블 제거 스크립트
# and 키워드 뒤에 오는 레이블을 제거하여 문법 오류 수정
echo "Fixing 'and' keyword labels in PlantUML files..."
# Inner sequence files
cd design/backend/sequence/inner
# event-대시보드조회.puml: 2개 수정
if [ -f "event-대시보드조회.puml" ]; then
echo "Processing: event-대시보드조회.puml"
# 'and 예정 이벤트 조회' → 'and'
sed -i.bak4 's/^ and 예정 이벤트 조회$/ and/' "event-대시보드조회.puml"
# 'and 종료 이벤트 조회' → 'and'
sed -i.bak4 's/^ and 종료 이벤트 조회$/ and/' "event-대시보드조회.puml"
echo " Fixed: event-대시보드조회.puml"
fi
# content-이미지생성.puml: 2개 수정
if [ -f "content-이미지생성.puml" ]; then
echo "Processing: content-이미지생성.puml"
# 'and 화려한 스타일' → 'and'
sed -i.bak4 's/^ and 화려한 스타일$/ and/' "content-이미지생성.puml"
# 'and 트렌디 스타일' → 'and'
sed -i.bak4 's/^ and 트렌디 스타일$/ and/' "content-이미지생성.puml"
echo " Fixed: content-이미지생성.puml"
fi
# distribution-다중채널배포.puml: 3개 수정
if [ -f "distribution-다중채널배포.puml" ]; then
echo "Processing: distribution-다중채널배포.puml"
# 'and 링고비즈 배포' → 'and'
sed -i.bak4 's/^and 링고비즈 배포$/and/' "distribution-다중채널배포.puml"
# 'and 지니TV 배포' → 'and'
sed -i.bak4 's/^and 지니TV 배포$/and/' "distribution-다중채널배포.puml"
# 'and SNS 배포 (Instagram, Naver, Kakao)' → 'and'
sed -i.bak4 's/^and SNS 배포 (Instagram, Naver, Kakao)$/and/' "distribution-다중채널배포.puml"
echo " Fixed: distribution-다중채널배포.puml"
fi
cd - > /dev/null
echo ""
echo "All 'and' keyword labels removed."
echo "Running validation..."
echo ""
# Run validation
./validate-puml-fixed.sh

View File

@ -1,39 +0,0 @@
#!/bin/bash
# PlantUML par 블록 수정 스크립트
# 한글 레이블을 note로 변경
echo "Fixing par blocks in PlantUML files..."
# Inner sequence files
cd design/backend/sequence/inner
for file in ai-트렌드분석및추천.puml content-이미지생성.puml distribution-다중채널배포.puml event-대시보드조회.puml; do
if [ -f "$file" ]; then
echo "Processing: $file"
# note over : 패턴 제거 (par 다음 줄)
sed -i.bak3 '/^ par$/{
N
s/\n note over : .*//
}' "$file"
echo " Fixed: $file"
fi
done
cd - > /dev/null
# Outer sequence files
cd design/backend/sequence/outer
if [ -f "이벤트생성플로우.puml" ]; then
echo "Processing: 이벤트생성플로우.puml"
sed -i.bak3 '/^par$/{
N
s/\n note over : .*//
}' "이벤트생성플로우.puml"
echo " Fixed: 이벤트생성플로우.puml"
fi
cd - > /dev/null
echo "All par blocks fixed."

View File

@ -1,74 +0,0 @@
#!/bin/bash
# PlantUML 문법 오류 수정 스크립트
# [ 문법을 Client participant로 변경
echo "====================================="
echo "PlantUML 파일 문법 수정 시작"
echo "====================================="
echo ""
# 수정할 파일 목록
FILES=(
"design/backend/sequence/inner/user-로그인.puml"
"design/backend/sequence/inner/user-로그아웃.puml"
"design/backend/sequence/inner/user-프로필수정.puml"
"design/backend/sequence/inner/ai-트렌드분석및추천.puml"
"design/backend/sequence/inner/content-이미지생성.puml"
"design/backend/sequence/inner/distribution-다중채널배포.puml"
"design/backend/sequence/inner/event-대시보드조회.puml"
"design/backend/sequence/outer/이벤트생성플로우.puml"
)
for file in "${FILES[@]}"; do
if [ ! -f "$file" ]; then
echo "❌ 파일이 존재하지 않음: $file"
continue
fi
echo "수정 중: $file"
# 백업 생성
cp "$file" "${file}.bak"
# 1. Client actor가 없으면 추가 (첫 번째 participant 앞에)
if ! grep -q "^actor Client" "$file"; then
# title 다음 줄에 빈 줄이 있고, 그 다음에 participant가 나오는 경우
sed -i.tmp '/^title /a\
\
actor Client' "$file"
rm "${file}.tmp" 2>/dev/null
echo " - Client actor 추가됨"
fi
# 2. [-> 패턴을 Client -> 로 변경
if grep -q "\[-> " "$file"; then
sed -i.tmp 's/\[-> /Client -> /g' "$file"
rm "${file}.tmp" 2>/dev/null
echo " - [-> 패턴 수정됨"
fi
# 3. -->[ 패턴을 --> Client 로 변경
if grep -q " -->\[" "$file"; then
sed -i.tmp 's/ -->\[/ --> Client/g' "$file"
rm "${file}.tmp" 2>/dev/null
echo " - -->[ 패턴 수정됨"
fi
# 4. --> [: 패턴을 --> Client: 로 변경
if grep -q " --> \[:" "$file"; then
sed -i.tmp 's/ --> \[:/ --> Client:/g' "$file"
rm "${file}.tmp" 2>/dev/null
echo " - --> [: 패턴 수정됨"
fi
echo " ✅ 완료: $file"
echo ""
done
echo "====================================="
echo "모든 파일 수정 완료"
echo "====================================="
echo ""
echo "백업 파일: *.puml.bak"
echo "백업 삭제: find design/backend/sequence -name '*.bak' -delete"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -1,7 +0,0 @@
@startuml test-basic
!theme mono
Alice -> Bob: test message
Bob --> Alice: response
@enduml

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -1,11 +0,0 @@
@startuml test-group
!theme mono
Alice -> Bob: msg1
group parallel
Alice -> Bob: msg2
Alice -> Bob: msg3
end
Alice -> Bob: msg4
@enduml

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,28 +0,0 @@
@startuml test-par-correct
!theme mono
participant "Service" as Service
participant "Repo" as Repo
database "DB" as DB
par
Service -> Repo: query1
activate Repo
Repo -> DB: SELECT 1
activate DB
DB --> Repo: result1
deactivate DB
Repo --> Service: data1
deactivate Repo
and
Service -> Repo: query2
activate Repo
Repo -> DB: SELECT 2
activate DB
DB --> Repo: result2
deactivate DB
Repo --> Service: data2
deactivate Repo
end
@enduml

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View File

@ -1,28 +0,0 @@
@startuml test-par-no-activate
!theme mono
participant "Service" as Service
participant "Repo" as Repo
database "DB" as DB
par
Service -> Repo: query1
activate Repo
Repo -> DB: SELECT 1
activate DB
DB --> Repo: result1
deactivate DB
Repo --> Service: data1
deactivate Repo
and
Service -> Repo: query2
activate Repo
Repo -> DB: SELECT 2
activate DB
DB --> Repo: result2
deactivate DB
Repo --> Service: data2
deactivate Repo
end
@enduml

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View File

@ -1,34 +0,0 @@
@startuml test-par
!theme mono
participant "Service" as Service
participant "Repo" as Repo
database "DB" as DB
Service -> Service: test
activate Service
par
Service -> Repo: query1
activate Repo
Repo -> DB: SELECT 1
activate DB
DB --> Repo: result1
deactivate DB
Repo --> Service: data1
deactivate Repo
and
Service -> Repo: query2
activate Repo
Repo -> DB: SELECT 2
activate DB
DB --> Repo: result2
deactivate DB
Repo --> Service: data2
deactivate Repo
end
Service --> Service: done
deactivate Service
@enduml

View File

@ -1,12 +0,0 @@
@startuml test-simple
!theme mono
Alice -> Bob: msg1
par
Alice -> Bob: msg2
and
Alice -> Bob: msg3
end
Alice -> Bob: msg4
@enduml

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1,93 +0,0 @@
#!/bin/bash
# PlantUML 파일 검증 스크립트 (UTF-8 인코딩 수정 버전)
# localhost:38080 서버를 사용하여 문법 검사
echo "====================================="
echo "PlantUML 파일 검증 시작 (UTF-8)"
echo "====================================="
echo ""
SUCCESS_COUNT=0
FAIL_COUNT=0
TOTAL_COUNT=0
# 검증 결과 저장 디렉토리
RESULT_DIR="debug/puml-validation"
mkdir -p "$RESULT_DIR"
# 결과 파일 초기화
RESULT_FILE="$RESULT_DIR/validation-result.txt"
ERROR_FILE="$RESULT_DIR/validation-errors.txt"
> "$RESULT_FILE"
> "$ERROR_FILE"
# design/backend/sequence 하위의 모든 .puml 파일 검증
while IFS= read -r file; do
TOTAL_COUNT=$((TOTAL_COUNT + 1))
filename=$(basename "$file")
echo "[$TOTAL_COUNT] 검증 중: $file"
# PlantUML 서버로 POST 요청 (UTF-8 charset 명시)
HTTP_CODE=$(curl -s -w "%{http_code}" -X POST \
http://localhost:38080/png \
-H "Content-Type: text/plain; charset=UTF-8" \
--data-binary "@$file" \
-o "$RESULT_DIR/${filename}.png" 2>&1 | tail -1)
if [ "$HTTP_CODE" = "200" ]; then
# PNG 파일이 정상적으로 생성되었는지 확인
if [ -f "$RESULT_DIR/${filename}.png" ] && [ -s "$RESULT_DIR/${filename}.png" ]; then
# 이미지가 실제 유효한지 확인 (파일 매직 넘버 확인)
if file "$RESULT_DIR/${filename}.png" | grep -q "PNG image data"; then
echo " ✅ 성공: $filename"
echo "$file - HTTP $HTTP_CODE" >> "$RESULT_FILE"
SUCCESS_COUNT=$((SUCCESS_COUNT + 1))
else
echo " ❌ 실패: $filename (유효하지 않은 PNG)"
echo "$file - 유효하지 않은 PNG 파일" >> "$ERROR_FILE"
FAIL_COUNT=$((FAIL_COUNT + 1))
fi
else
echo " ❌ 실패: $filename (빈 파일)"
echo "$file - 빈 PNG 파일" >> "$ERROR_FILE"
FAIL_COUNT=$((FAIL_COUNT + 1))
fi
else
echo " ❌ 실패: $filename (HTTP $HTTP_CODE)"
echo "$file - HTTP $HTTP_CODE" >> "$ERROR_FILE"
# 오류 내용 저장 (txt 엔드포인트로 오류 메시지 확인)
curl -s -X POST \
http://localhost:38080/txt \
-H "Content-Type: text/plain; charset=UTF-8" \
--data-binary "@$file" \
-o "$RESULT_DIR/${filename}.error.txt" 2>&1
echo " 오류 상세: $RESULT_DIR/${filename}.error.txt" >> "$ERROR_FILE"
FAIL_COUNT=$((FAIL_COUNT + 1))
fi
echo ""
done < <(find design/backend/sequence -name "*.puml" -type f | sort)
echo "====================================="
echo "검증 완료"
echo "====================================="
echo "총 파일 수: $TOTAL_COUNT"
echo "성공: $SUCCESS_COUNT"
echo "실패: $FAIL_COUNT"
echo ""
echo "상세 결과: $RESULT_FILE"
if [ $FAIL_COUNT -gt 0 ]; then
echo "오류 상세: $ERROR_FILE"
fi
echo "====================================="
# 실패한 파일이 있으면 종료 코드 1 반환
if [ $FAIL_COUNT -gt 0 ]; then
exit 1
else
exit 0
fi

View File

@ -1,86 +0,0 @@
#!/bin/bash
# PlantUML 파일 검증 스크립트
# localhost:38080 서버를 사용하여 문법 검사
echo "====================================="
echo "PlantUML 파일 검증 시작"
echo "====================================="
echo ""
SUCCESS_COUNT=0
FAIL_COUNT=0
TOTAL_COUNT=0
# 검증 결과 저장 디렉토리
RESULT_DIR="debug/puml-validation"
mkdir -p "$RESULT_DIR"
# 결과 파일 초기화
RESULT_FILE="$RESULT_DIR/validation-result.txt"
ERROR_FILE="$RESULT_DIR/validation-errors.txt"
> "$RESULT_FILE"
> "$ERROR_FILE"
# design/backend/sequence 하위의 모든 .puml 파일 검증
while IFS= read -r file; do
TOTAL_COUNT=$((TOTAL_COUNT + 1))
filename=$(basename "$file")
echo "[$TOTAL_COUNT] 검증 중: $file"
# PlantUML 서버로 POST 요청
HTTP_CODE=$(curl -s -w "%{http_code}" -X POST \
http://localhost:38080/png \
-H "Content-Type: text/plain" \
--data-binary "@$file" \
-o "$RESULT_DIR/${filename}.png" 2>&1 | tail -1)
if [ "$HTTP_CODE" = "200" ]; then
# PNG 파일이 정상적으로 생성되었는지 확인
if [ -f "$RESULT_DIR/${filename}.png" ] && [ -s "$RESULT_DIR/${filename}.png" ]; then
echo " ✅ 성공: $filename"
echo "$file - HTTP $HTTP_CODE" >> "$RESULT_FILE"
SUCCESS_COUNT=$((SUCCESS_COUNT + 1))
else
echo " ❌ 실패: $filename (빈 파일)"
echo "$file - 빈 PNG 파일" >> "$ERROR_FILE"
FAIL_COUNT=$((FAIL_COUNT + 1))
fi
else
echo " ❌ 실패: $filename (HTTP $HTTP_CODE)"
echo "$file - HTTP $HTTP_CODE" >> "$ERROR_FILE"
# 오류 내용 저장
curl -s -X POST \
http://localhost:38080/png \
-H "Content-Type: text/plain" \
--data-binary "@$file" \
-o "$RESULT_DIR/${filename}.error.txt" 2>&1
echo " 오류 상세: $RESULT_DIR/${filename}.error.txt" >> "$ERROR_FILE"
FAIL_COUNT=$((FAIL_COUNT + 1))
fi
echo ""
done < <(find design/backend/sequence -name "*.puml" -type f | sort)
echo "====================================="
echo "검증 완료"
echo "====================================="
echo "총 파일 수: $TOTAL_COUNT"
echo "성공: $SUCCESS_COUNT"
echo "실패: $FAIL_COUNT"
echo ""
echo "상세 결과: $RESULT_FILE"
if [ $FAIL_COUNT -gt 0 ]; then
echo "오류 상세: $ERROR_FILE"
fi
echo "====================================="
# 실패한 파일이 있으면 종료 코드 1 반환
if [ $FAIL_COUNT -gt 0 ]; then
exit 1
else
exit 0
fi