- Move 12 markdown files from root to docs/ subdirectories - Organize documentation by category: • docs/troubleshooting/ (1 file) - Technical troubleshooting guides • docs/deployment/ (4 files) - Deployment and security documentation • docs/guides/ (3 files) - Feature-specific guides • docs/planning/ (4 files) - Planning and improvement proposals Root directory cleanup: - Reduced from 16 to 4 markdown files in root - Only essential project files remain: • CLAUDE.md (AI instructions) • README.md (Main project readme) • CLEANUP_PLAN.md (Current cleanup plan) • SRC_STRUCTURE_IMPROVEMENTS.md (Structure improvements) This improves: ✅ Documentation discoverability ✅ Logical organization by purpose ✅ Clean root directory ✅ Better maintainability
114 lines
4.4 KiB
PHP
114 lines
4.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
require_once __DIR__ . '/../../vendor/autoload.php';
|
|
|
|
use App\Framework\Core\AppBootstrapper;
|
|
use App\Framework\Performance\EnhancedPerformanceCollector;
|
|
use App\Framework\DateTime\SystemClock;
|
|
use App\Framework\DateTime\SystemHighResolutionClock;
|
|
use App\Framework\Performance\MemoryMonitor;
|
|
use App\Framework\Queue\Interfaces\DistributedLockInterface;
|
|
use App\Framework\Queue\Services\WorkerRegistry;
|
|
use App\Framework\Queue\Services\JobDistributionService;
|
|
use App\Framework\Queue\Services\WorkerHealthCheckService;
|
|
use App\Framework\Queue\Services\FailoverRecoveryService;
|
|
use App\Framework\Queue\ValueObjects\WorkerId;
|
|
use App\Framework\Queue\ValueObjects\QueueName;
|
|
|
|
echo "🧪 Testing Queue System Initialization...\n";
|
|
|
|
try {
|
|
// Bootstrap application using the same pattern as console.php
|
|
echo "1. Bootstrapping application...\n";
|
|
|
|
// Use working directory
|
|
$basePath = '/var/www/html';
|
|
chdir($basePath);
|
|
|
|
// Create dependencies for enhanced performance collector
|
|
$clock = new SystemClock();
|
|
$highResClock = new SystemHighResolutionClock();
|
|
$memoryMonitor = new MemoryMonitor();
|
|
$collector = new EnhancedPerformanceCollector($clock, $highResClock, $memoryMonitor, enabled: false);
|
|
$bootstrapper = new AppBootstrapper($basePath, $collector, $memoryMonitor);
|
|
|
|
$app = $bootstrapper->bootstrapConsole();
|
|
$container = $app->getContainer();
|
|
echo " ✅ Application bootstrapped\n";
|
|
|
|
// Test DistributedLockInterface registration
|
|
echo "\n2. Testing DistributedLockInterface registration...\n";
|
|
try {
|
|
$distributedLock = $container->get(DistributedLockInterface::class);
|
|
echo " ✅ DistributedLockInterface: " . get_class($distributedLock) . "\n";
|
|
} catch (Exception $e) {
|
|
echo " ❌ DistributedLockInterface not registered: " . $e->getMessage() . "\n";
|
|
}
|
|
|
|
// Test WorkerRegistry registration
|
|
echo "\n3. Testing WorkerRegistry registration...\n";
|
|
try {
|
|
$workerRegistry = $container->get(WorkerRegistry::class);
|
|
echo " ✅ WorkerRegistry: " . get_class($workerRegistry) . "\n";
|
|
} catch (Exception $e) {
|
|
echo " ❌ WorkerRegistry not registered: " . $e->getMessage() . "\n";
|
|
}
|
|
|
|
// Test JobDistributionService registration
|
|
echo "\n4. Testing JobDistributionService registration...\n";
|
|
try {
|
|
$jobDistribution = $container->get(JobDistributionService::class);
|
|
echo " ✅ JobDistributionService: " . get_class($jobDistribution) . "\n";
|
|
} catch (Exception $e) {
|
|
echo " ❌ JobDistributionService not registered: " . $e->getMessage() . "\n";
|
|
}
|
|
|
|
// Test WorkerHealthCheckService registration
|
|
echo "\n5. Testing WorkerHealthCheckService registration...\n";
|
|
try {
|
|
$healthCheck = $container->get(WorkerHealthCheckService::class);
|
|
echo " ✅ WorkerHealthCheckService: " . get_class($healthCheck) . "\n";
|
|
} catch (Exception $e) {
|
|
echo " ❌ WorkerHealthCheckService not registered: " . $e->getMessage() . "\n";
|
|
}
|
|
|
|
// Test FailoverRecoveryService registration
|
|
echo "\n6. Testing FailoverRecoveryService registration...\n";
|
|
try {
|
|
$failoverRecovery = $container->get(FailoverRecoveryService::class);
|
|
echo " ✅ FailoverRecoveryService: " . get_class($failoverRecovery) . "\n";
|
|
} catch (Exception $e) {
|
|
echo " ❌ FailoverRecoveryService not registered: " . $e->getMessage() . "\n";
|
|
}
|
|
|
|
// Test basic functionality
|
|
if (isset($workerRegistry)) {
|
|
echo "\n7. Testing basic WorkerRegistry functionality...\n";
|
|
try {
|
|
$workers = $workerRegistry->getActiveWorkers();
|
|
echo " ✅ Found " . count($workers) . " active workers\n";
|
|
} catch (Exception $e) {
|
|
echo " ❌ WorkerRegistry error: " . $e->getMessage() . "\n";
|
|
}
|
|
}
|
|
|
|
// Test Value Objects
|
|
echo "\n8. Testing Value Objects...\n";
|
|
try {
|
|
$workerId = WorkerId::generate();
|
|
echo " ✅ WorkerId: " . $workerId->toString() . "\n";
|
|
|
|
$queueName = QueueName::fromString('test');
|
|
echo " ✅ QueueName: " . $queueName->toString() . "\n";
|
|
} catch (Exception $e) {
|
|
echo " ❌ Value Object error: " . $e->getMessage() . "\n";
|
|
}
|
|
|
|
echo "\n🎉 Queue System test completed!\n";
|
|
|
|
} catch (Exception $e) {
|
|
echo "❌ Fatal error during testing: " . $e->getMessage() . "\n";
|
|
echo "Stack trace:\n" . $e->getTraceAsString() . "\n";
|
|
} |