Search in sources :

Example 1 with AgentWebServer

use of com.testsigma.agent.ws.server.AgentWebServer 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 --------------");
}
Also used : AgentWebServerService(com.testsigma.agent.services.AgentWebServerService) AdbBridge(com.testsigma.agent.mobile.android.AdbBridge) AndroidDeviceListener(com.testsigma.agent.mobile.android.AndroidDeviceListener) AutomatorConfig(com.testsigma.automator.AutomatorConfig) AgentDeletedException(com.testsigma.automator.exceptions.AgentDeletedException) MobileAutomationServer(com.testsigma.agent.mobile.MobileAutomationServer) AgentConfig(com.testsigma.agent.config.AgentConfig) CloudAppBridge(com.testsigma.agent.tasks.CloudAppBridge) ApplicationConfig(com.testsigma.agent.config.ApplicationConfig) ExecutorService(java.util.concurrent.ExecutorService) AgentBrowserService(com.testsigma.agent.services.AgentBrowserService) AgentWebServer(com.testsigma.agent.ws.server.AgentWebServer) IosDeviceListener(com.testsigma.agent.mobile.ios.IosDeviceListener)

Example 2 with AgentWebServer

use of com.testsigma.agent.ws.server.AgentWebServer in project testsigma by testsigmahq.

the class ApplicationEventHandler method runPostWebContextReadyActions.

public void runPostWebContextReadyActions(WebServerInitializedEvent event) {
    log.info("-------------- Post Web Context Ready Actions Started --------------");
    WebServerApplicationContext context = event.getApplicationContext();
    AgentWebServer agentWebServer = context.getBean(AgentWebServer.class);
    WebServer webServer = event.getWebServer();
    Server server = ((JettyWebServer) webServer).getServer();
    agentWebServer.setServer(server);
    log.info("-------------- Post Web Context Ready Actions Finished --------------");
}
Also used : MobileAutomationServer(com.testsigma.agent.mobile.MobileAutomationServer) JettyWebServer(org.springframework.boot.web.embedded.jetty.JettyWebServer) WebServer(org.springframework.boot.web.server.WebServer) AgentWebServer(com.testsigma.agent.ws.server.AgentWebServer) Server(org.eclipse.jetty.server.Server) JettyWebServer(org.springframework.boot.web.embedded.jetty.JettyWebServer) WebServer(org.springframework.boot.web.server.WebServer) AgentWebServer(com.testsigma.agent.ws.server.AgentWebServer) WebServerApplicationContext(org.springframework.boot.web.context.WebServerApplicationContext) AgentWebServer(com.testsigma.agent.ws.server.AgentWebServer) JettyWebServer(org.springframework.boot.web.embedded.jetty.JettyWebServer)

Aggregations

MobileAutomationServer (com.testsigma.agent.mobile.MobileAutomationServer)2 AgentWebServer (com.testsigma.agent.ws.server.AgentWebServer)2 AgentConfig (com.testsigma.agent.config.AgentConfig)1 ApplicationConfig (com.testsigma.agent.config.ApplicationConfig)1 AdbBridge (com.testsigma.agent.mobile.android.AdbBridge)1 AndroidDeviceListener (com.testsigma.agent.mobile.android.AndroidDeviceListener)1 IosDeviceListener (com.testsigma.agent.mobile.ios.IosDeviceListener)1 AgentBrowserService (com.testsigma.agent.services.AgentBrowserService)1 AgentWebServerService (com.testsigma.agent.services.AgentWebServerService)1 CloudAppBridge (com.testsigma.agent.tasks.CloudAppBridge)1 AutomatorConfig (com.testsigma.automator.AutomatorConfig)1 AgentDeletedException (com.testsigma.automator.exceptions.AgentDeletedException)1 ExecutorService (java.util.concurrent.ExecutorService)1 Server (org.eclipse.jetty.server.Server)1 WebServerApplicationContext (org.springframework.boot.web.context.WebServerApplicationContext)1 JettyWebServer (org.springframework.boot.web.embedded.jetty.JettyWebServer)1 WebServer (org.springframework.boot.web.server.WebServer)1