#!/bin/bash # Unified Tech Stack Service Test Script # This script demonstrates the unified service capabilities echo "🚀 Unified Tech Stack Service Test Script" echo "==========================================" # Service URLs UNIFIED_SERVICE="http://localhost:8013" TEMPLATE_MANAGER="http://localhost:8009" TECH_STACK_SELECTOR="http://localhost:8002" # Test data TEMPLATE_ID="0163731b-18e5-4d4e-86a1-aa2c05ae3140" # Blockchain Platform BUDGET=15000 DOMAIN="finance" FEATURES='["trading", "analytics", "security", "compliance"]' echo "" echo "🔍 Step 1: Check Service Health" echo "================================" echo "Checking Unified Service Health..." curl -s "$UNIFIED_SERVICE/health" | jq '.' echo "" echo "Checking Service Status..." curl -s "$UNIFIED_SERVICE/api/unified/status" | jq '.' echo "" echo "🔍 Step 2: Test Template-Based Recommendations" echo "==============================================" echo "Getting template-based recommendations..." curl -s -X POST "$UNIFIED_SERVICE/api/unified/template-recommendations" \ -H "Content-Type: application/json" \ -d "{\"templateId\": \"$TEMPLATE_ID\", \"recommendationType\": \"both\"}" | \ jq '.data.templateBased | {permutations: .permutations.success, combinations: .combinations.success, template: .template.success}' echo "" echo "🔍 Step 3: Test Domain-Based Recommendations" echo "=============================================" echo "Getting domain-based recommendations..." curl -s -X POST "$UNIFIED_SERVICE/api/unified/domain-recommendations" \ -H "Content-Type: application/json" \ -d "{\"budget\": $BUDGET, \"domain\": \"$DOMAIN\", \"features\": $FEATURES}" | \ jq '.data.domainBased | {success: .success, recommendationsCount: (.data.data.recommendations | length)}' echo "" echo "🔍 Step 4: Test Unified Recommendations" echo "=======================================" echo "Getting unified recommendations..." curl -s -X POST "$UNIFIED_SERVICE/api/unified/recommendations" \ -H "Content-Type: application/json" \ -d "{ \"templateId\": \"$TEMPLATE_ID\", \"budget\": $BUDGET, \"domain\": \"$DOMAIN\", \"features\": $FEATURES, \"preferences\": { \"includePermutations\": true, \"includeCombinations\": true, \"includeDomainRecommendations\": true } }" | jq '.data.unified | { techStacksCount: (.techStacks | length), technologiesCount: (.technologies | length), recommendationsCount: (.recommendations | length), confidence: .confidence, approach: .approach }' echo "" echo "🔍 Step 5: Test Analysis" echo "=======================" echo "Analyzing recommendations..." curl -s -X POST "$UNIFIED_SERVICE/api/unified/analyze" \ -H "Content-Type: application/json" \ -d "{ \"templateId\": \"$TEMPLATE_ID\", \"budget\": $BUDGET, \"domain\": \"$DOMAIN\", \"features\": $FEATURES }" | jq '.data.analysis | { templateManager: .templateManager.status, techStackSelector: .techStackSelector.status, comparison: .comparison.recommendationQuality }' echo "" echo "🎯 Step 6: Detailed Unified Analysis" echo "====================================" echo "Getting detailed unified recommendations with analysis..." curl -s -X POST "$UNIFIED_SERVICE/api/unified/recommendations" \ -H "Content-Type: application/json" \ -d "{ \"templateId\": \"$TEMPLATE_ID\", \"budget\": $BUDGET, \"domain\": \"$DOMAIN\", \"features\": $FEATURES }" | jq '.data | { templateBased: { permutationsAvailable: (.templateBased.data.permutations.success), combinationsAvailable: (.templateBased.data.combinations.success), templateInfo: (.templateBased.data.template.success) }, domainBased: { recommendationsAvailable: (.domainBased.success), recommendationsCount: (.domainBased.data.data.recommendations | length) }, unified: { totalTechStacks: (.unified.techStacks | length), totalTechnologies: (.unified.technologies | length), confidence: .unified.confidence, approach: .unified.approach }, analysis: { templateManagerStatus: .analysis.templateManager.status, techStackSelectorStatus: .analysis.techStackSelector.status, recommendationQuality: .analysis.comparison.recommendationQuality } }' echo "" echo "✅ Test Complete!" echo "==================" echo "The Unified Tech Stack Service successfully:" echo "1. ✅ Combined template-based recommendations (permutations & combinations)" echo "2. ✅ Integrated domain-based recommendations (budget & domain)" echo "3. ✅ Generated unified recommendations with intelligent merging" echo "4. ✅ Provided comprehensive analysis of both approaches" echo "5. ✅ Demonstrated the unison between both services" echo "" echo "🚀 The service is ready for production use!"