@@ -65,6 +65,14 @@ class ServerType(Enum):
6565 TOMCAT = 0
6666 SPRING = 1
6767
68+ def get_server_type_for_module (sample_module : str ) -> Optional [ServerType ]:
69+ if "spring" in sample_module and "spring-boot" not in sample_module :
70+ return ServerType .TOMCAT
71+ elif "spring" in sample_module :
72+ return ServerType .SPRING
73+
74+ return None
75+
6876def str_to_bool (value : str ) -> str :
6977 """Convert true/false string to 1/0 string for internal compatibility."""
7078 if value .lower () in ('true' , '1' ):
@@ -562,11 +570,7 @@ def run_single_test(self, sample_module: str, java_agent: str,
562570 """Run a single system test."""
563571 print (f"Running system test for { sample_module } " )
564572
565- server_type = None
566- if "spring" in sample_module and "spring-boot" not in sample_module :
567- server_type = ServerType .TOMCAT
568- elif "spring" in sample_module :
569- server_type = ServerType .SPRING
573+ server_type = get_server_type_for_module (sample_module )
570574
571575 try :
572576 # Set up infrastructure
@@ -639,9 +643,10 @@ def run_manual_test_mode(self, sample_module: str, java_agent: str,
639643 """Set up infrastructure for manual testing from IDE."""
640644 print (f"Setting up manual test environment for { sample_module } " )
641645
646+ server_type = get_server_type_for_module (sample_module )
642647 try :
643648 # Set up infrastructure
644- setup_result = self .setup_test_infrastructure (sample_module , java_agent , java_agent_auto_init , build_before_run )
649+ setup_result = self .setup_test_infrastructure (sample_module , java_agent , java_agent_auto_init , build_before_run , server_type )
645650 if setup_result != 0 :
646651 return setup_result
647652
@@ -658,7 +663,9 @@ def run_manual_test_mode(self, sample_module: str, java_agent: str,
658663 print (f" - Agent Auto-init: { java_agent_auto_init } " )
659664 print (f" - Mock DSN: http://502f25099c204a2fbf4cb16edc5975d1@localhost:8000/0" )
660665
661- if "spring" in sample_module :
666+ if server_type == ServerType .TOMCAT :
667+ print (f"\n Tomcat app is running on: http://localhost:8080/{ sample_module } -0.0.1-SNAPSHOT" )
668+ elif server_type == ServerType .SPRING :
662669 print ("\n Spring Boot app is running on: http://localhost:8080" )
663670
664671 print ("\n Press Enter to stop the infrastructure and exit..." )
@@ -998,8 +1005,6 @@ def main():
9981005 # Convert true/false arguments to internal format
9991006 build = str_to_bool (args .build )
10001007
1001- runner .start_tomcat_server (args .module )
1002-
10031008 # Build if requested
10041009 if build == "1" :
10051010 print ("Building before starting Tomcat application" )
@@ -1008,6 +1013,8 @@ def main():
10081013 print ("Build failed" )
10091014 return build_result
10101015
1016+ runner .start_tomcat_server (args .module )
1017+
10111018 if runner .wait_for_tomcat (args .module ):
10121019 print ("Tomcat application started successfully!" )
10131020 return 0
0 commit comments