From 8fef09df0224b50c9edd0b38bb7bef9dc769239d Mon Sep 17 00:00:00 2001 From: sunmingLee <25thbam@gmail.com> Date: Wed, 29 Oct 2025 10:12:42 +0900 Subject: [PATCH] =?UTF-8?q?=ED=95=84=EC=9A=94=EC=97=86=EB=8A=94=20?= =?UTF-8?q?=ED=8F=B4=EB=8D=94=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/check-kafka-messages.ps1 | 63 ------ tools/check-mermaid.ps1 | 96 -------- tools/check-mermaid.sh | 107 --------- tools/check-plantuml.ps1 | 66 ------ tools/check-plantuml.sh | 50 ----- tools/check_tables.py | 120 ---------- tools/extract-charts.sh | 65 ------ tools/extract-mermaid-charts.ps1 | 47 ---- tools/extract-mermaid-charts.py | 61 ------ tools/kafka-comprehensive-test.bat | 101 --------- tools/kafka-manual-test.bat | 37 ---- tools/run-intellij-service-profile.py | 303 -------------------------- 12 files changed, 1116 deletions(-) delete mode 100644 tools/check-kafka-messages.ps1 delete mode 100644 tools/check-mermaid.ps1 delete mode 100644 tools/check-mermaid.sh delete mode 100644 tools/check-plantuml.ps1 delete mode 100644 tools/check-plantuml.sh delete mode 100644 tools/check_tables.py delete mode 100644 tools/extract-charts.sh delete mode 100644 tools/extract-mermaid-charts.ps1 delete mode 100644 tools/extract-mermaid-charts.py delete mode 100644 tools/kafka-comprehensive-test.bat delete mode 100644 tools/kafka-manual-test.bat delete mode 100644 tools/run-intellij-service-profile.py diff --git a/tools/check-kafka-messages.ps1 b/tools/check-kafka-messages.ps1 deleted file mode 100644 index 2a9129b..0000000 --- a/tools/check-kafka-messages.ps1 +++ /dev/null @@ -1,63 +0,0 @@ -# Kafka 메시지 확인 스크립트 (Windows PowerShell) -# -# 사용법: .\check-kafka-messages.ps1 - -$KAFKA_SERVER = "4.230.50.63:9092" - -Write-Host "========================================" -ForegroundColor Cyan -Write-Host "📊 Kafka 토픽 메시지 확인" -ForegroundColor Cyan -Write-Host "========================================" -ForegroundColor Cyan -Write-Host "" - -# Kafka 설치 확인 -$kafkaPath = Read-Host "Kafka 설치 경로를 입력하세요 (예: C:\kafka)" - -if (-not (Test-Path "$kafkaPath\bin\windows\kafka-console-consumer.bat")) { - Write-Host "❌ Kafka가 해당 경로에 설치되어 있지 않습니다." -ForegroundColor Red - exit 1 -} - -Write-Host "✅ Kafka 경로 확인: $kafkaPath" -ForegroundColor Green -Write-Host "" - -# 토픽 선택 -Write-Host "확인할 토픽을 선택하세요:" -ForegroundColor Yellow -Write-Host " 1. event.created (이벤트 생성)" -Write-Host " 2. participant.registered (참여자 등록)" -Write-Host " 3. distribution.completed (배포 완료)" -Write-Host " 4. 모두 확인" -Write-Host "" - -$choice = Read-Host "선택 (1-4)" - -$topics = @() -switch ($choice) { - "1" { $topics = @("event.created") } - "2" { $topics = @("participant.registered") } - "3" { $topics = @("distribution.completed") } - "4" { $topics = @("event.created", "participant.registered", "distribution.completed") } - default { - Write-Host "❌ 잘못된 선택입니다." -ForegroundColor Red - exit 1 - } -} - -# 각 토픽별 메시지 확인 -foreach ($topic in $topics) { - Write-Host "" - Write-Host "========================================" -ForegroundColor Cyan - Write-Host "📩 토픽: $topic" -ForegroundColor Cyan - Write-Host "========================================" -ForegroundColor Cyan - - # 최근 5개 메시지만 확인 - & "$kafkaPath\bin\windows\kafka-console-consumer.bat" ` - --bootstrap-server $KAFKA_SERVER ` - --topic $topic ` - --from-beginning ` - --max-messages 5 ` - --timeout-ms 5000 2>&1 | Out-String | Write-Host - - Write-Host "" -} - -Write-Host "✅ 확인 완료!" -ForegroundColor Green diff --git a/tools/check-mermaid.ps1 b/tools/check-mermaid.ps1 deleted file mode 100644 index 49327a5..0000000 --- a/tools/check-mermaid.ps1 +++ /dev/null @@ -1,96 +0,0 @@ -# Mermaid Syntax Checker using Docker Container -# Similar to PlantUML checker - keeps container running for better performance - -param( - [Parameter(Mandatory=$true, Position=0)] - [string]$FilePath -) - -# Check if file exists -if (-not (Test-Path $FilePath)) { - Write-Host "Error: File not found: $FilePath" -ForegroundColor Red - exit 1 -} - -# Get absolute path -$absolutePath = (Resolve-Path $FilePath).Path -$fileName = Split-Path $absolutePath -Leaf - -Write-Host "`nChecking Mermaid syntax for: $fileName" -ForegroundColor Cyan -Write-Host ("=" * 60) -ForegroundColor Gray - -# Check if mermaid container is running -$containerRunning = docker ps --filter "name=mermaid-cli" --format "{{.Names}}" 2>$null - -if (-not $containerRunning) { - Write-Host "Error: Mermaid CLI container is not running." -ForegroundColor Red - Write-Host "Please follow the setup instructions in the Mermaid guide to start the container." -ForegroundColor Yellow - Write-Host "`nQuick setup commands:" -ForegroundColor Cyan - Write-Host "" - Write-Host "# 1. Start container with root privileges (port 48080)" -ForegroundColor Green - Write-Host "docker run -d --rm --name mermaid-cli -u root -p 48080:8080 --entrypoint sh minlag/mermaid-cli:latest -c `"while true;do sleep 3600; done`"" -ForegroundColor White - Write-Host "" - Write-Host "# 2. Install Chromium and dependencies" -ForegroundColor Green - Write-Host "docker exec mermaid-cli sh -c `"apk add --no-cache chromium chromium-chromedriver nss freetype harfbuzz ca-certificates ttf-freefont`"" -ForegroundColor White - Write-Host "" - Write-Host "# 3. Create Puppeteer configuration" -ForegroundColor Green - Write-Host "docker exec mermaid-cli sh -c `"echo '{```"executablePath```": ```"/usr/bin/chromium-browser```", ```"args```": [```"--no-sandbox```", ```"--disable-setuid-sandbox```", ```"--disable-dev-shm-usage```"]}' > /tmp/puppeteer-config.json`"" -ForegroundColor White - Write-Host "" - exit 1 -} - -# Set Puppeteer configuration file path -$puppeteerConfigFile = "/tmp/puppeteer-config.json" - -# Generate unique temp filename -$timestamp = Get-Date -Format "yyyyMMddHHmmss" -$processId = $PID -$tempFile = "/tmp/mermaid_${timestamp}_${processId}.mmd" -$outputFile = "/tmp/mermaid_${timestamp}_${processId}.svg" - -try { - # Copy file to container - Write-Host "Copying file to container..." -ForegroundColor Gray - docker cp "$absolutePath" "mermaid-cli:$tempFile" 2>&1 | Out-Null - - if ($LASTEXITCODE -ne 0) { - Write-Host "Error: Failed to copy file to container" -ForegroundColor Red - exit 1 - } - - # Run syntax check with Puppeteer configuration - Write-Host "Running syntax check..." -ForegroundColor Gray - $output = docker exec mermaid-cli sh -c "cd /home/mermaidcli && node_modules/.bin/mmdc -i '$tempFile' -o '$outputFile' -p '$puppeteerConfigFile' -q" 2>&1 - $exitCode = $LASTEXITCODE - - if ($exitCode -eq 0) { - Write-Host "`nSuccess: Mermaid syntax is valid!" -ForegroundColor Green - } else { - Write-Host "`nError: Mermaid syntax validation failed!" -ForegroundColor Red - Write-Host "`nError details:" -ForegroundColor Red - - # Parse and display error messages - $errorLines = $output -split "`n" - foreach ($line in $errorLines) { - if ($line -match "Error:|Parse error|Expecting|Syntax error") { - Write-Host " $line" -ForegroundColor Red - } elseif ($line -match "line \d+|at line") { - Write-Host " $line" -ForegroundColor Yellow - } elseif ($line.Trim() -ne "") { - Write-Host " $line" -ForegroundColor DarkRed - } - } - - exit 1 - } - -} finally { - # Clean up temp files - Write-Host "`nCleaning up..." -ForegroundColor Gray - docker exec mermaid-cli rm -f "$tempFile" "$outputFile" 2>&1 | Out-Null -} - -Write-Host "`nValidation complete!" -ForegroundColor Cyan - -# Note: Container is kept running for subsequent checks -# To stop: docker stop mermaid-cli && docker rm mermaid-cli \ No newline at end of file diff --git a/tools/check-mermaid.sh b/tools/check-mermaid.sh deleted file mode 100644 index abb29cb..0000000 --- a/tools/check-mermaid.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/bash -# Mermaid Syntax Checker using Docker Container -# Similar to PlantUML checker - keeps container running for better performance - -# Colors for output -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[0;33m' -CYAN='\033[0;36m' -GRAY='\033[0;90m' -NC='\033[0m' # No Color - -# Check if file path is provided -if [ -z "$1" ]; then - echo -e "${RED}Error: No file path provided${NC}" - echo "Usage: $0 " - exit 1 -fi - -FILE_PATH="$1" - -# Check if file exists -if [ ! -f "$FILE_PATH" ]; then - echo -e "${RED}Error: File not found: $FILE_PATH${NC}" - exit 1 -fi - -# Get absolute path -ABSOLUTE_PATH=$(realpath "$FILE_PATH") -FILE_NAME=$(basename "$ABSOLUTE_PATH") - -echo -e "\n${CYAN}Checking Mermaid syntax for: $FILE_NAME${NC}" -echo -e "${GRAY}$(printf '=%.0s' {1..60})${NC}" - -# Check if mermaid container is running -CONTAINER_RUNNING=$(docker ps --filter "name=mermaid-cli" --format "{{.Names}}" 2>/dev/null) - -if [ -z "$CONTAINER_RUNNING" ]; then - echo -e "${RED}Error: Mermaid CLI container is not running.${NC}" - echo -e "${YELLOW}Please follow the setup instructions in the Mermaid guide to start the container.${NC}" - echo -e "\n${CYAN}Quick setup commands:${NC}" - echo "" - echo -e "${GREEN}# 1. Start container with root privileges (port 48080)${NC}" - echo -e "${NC}docker run -d --rm --name mermaid-cli -u root -p 48080:8080 --entrypoint sh minlag/mermaid-cli:latest -c \"while true;do sleep 3600; done\"${NC}" - echo "" - echo -e "${GREEN}# 2. Install Chromium and dependencies${NC}" - echo -e "${NC}docker exec mermaid-cli sh -c \"apk add --no-cache chromium chromium-chromedriver nss freetype harfbuzz ca-certificates ttf-freefont\"${NC}" - echo "" - echo -e "${GREEN}# 3. Create Puppeteer configuration${NC}" - echo -e "${NC}docker exec mermaid-cli sh -c \"echo '{\\\"executablePath\\\": \\\"/usr/bin/chromium-browser\\\", \\\"args\\\": [\\\"--no-sandbox\\\", \\\"--disable-setuid-sandbox\\\", \\\"--disable-dev-shm-usage\\\"]}' > /tmp/puppeteer-config.json\"${NC}" - echo "" - exit 1 -fi - -# Set Puppeteer configuration file path -PUPPETEER_CONFIG_FILE="/tmp/puppeteer-config.json" - -# Generate unique temp filename -TIMESTAMP=$(date +"%Y%m%d%H%M%S") -PID=$$ -TEMP_FILE="/tmp/mermaid_${TIMESTAMP}_${PID}.mmd" -OUTPUT_FILE="/tmp/mermaid_${TIMESTAMP}_${PID}.svg" - -# Copy file to container -echo -e "${GRAY}Copying file to container...${NC}" -docker cp "$ABSOLUTE_PATH" "mermaid-cli:$TEMP_FILE" >/dev/null 2>&1 - -if [ $? -ne 0 ]; then - echo -e "${RED}Error: Failed to copy file to container${NC}" - exit 1 -fi - -# Run syntax check with Puppeteer configuration -echo -e "${GRAY}Running syntax check...${NC}" -OUTPUT=$(docker exec mermaid-cli sh -c "cd /home/mermaidcli && node_modules/.bin/mmdc -i '$TEMP_FILE' -o '$OUTPUT_FILE' -p '$PUPPETEER_CONFIG_FILE' -q" 2>&1) -EXIT_CODE=$? - -if [ $EXIT_CODE -eq 0 ]; then - echo -e "\n${GREEN}Success: Mermaid syntax is valid!${NC}" -else - echo -e "\n${RED}Error: Mermaid syntax validation failed!${NC}" - echo -e "\n${RED}Error details:${NC}" - - # Parse and display error messages - while IFS= read -r line; do - if [[ $line == *"Error:"* ]] || [[ $line == *"Parse error"* ]] || [[ $line == *"Expecting"* ]] || [[ $line == *"Syntax error"* ]]; then - echo -e " ${RED}$line${NC}" - elif [[ $line == *"line"* ]] && [[ $line =~ [0-9]+ ]]; then - echo -e " ${YELLOW}$line${NC}" - elif [[ ! -z "$line" ]]; then - echo -e " ${RED}$line${NC}" - fi - done <<< "$OUTPUT" - - # Clean up and exit with error - docker exec mermaid-cli rm -f "$TEMP_FILE" "$OUTPUT_FILE" >/dev/null 2>&1 - exit 1 -fi - -# Clean up temp files -echo -e "\n${GRAY}Cleaning up...${NC}" -docker exec mermaid-cli rm -f "$TEMP_FILE" "$OUTPUT_FILE" >/dev/null 2>&1 - -echo -e "\n${CYAN}Validation complete!${NC}" - -# Note: Container is kept running for subsequent checks -# To stop: docker stop mermaid-cli && docker rm mermaid-cli \ No newline at end of file diff --git a/tools/check-plantuml.ps1 b/tools/check-plantuml.ps1 deleted file mode 100644 index 9aca9c9..0000000 --- a/tools/check-plantuml.ps1 +++ /dev/null @@ -1,66 +0,0 @@ -param( - [Parameter(Mandatory=$false)] - [string]$FilePath = "C:\home\workspace\tripgen\design\backend\system\azure-physical-architecture.txt" -) - -Write-Host "=== PlantUML Syntax Checker ===" -ForegroundColor Cyan -Write-Host "Target file: $FilePath" -ForegroundColor Yellow - -# Check if file exists -if (-not (Test-Path $FilePath)) { - Write-Host "❌ File not found: $FilePath" -ForegroundColor Red - exit 1 -} - -# Execute directly in PowerShell -$timestamp = Get-Date -Format 'yyyyMMddHHmmss' -$tempFile = "/tmp/puml_$timestamp.puml" - -# Copy file -Write-Host "`n1. Copying file..." -ForegroundColor Gray -Write-Host " Temporary file: $tempFile" -docker cp $FilePath "plantuml:$tempFile" - -if ($LASTEXITCODE -ne 0) { - Write-Host "❌ File copy failed" -ForegroundColor Red - exit 1 -} -Write-Host " ✅ Copy completed" -ForegroundColor Green - -# Find JAR file path -Write-Host "`n2. Looking for PlantUML JAR file..." -ForegroundColor Gray -$JAR_PATH = docker exec plantuml sh -c "find / -name 'plantuml*.jar' 2>/dev/null | head -1" -Write-Host " JAR path: $JAR_PATH" -Write-Host " ✅ JAR file confirmed" -ForegroundColor Green - -# Syntax check -Write-Host "`n3. Running syntax check..." -ForegroundColor Gray -$syntaxOutput = docker exec plantuml sh -c "java -jar $JAR_PATH -checkonly $tempFile 2>&1" - -if ($LASTEXITCODE -eq 0) { - Write-Host "`n✅ Syntax check passed!" -ForegroundColor Green - Write-Host " No syntax errors found in the diagram." -ForegroundColor Green -} else { - Write-Host "`n❌ Syntax errors detected!" -ForegroundColor Red - Write-Host "Error details:" -ForegroundColor Red - Write-Host $syntaxOutput -ForegroundColor Yellow - - # Detailed error check - Write-Host "`nAnalyzing detailed errors..." -ForegroundColor Yellow - $detailError = docker exec plantuml sh -c "java -jar $JAR_PATH -failfast -v $tempFile 2>&1" - $errorLines = $detailError | Select-String "Error line" - - if ($errorLines) { - Write-Host "`n📍 Error locations:" -ForegroundColor Magenta - $errorLines | ForEach-Object { - Write-Host " $($_.Line)" -ForegroundColor Red - } - } -} - -# Clean up temporary file -Write-Host "`n4. Cleaning up temporary files..." -ForegroundColor Gray -docker exec plantuml sh -c "rm -f $tempFile" 2>$null -Write-Host " ✅ Cleanup completed" -ForegroundColor Green - -Write-Host "`n=== Check completed ===" -ForegroundColor Cyan \ No newline at end of file diff --git a/tools/check-plantuml.sh b/tools/check-plantuml.sh deleted file mode 100644 index 9ca522f..0000000 --- a/tools/check-plantuml.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -# PlantUML file syntax checker script -# Usage: ./check_plantuml.sh - -# Check parameters -if [ $# -eq 0 ]; then - echo "Usage: $0 " - echo "Example: $0 diagram.puml" - exit 1 -fi - -# File to check parameter -CHECK_FILE="$1" - -# Check if file exists -if [ ! -f "$CHECK_FILE" ]; then - echo "Error: File '$CHECK_FILE' does not exist." - exit 1 -fi - -# 1. Generate unique filename (prevent conflicts) -TEMP_FILE="/tmp/puml_$(date +%s)_$$.puml" - -# 2. Copy file -echo "Copying file to Docker container..." -docker cp "$CHECK_FILE" plantuml:"$TEMP_FILE" - -# 3. Find JAR file location -echo "Finding PlantUML JAR file location..." -JAR_PATH=$(docker exec plantuml find / -name "plantuml*.jar" 2>/dev/null | head -1) - -if [ -z "$JAR_PATH" ]; then - echo "Error: PlantUML JAR file not found." - exit 1 -fi - -# 4. Syntax check -echo "Running PlantUML syntax check..." -docker exec plantuml java -jar "$JAR_PATH" -checkonly "$TEMP_FILE" - -# 5. Detailed error check (if needed) -echo "Checking detailed error information..." -docker exec plantuml sh -c "cd /tmp && java -jar $JAR_PATH -failfast -v $TEMP_FILE 2>&1 | grep -E 'Error line'" - -# 6. Clean up temporary file -echo "Cleaning up temporary files..." -docker exec -u root plantuml rm -f "$TEMP_FILE" - -echo "Check completed." diff --git a/tools/check_tables.py b/tools/check_tables.py deleted file mode 100644 index 7d794cc..0000000 --- a/tools/check_tables.py +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/env python3 -""" -PostgreSQL 테이블 확인 스크립트 -distribution-service의 테이블 생성 여부를 확인합니다. -""" - -import psycopg2 -import sys - -# DB 연결 정보 -DB_CONFIG = { - 'host': '4.217.133.59', - 'port': 5432, - 'database': 'distributiondb', - 'user': 'eventuser', - 'password': 'Hi5Jessica!' -} - -def main(): - try: - # DB 연결 - print(f"Connecting to database: {DB_CONFIG['host']}:{DB_CONFIG['port']}/{DB_CONFIG['database']}") - conn = psycopg2.connect(**DB_CONFIG) - cursor = conn.cursor() - - # 테이블 목록 조회 - print("\n=== Tables in distributiondb ===") - cursor.execute(""" - SELECT table_name - FROM information_schema.tables - WHERE table_schema = 'public' - ORDER BY table_name - """) - tables = cursor.fetchall() - - if not tables: - print("No tables found.") - else: - for table in tables: - print(f" - {table[0]}") - - # distribution_status 테이블 구조 확인 - if any('distribution_status' in table for table in tables): - print("\n=== distribution_status table structure ===") - cursor.execute(""" - SELECT column_name, data_type, character_maximum_length, is_nullable - FROM information_schema.columns - WHERE table_name = 'distribution_status' - ORDER BY ordinal_position - """) - columns = cursor.fetchall() - for col in columns: - nullable = "NULL" if col[3] == 'YES' else "NOT NULL" - max_len = f"({col[2]})" if col[2] else "" - print(f" - {col[0]}: {col[1]}{max_len} {nullable}") - - # channel_status 테이블 구조 확인 - if any('channel_status' in table for table in tables): - print("\n=== channel_status table structure ===") - cursor.execute(""" - SELECT column_name, data_type, character_maximum_length, is_nullable - FROM information_schema.columns - WHERE table_name = 'channel_status' - ORDER BY ordinal_position - """) - columns = cursor.fetchall() - for col in columns: - nullable = "NULL" if col[3] == 'YES' else "NOT NULL" - max_len = f"({col[2]})" if col[2] else "" - print(f" - {col[0]}: {col[1]}{max_len} {nullable}") - - # 인덱스 확인 - print("\n=== Indexes ===") - cursor.execute(""" - SELECT tablename, indexname, indexdef - FROM pg_indexes - WHERE schemaname = 'public' - AND tablename IN ('distribution_status', 'channel_status') - ORDER BY tablename, indexname - """) - indexes = cursor.fetchall() - for idx in indexes: - print(f" - {idx[0]}.{idx[1]}") - print(f" {idx[2]}") - - # 외래 키 확인 - print("\n=== Foreign Keys ===") - cursor.execute(""" - SELECT - tc.table_name, - kcu.column_name, - ccu.table_name AS foreign_table_name, - ccu.column_name AS foreign_column_name - FROM information_schema.table_constraints AS tc - JOIN information_schema.key_column_usage AS kcu - ON tc.constraint_name = kcu.constraint_name - AND tc.table_schema = kcu.table_schema - JOIN information_schema.constraint_column_usage AS ccu - ON ccu.constraint_name = tc.constraint_name - AND ccu.table_schema = tc.table_schema - WHERE tc.constraint_type = 'FOREIGN KEY' - AND tc.table_name IN ('distribution_status', 'channel_status') - """) - fks = cursor.fetchall() - for fk in fks: - print(f" - {fk[0]}.{fk[1]} -> {fk[2]}.{fk[3]}") - - # 연결 종료 - cursor.close() - conn.close() - - print("\n✅ Database connection successful!") - return 0 - - except Exception as e: - print(f"\n❌ Error: {e}", file=sys.stderr) - return 1 - -if __name__ == "__main__": - sys.exit(main()) diff --git a/tools/extract-charts.sh b/tools/extract-charts.sh deleted file mode 100644 index b31019c..0000000 --- a/tools/extract-charts.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -# Extract mermaid charts from markdown file - -INPUT_FILE="define/시장조사-차트.md" -OUTPUT_DIR="define/charts" - -echo "Extracting Mermaid charts from: $INPUT_FILE" -echo "Output directory: $OUTPUT_DIR" -echo "" - -# Create output directory -mkdir -p "$OUTPUT_DIR" - -# Counter -chart_num=0 - -# Read file and extract charts -in_mermaid=false -current_chart="" -current_title="" - -while IFS= read -r line || [ -n "$line" ]; do - # Check for section header (## number. title) - if [[ $line =~ ^##[[:space:]]([0-9]+)\.[[:space:]](.+)$ ]]; then - num="${BASH_REMATCH[1]}" - title="${BASH_REMATCH[2]}" - current_title=$(printf "chart%02d_%s" "$num" "${title// /_}") - current_title="${current_title//\//_}" - fi - - # Check for mermaid start - if [[ $line == '```mermaid' ]]; then - in_mermaid=true - current_chart="" - continue - fi - - # Check for mermaid end - if [[ $line == '```' ]] && $in_mermaid; then - # Save chart - if [ -n "$current_title" ]; then - filename="${current_title}.mmd" - echo "$current_chart" > "$OUTPUT_DIR/$filename" - echo " ✓ Saved: $filename" - ((chart_num++)) - fi - in_mermaid=false - current_chart="" - continue - fi - - # Collect chart lines - if $in_mermaid; then - if [ -n "$current_chart" ]; then - current_chart+=$'\n' - fi - current_chart+="$line" - fi -done < "$INPUT_FILE" - -echo "" -echo "✅ Successfully extracted $chart_num charts!" -echo "" -echo "Chart files saved in: $OUTPUT_DIR" diff --git a/tools/extract-mermaid-charts.ps1 b/tools/extract-mermaid-charts.ps1 deleted file mode 100644 index df27271..0000000 --- a/tools/extract-mermaid-charts.ps1 +++ /dev/null @@ -1,47 +0,0 @@ -# Mermaid Chart Extractor -# Extracts Mermaid charts from markdown and saves them as individual .mmd files - -$markdownFile = "define/시장조사-차트.md" -$outputDir = "define/charts" - -Write-Host "Extracting Mermaid charts from: $markdownFile" -Write-Host "Output directory: $outputDir`n" - -# Create output directory -if (-not (Test-Path $outputDir)) { - New-Item -ItemType Directory -Path $outputDir | Out-Null -} - -# Read markdown file -$content = Get-Content $markdownFile -Raw -Encoding UTF8 - -# Extract all mermaid blocks with their section headers -$pattern = '## (\d+)\. (.+?)\n\n```mermaid\n(.*?)```' -$matches = [regex]::Matches($content, $pattern, [System.Text.RegularExpressions.RegexOptions]::Singleline) - -Write-Host "Found $($matches.Count) Mermaid charts`n" - -# Save each chart -$count = 0 -foreach ($match in $matches) { - $num = $match.Groups[1].Value - $title = $match.Groups[2].Value - $chartCode = $match.Groups[3].Value - - # Clean filename - $filename = "chart$($num.PadLeft(2,'0'))_$($title.Replace(' ', '_').Replace('/', '_')).mmd" - $filepath = Join-Path $outputDir $filename - - # Write mermaid code - $chartCode.Trim() | Out-File -FilePath $filepath -Encoding UTF8 -NoNewline - - Write-Host " ✓ Saved: $filename" - $count++ -} - -Write-Host "`n✅ Successfully extracted $count charts!" -Write-Host "`nChart files saved in: $outputDir" -Write-Host "`nNext steps:" -Write-Host "1. Use Mermaid Live Editor: https://mermaid.live/" -Write-Host "2. Copy-paste each .mmd file content" -Write-Host "3. Export as PNG or SVG" diff --git a/tools/extract-mermaid-charts.py b/tools/extract-mermaid-charts.py deleted file mode 100644 index 85ecab9..0000000 --- a/tools/extract-mermaid-charts.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python3 -""" -Mermaid Chart Extractor -Extracts Mermaid charts from markdown and saves them as individual .mmd files -""" - -import re -import os -from pathlib import Path - - -def extract_mermaid_charts(markdown_file, output_dir): - """Extract all mermaid code blocks from markdown file""" - - # Read markdown file - with open(markdown_file, 'r', encoding='utf-8') as f: - content = f.read() - - # Find all mermaid code blocks - pattern = r'```mermaid\n(.*?)```' - matches = re.findall(pattern, content, re.DOTALL) - - # Create output directory - os.makedirs(output_dir, exist_ok=True) - - # Extract chart titles from markdown headers - title_pattern = r'## (\d+)\. (.+?)\n\n```mermaid' - titles = re.findall(title_pattern, content, re.DOTALL) - - print(f"Found {len(matches)} Mermaid charts") - - # Save each chart as separate .mmd file - for i, (chart_code, (num, title)) in enumerate(zip(matches, titles), 1): - # Clean filename - filename = f"chart{num:02d}_{title.replace(' ', '_').replace('/', '_')}.mmd" - filepath = os.path.join(output_dir, filename) - - # Write mermaid code - with open(filepath, 'w', encoding='utf-8') as f: - f.write(chart_code.strip()) - - print(f" ✓ Saved: {filename}") - - return len(matches) - - -if __name__ == "__main__": - # Configuration - markdown_file = "define/시장조사-차트.md" - output_dir = "define/charts" - - print(f"Extracting Mermaid charts from: {markdown_file}") - print(f"Output directory: {output_dir}\n") - - count = extract_mermaid_charts(markdown_file, output_dir) - - print(f"\n✅ Successfully extracted {count} charts!") - print(f"\nNext steps:") - print(f"1. Use Mermaid Live Editor: https://mermaid.live/") - print(f"2. Copy-paste each .mmd file content") - print(f"3. Export as PNG or SVG") diff --git a/tools/kafka-comprehensive-test.bat b/tools/kafka-comprehensive-test.bat deleted file mode 100644 index 70f9e13..0000000 --- a/tools/kafka-comprehensive-test.bat +++ /dev/null @@ -1,101 +0,0 @@ -@echo off -REM ============================================ -REM Kafka/Redis 통합 테스트 스크립트 -REM ============================================ - -echo ============================================ -echo Kafka/Redis 통합 테스트 시작 -echo ============================================ -echo. - -REM 현재 디렉토리 확인 -cd /d "%~dp0\.." -echo 현재 디렉토리: %CD% -echo. - -REM 로그 디렉토리 확인 및 생성 -if not exist "logs" mkdir logs -echo 로그 디렉토리: %CD%\logs -echo. - -REM 테스트 타임스탬프 -set TEST_TIMESTAMP=%date:~0,4%%date:~5,2%%date:~8,2%_%time:~0,2%%time:~3,2%%time:~6,2% -set TEST_TIMESTAMP=%TEST_TIMESTAMP: =0% -set TEST_LOG=logs\kafka-redis-test_%TEST_TIMESTAMP%.log - -echo ============================================ -echo 1단계: Kafka 수동 테스트 메시지 전송 -echo ============================================ -echo. -echo Kafka 메시지 전송 중... -gradlew ai-service:runKafkaManualTest > %TEST_LOG% 2>&1 -if %ERRORLEVEL% EQU 0 ( - echo ✓ Kafka 메시지 전송 완료 -) else ( - echo ✗ Kafka 메시지 전송 실패 ^(Error Code: %ERRORLEVEL%^) - echo 로그 파일을 확인하세요: %TEST_LOG% -) -echo. - -echo ============================================ -echo 2단계: AI 서비스 Consumer 처리 대기 -echo ============================================ -echo. -echo AI 서비스가 Kafka 메시지를 처리할 때까지 60초 대기... -timeout /t 60 /nobreak > nul -echo ✓ 대기 완료 -echo. - -echo ============================================ -echo 3단계: Job 상태 확인 ^(Redis^) -echo ============================================ -echo. -echo Job 상태 조회 중... -curl -s "http://localhost:8083/api/v1/ai-service/internal/jobs/manual-job-001/status" >> %TEST_LOG% 2>&1 -if %ERRORLEVEL% EQU 0 ( - echo ✓ Job 상태 조회 성공 - curl -s "http://localhost:8083/api/v1/ai-service/internal/jobs/manual-job-001/status" -) else ( - echo ✗ Job 상태 조회 실패 -) -echo. - -echo ============================================ -echo 4단계: AI 추천 결과 확인 ^(Redis^) -echo ============================================ -echo. -echo AI 추천 결과 조회 중... -curl -s "http://localhost:8083/api/v1/ai-service/internal/recommendations/manual-event-001" >> %TEST_LOG% 2>&1 -if %ERRORLEVEL% EQU 0 ( - echo ✓ AI 추천 결과 조회 성공 - curl -s "http://localhost:8083/api/v1/ai-service/internal/recommendations/manual-event-001" -) else ( - echo ✗ AI 추천 결과 조회 실패 -) -echo. - -echo ============================================ -echo 5단계: 모든 테스트 메시지 상태 확인 -echo ============================================ -echo. -echo [Job 001] 상태 확인: -curl -s "http://localhost:8083/api/v1/ai-service/internal/jobs/manual-job-001/status" | findstr "status" -echo. -echo [Job 002] 상태 확인: -curl -s "http://localhost:8083/api/v1/ai-service/internal/jobs/manual-job-002/status" | findstr "status" -echo. -echo [Job 003] 상태 확인: -curl -s "http://localhost:8083/api/v1/ai-service/internal/jobs/manual-job-003/status" | findstr "status" -echo. - -echo ============================================ -echo 테스트 완료 -echo ============================================ -echo. -echo 상세 로그 파일: %TEST_LOG% -echo. -echo 수동 확인 명령어: -echo - Job 상태: curl http://localhost:8083/api/v1/ai-service/internal/jobs/{jobId}/status -echo - AI 추천: curl http://localhost:8083/api/v1/ai-service/internal/recommendations/{eventId} -echo. -pause diff --git a/tools/kafka-manual-test.bat b/tools/kafka-manual-test.bat deleted file mode 100644 index bacadf4..0000000 --- a/tools/kafka-manual-test.bat +++ /dev/null @@ -1,37 +0,0 @@ -@echo off -REM Kafka 수동 테스트 실행 스크립트 (Windows) - -cd /d %~dp0\.. - -echo ================================================ -echo Kafka Manual Test - AI Service -echo ================================================ -echo. -echo 이 스크립트는 Kafka에 테스트 메시지를 전송합니다. -echo ai-service가 실행 중이어야 메시지를 처리할 수 있습니다. -echo. -echo Kafka Brokers: 20.249.182.13:9095, 4.217.131.59:9095 -echo Topic: ai-event-generation-job -echo. -echo ================================================ -echo. - -REM 테스트 클래스 실행 -.\gradlew ai-service:test --tests "com.kt.ai.test.manual.KafkaManualTest" --info - -echo. -echo ================================================ -echo 테스트 완료! -echo. -echo 결과 확인: -echo 1. Job 상태 조회: -echo curl http://localhost:8083/api/v1/ai-service/internal/jobs/manual-job-001/status -echo. -echo 2. AI 추천 결과 조회: -echo curl http://localhost:8083/api/v1/ai-service/internal/recommendations/manual-event-001 -echo. -echo 3. Redis 키 확인: -echo curl http://localhost:8083/api/v1/ai-service/internal/recommendations/debug/redis-keys -echo ================================================ - -pause diff --git a/tools/run-intellij-service-profile.py b/tools/run-intellij-service-profile.py deleted file mode 100644 index 2278686..0000000 --- a/tools/run-intellij-service-profile.py +++ /dev/null @@ -1,303 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -""" -Tripgen Service Runner Script -Reads execution profiles from {service-name}/.run/{service-name}.run.xml and runs services accordingly. - -Usage: - python run-config.py - -Examples: - python run-config.py user-service - python run-config.py location-service - python run-config.py trip-service - python run-config.py ai-service -""" - -import os -import sys -import subprocess -import xml.etree.ElementTree as ET -from pathlib import Path -import argparse - - -def get_project_root(): - """Find project root directory""" - current_dir = Path(__file__).parent.absolute() - while current_dir.parent != current_dir: - if (current_dir / 'gradlew').exists() or (current_dir / 'gradlew.bat').exists(): - return current_dir - current_dir = current_dir.parent - - # If gradlew not found, assume parent directory of develop as project root - return Path(__file__).parent.parent.absolute() - - -def parse_run_configurations(project_root, service_name=None): - """Parse run configuration files from .run directories""" - configurations = {} - - if service_name: - # Parse specific service configuration - run_config_path = project_root / service_name / '.run' / f'{service_name}.run.xml' - if run_config_path.exists(): - config = parse_single_run_config(run_config_path, service_name) - if config: - configurations[service_name] = config - else: - print(f"[ERROR] Cannot find run configuration: {run_config_path}") - else: - # Find all service directories - service_dirs = ['user-service', 'location-service', 'trip-service', 'ai-service'] - for service in service_dirs: - run_config_path = project_root / service / '.run' / f'{service}.run.xml' - if run_config_path.exists(): - config = parse_single_run_config(run_config_path, service) - if config: - configurations[service] = config - - return configurations - - -def parse_single_run_config(config_path, service_name): - """Parse a single run configuration file""" - try: - tree = ET.parse(config_path) - root = tree.getroot() - - # Find configuration element - config = root.find('.//configuration[@type="GradleRunConfiguration"]') - if config is None: - print(f"[WARNING] No Gradle configuration found in {config_path}") - return None - - # Extract environment variables - env_vars = {} - env_option = config.find('.//option[@name="env"]') - if env_option is not None: - env_map = env_option.find('map') - if env_map is not None: - for entry in env_map.findall('entry'): - key = entry.get('key') - value = entry.get('value') - if key and value: - env_vars[key] = value - - # Extract task names - task_names = [] - task_names_option = config.find('.//option[@name="taskNames"]') - if task_names_option is not None: - task_list = task_names_option.find('list') - if task_list is not None: - for option in task_list.findall('option'): - value = option.get('value') - if value: - task_names.append(value) - - if env_vars or task_names: - return { - 'env_vars': env_vars, - 'task_names': task_names, - 'config_path': str(config_path) - } - - return None - - except ET.ParseError as e: - print(f"[ERROR] XML parsing error in {config_path}: {e}") - return None - except Exception as e: - print(f"[ERROR] Error reading {config_path}: {e}") - return None - - -def get_gradle_command(project_root): - """Return appropriate Gradle command for OS""" - if os.name == 'nt': # Windows - gradle_bat = project_root / 'gradlew.bat' - if gradle_bat.exists(): - return str(gradle_bat) - return 'gradle.bat' - else: # Unix-like (Linux, macOS) - gradle_sh = project_root / 'gradlew' - if gradle_sh.exists(): - return str(gradle_sh) - return 'gradle' - - -def run_service(service_name, config, project_root): - """Run service""" - print(f"[START] Starting {service_name} service...") - - # Set environment variables - env = os.environ.copy() - for key, value in config['env_vars'].items(): - env[key] = value - print(f" [ENV] {key}={value}") - - # Prepare Gradle command - gradle_cmd = get_gradle_command(project_root) - - # Execute tasks - for task_name in config['task_names']: - print(f"\n[RUN] Executing: {task_name}") - - cmd = [gradle_cmd, task_name] - - try: - # Execute from project root directory - process = subprocess.Popen( - cmd, - cwd=project_root, - env=env, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - universal_newlines=True, - bufsize=1, - encoding='utf-8', - errors='replace' - ) - - print(f"[CMD] Command: {' '.join(cmd)}") - print(f"[DIR] Working directory: {project_root}") - print("=" * 50) - - # Real-time output - for line in process.stdout: - print(line.rstrip()) - - # Wait for process completion - process.wait() - - if process.returncode == 0: - print(f"\n[SUCCESS] {task_name} execution completed") - else: - print(f"\n[FAILED] {task_name} execution failed (exit code: {process.returncode})") - return False - - except KeyboardInterrupt: - print(f"\n[STOP] Interrupted by user") - process.terminate() - return False - except Exception as e: - print(f"\n[ERROR] Execution error: {e}") - return False - - return True - - -def list_available_services(configurations): - """List available services""" - print("[LIST] Available services:") - print("=" * 40) - - for service_name, config in configurations.items(): - if config['task_names']: - print(f" [SERVICE] {service_name}") - if 'config_path' in config: - print(f" +-- Config: {config['config_path']}") - for task in config['task_names']: - print(f" +-- Task: {task}") - print(f" +-- {len(config['env_vars'])} environment variables") - print() - - -def main(): - """Main function""" - parser = argparse.ArgumentParser( - description='Tripgen Service Runner Script', - formatter_class=argparse.RawDescriptionHelpFormatter, - epilog=""" -Examples: - python run-config.py user-service - python run-config.py location-service - python run-config.py trip-service - python run-config.py ai-service - python run-config.py --list - """ - ) - - parser.add_argument( - 'service_name', - nargs='?', - help='Service name to run' - ) - - parser.add_argument( - '--list', '-l', - action='store_true', - help='List available services' - ) - - args = parser.parse_args() - - # Find project root - project_root = get_project_root() - print(f"[INFO] Project root: {project_root}") - - # Parse run configurations - print("[INFO] Reading run configuration files...") - configurations = parse_run_configurations(project_root) - - if not configurations: - print("[ERROR] No execution configurations found") - return 1 - - print(f"[INFO] Found {len(configurations)} execution configurations") - - # List services request - if args.list: - list_available_services(configurations) - return 0 - - # If service name not provided - if not args.service_name: - print("\n[ERROR] Please provide service name") - list_available_services(configurations) - print("Usage: python run-config.py ") - return 1 - - # Find service - service_name = args.service_name - - # Try to parse specific service configuration if not found - if service_name not in configurations: - print(f"[INFO] Trying to find configuration for '{service_name}'...") - configurations = parse_run_configurations(project_root, service_name) - - if service_name not in configurations: - print(f"[ERROR] Cannot find '{service_name}' service") - list_available_services(configurations) - return 1 - - config = configurations[service_name] - - if not config['task_names']: - print(f"[ERROR] No executable tasks found for '{service_name}' service") - return 1 - - # Execute service - print(f"\n[TARGET] Starting '{service_name}' service execution") - print("=" * 50) - - success = run_service(service_name, config, project_root) - - if success: - print(f"\n[COMPLETE] '{service_name}' service started successfully!") - return 0 - else: - print(f"\n[FAILED] Failed to start '{service_name}' service") - return 1 - - -if __name__ == '__main__': - try: - exit_code = main() - sys.exit(exit_code) - except KeyboardInterrupt: - print("\n[STOP] Interrupted by user") - sys.exit(1) - except Exception as e: - print(f"\n[ERROR] Unexpected error occurred: {e}") - sys.exit(1) \ No newline at end of file