//! Test to verify OpenRPC method registration use hero_supervisor_openrpc_client::SupervisorClient; use tokio::time::{sleep, Duration}; #[tokio::main] async fn main() -> Result<(), Box> { println!("๐Ÿ” Testing OpenRPC method registration"); // Start a local supervisor with OpenRPC (assume it's running) println!("๐Ÿ“ก Connecting to OpenRPC server..."); let client = SupervisorClient::new("http://127.0.0.1:3030").await?; // Test basic methods first println!("๐Ÿงช Testing basic methods..."); // Test list_runners (should work) match client.list_runners().await { Ok(runners) => println!("โœ… list_runners works: {:?}", runners), Err(e) => println!("โŒ list_runners failed: {}", e), } // Test get_all_runner_status (might have serialization issues) match client.get_all_runner_status().await { Ok(statuses) => println!("โœ… get_all_runner_status works: {} runners", statuses.len()), Err(e) => println!("โŒ get_all_runner_status failed: {}", e), } // Test the new queue_and_wait method println!("๐ŸŽฏ Testing queue_and_wait method..."); // Create a simple test job use hero_supervisor::job::{JobBuilder, JobType}; let job = JobBuilder::new() .caller_id("test_client") .context_id("method_test") .payload("print('Testing queue_and_wait method registration');") .job_type(JobType::OSIS) .runner_name("osis_actor") // Use existing runner .timeout(Duration::from_secs(10)) .build()?; match client.queue_and_wait("osis_actor", job, 10).await { Ok(Some(result)) => println!("โœ… queue_and_wait works! Result: {}", result), Ok(None) => println!("โฐ queue_and_wait timed out"), Err(e) => { println!("โŒ queue_and_wait failed: {}", e); // Check if it's a MethodNotFound error if e.to_string().contains("Method not found") { println!("๐Ÿ” Method not found - this suggests trait registration issue"); } } } println!("๐Ÿ OpenRPC method test completed"); Ok(()) }