Package com.google.jstestdriver.idea.execution.settings

Examples of com.google.jstestdriver.idea.execution.settings.JstdRunSettings


    return tabbedPane;
  }

  @Override
  protected void resetEditorFrom(JstdRunConfiguration runConfiguration) {
    JstdRunSettings runSettings = runConfiguration.getRunSettings();
    for (RunSettingsSection section : myTabSections.values()) {
      section.resetFrom(runSettings);
    }
  }
View Full Code Here


  }

  @Override
  public void readExternal(Element element) throws InvalidDataException {
    super.readExternal(element);
    JstdRunSettings runSettings = JstdRunSettingsSerializationUtils.readFromXml(element);
    setRunSettings(runSettings);
  }
View Full Code Here

  @NotNull
  @Override
  protected AsyncResult<RunProfileStarter> prepare(@NotNull final ExecutionEnvironment environment, @NotNull RunProfileState state) throws ExecutionException {
    JstdRunProfileState jstdState = JstdRunProfileState.cast(state);
    final JstdRunSettings runSettings = jstdState.getRunSettings();
    if (runSettings.isExternalServerType()) {
      throw new ExecutionException("Local JsTestDriver server running in IDE required for tests debugging");
    }
    JstdToolWindowManager jstdToolWindowManager = JstdToolWindowManager.getInstance(environment.getProject());
    jstdToolWindowManager.setAvailable(true);
    JstdServer server = JstdServerRegistry.getInstance().getServer();
View Full Code Here

                                                                         @Nullable PsiElement element) {
    VirtualFile fileAtElement = PsiUtilBase.asVirtualFile(element);
    if (fileAtElement == null) {
      return null;
    }
    JstdRunSettings settings = configuration.getRunSettings();
    String path = fileAtElement.getPath();
    if (settings.getTestType() == TestType.ALL_CONFIGS_IN_DIRECTORY) {
      String allInDirectory = FileUtil.toSystemIndependentName(settings.getDirectory());
      if (allInDirectory.equals(path)) {
        return new FilePathRefactoringElementListener(configuration, false, false, true);
      }
    } else {
      String jsFilePath = FileUtil.toSystemIndependentName(settings.getJsFilePath());
      if (jsFilePath.equals(path)) {
        return new FilePathRefactoringElementListener(configuration, false, true, false);
      }
      String configFilePath = FileUtil.toSystemIndependentName(settings.getConfigFile());
      if (configFilePath.equals(path)) {
        return new FilePathRefactoringElementListener(configuration, true, false, false);
      }
    }
    return null;
View Full Code Here

  @Nullable
  private static JstdRunSettings buildRunSettingsContext(@Nullable Location<?> location) {
    if (location != null) {
      PsiElement element = location.getPsiElement();
      JstdRunSettings runSettings = findJstdRunSettings(element);
      if (runSettings != null) {
        return runSettings;
      }
    }
    return null;
View Full Code Here

  }

  @Nullable
  private static JstdRunSettings findJstdRunSettings(@NotNull PsiElement element) {
    for (JstdRunSettingsProvider jstdRunSettingsProvider : RUN_SETTINGS_PROVIDERS) {
      JstdRunSettings runSettings = jstdRunSettingsProvider.provideSettings(element);
      if (runSettings != null) {
        return runSettings;
      }
    }
    return null;
View Full Code Here

      if (!JstdSettingsUtil.areJstdConfigFilesInProjectCached(project)) {
        return false;
      }
    }
    long startTimeNano = System.nanoTime();
    @SuppressWarnings({"unchecked"})
    JstdRunSettings settings = buildRunSettingsContext(context.getLocation());
    if (settings == null) {
      logDoneCreateConfigurationByElement(startTimeNano, "1");
      return false;
    }

    if (settings.getConfigFile().isEmpty()) {
      JstdRunSettings clonedSettings = configuration.getRunSettings();
      JstdRunSettings.Builder builder = new JstdRunSettings.Builder(settings);
      builder.setConfigFile(clonedSettings.getConfigFile());
      settings = builder.build();
    }
    configuration.setRunSettings(settings);

    String configurationName = configuration.resetGeneratedName();
View Full Code Here

    return true;
  }

  @Override
  public boolean isConfigurationFromContext(JstdRunConfiguration configuration, ConfigurationContext context) {
    JstdRunSettings patternRunSettings = buildRunSettingsContext(context.getLocation());
    if (patternRunSettings == null) {
      return false;
    }
    JstdRunSettings candidateRunSettings = configuration.getRunSettings();
    TestType patternTestType = patternRunSettings.getTestType();
    if (patternTestType != candidateRunSettings.getTestType()) {
      return false;
    }
    if (patternTestType == TestType.ALL_CONFIGS_IN_DIRECTORY) {
      File dir1 = new File(patternRunSettings.getDirectory());
      File dir2 = new File(candidateRunSettings.getDirectory());
      if (dir1.isDirectory() && dir2.isDirectory() && FileUtil.filesEqual(dir1, dir2)) {
        return true;
      }
    } else if (patternTestType == TestType.CONFIG_FILE) {
      File configFilePattern = new File(patternRunSettings.getConfigFile());
      File configFileCandidate = new File(candidateRunSettings.getConfigFile());
      if (configFilePattern.isFile()
          && configFileCandidate.isFile()
          && FileUtil.filesEqual(configFilePattern, configFileCandidate)) {
        return true;
      }
    } else if (patternTestType == TestType.JS_FILE
               || patternTestType == TestType.TEST_CASE
               || patternTestType == TestType.TEST_METHOD) {
      File patternJsFile = new File(patternRunSettings.getJsFilePath());
      File candidateJsFile = new File(candidateRunSettings.getJsFilePath());
      boolean eq = candidateJsFile.isFile() && FileUtil.filesEqual(patternJsFile, candidateJsFile);
      if (patternTestType == TestType.TEST_CASE) {
        eq = eq && patternRunSettings.getTestCaseName().equals(candidateRunSettings.getTestCaseName());
      }
      if (patternTestType == TestType.TEST_METHOD) {
        eq = eq && patternRunSettings.getTestCaseName().equals(candidateRunSettings.getTestCaseName());
        eq = eq && patternRunSettings.getTestMethodName().equals(candidateRunSettings.getTestMethodName());
      }
      if (eq) {
        return true;
       }
    }
View Full Code Here

TOP

Related Classes of com.google.jstestdriver.idea.execution.settings.JstdRunSettings

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.