use of com.testsigma.agent.mobile.MobileAutomationServer in project testsigma by testsigmahq.
the class ApplicationEventHandler method postAppContextReadyActions.
public void postAppContextReadyActions(ApplicationContext context) {
log.info("-------------- Post App Context Ready Actions Started --------------");
AgentConfig agentConfig = context.getBean(AgentConfig.class);
CloudAppBridge cloudAppBridge = context.getBean(CloudAppBridge.class);
ApplicationConfig applicationConfig = context.getBean(ApplicationConfig.class);
AgentWebServerService agentWebServerService = context.getBean(AgentWebServerService.class);
AutomatorConfig automatorConfig = AutomatorConfig.getInstance();
automatorConfig.setCloudServerUrl(agentConfig.getServerUrl());
automatorConfig.setTestCaseFetchWaitInterval(applicationConfig.getTestCaseFetchWaitInterval());
automatorConfig.setTestCaseDefaultMaxTries(applicationConfig.getTestCaseDefaultMaxTries());
automatorConfig.setAppBridge(cloudAppBridge);
automatorConfig.init();
AdbBridge adbBridge = context.getBean(AdbBridge.class);
MobileAutomationServer mobileAutomationServer = context.getBean(MobileAutomationServer.class);
AgentBrowserService agentBrowserService = context.getBean(AgentBrowserService.class);
AndroidDeviceListener androidDeviceListener = context.getBean(AndroidDeviceListener.class);
IosDeviceListener iosDeviceListener = context.getBean(IosDeviceListener.class);
AgentWebServer agentWebServer = context.getBean(AgentWebServer.class);
agentWebServer.startWebServerConnectors();
try {
agentBrowserService.sync();
} catch (AgentDeletedException e) {
log.info("-------------- Post App Context Failed Agent is deleted --------------");
}
androidDeviceListener.syncInitialDeviceStatus();
adbBridge.createBridge();
ExecutorService executorService = Executors.newSingleThreadExecutor();
executorService.submit(androidDeviceListener);
ExecutorService executorService1 = Executors.newSingleThreadExecutor();
executorService1.submit(iosDeviceListener);
mobileAutomationServer.start();
agentWebServerService.registerLocalAgent();
log.info("-------------- Post App Context Ready Actions Finished --------------");
}
Aggregations