Esempio n. 1
0
  public static void main(String[] args) throws IOException {
    IdeArguments ideArguments = IdeArguments.parse(args);
    Main main = new Main(ideArguments.getFileStorage());

    ServiceProvider serviceProvider =
        new DefaultServiceProvider(
            ideArguments,
            main.reportFolder,
            main.taskResultsStorage,
            main.scheduledExecutorService);
    main.initWebServer(serviceProvider, ideArguments);
  }
Esempio n. 2
0
  protected void initWebServer(ServiceProvider serviceProvider, IdeArguments ideArguments) {
    port(ideArguments.getPort());
    staticFileLocation("/public");
    externalStaticFileLocation(staticFolderForSpark);
    System.out.println("Reports are in: " + reportFolder);

    new DeviceController(serviceProvider.deviceService());
    new DomSnapshotController(serviceProvider.domSnapshotService());
    new FileBrowserController(serviceProvider.fileBrowserService());
    new SettingsController(serviceProvider.settingsService());
    new ProfilesController(serviceProvider.profilesService(), serviceProvider.settingsService());
    new TaskResultController(serviceProvider.taskResultService());
    new TesterController(serviceProvider.testerService());
    new HelpController();

    scheduledExecutorService.scheduleAtFixedRate(
        new TaskResultsStorageCleanupJob(
            taskResultsStorage,
            ideArguments.getKeepLastResults(),
            ideArguments.getZombieResultsTimeout(),
            reportFolder),
        ideArguments.getCleanupPeriodInMinutes(),
        ideArguments.getCleanupPeriodInMinutes(),
        TimeUnit.MINUTES);

    if (ideArguments.getProfile() != null) {
      serviceProvider.profilesService().loadProfile(ideArguments.getProfile());
    }
  }