Search in sources :

Example 1 with TestSearchScope

use of com.intellij.execution.testframework.TestSearchScope in project intellij-community by JetBrains.

the class TestNGConfigurationEditor method resetEditorFrom.

@Override
protected void resetEditorFrom(@NotNull TestNGConfiguration config) {
    this.config = config;
    model.reset(config);
    commonJavaParameters.reset(config);
    getModuleSelector().reset(config);
    TestData data = config.getPersistantData();
    TestSearchScope scope = data.getScope();
    if (scope == TestSearchScope.SINGLE_MODULE) {
        packagesInModule.setSelected(true);
    } else if (scope == TestSearchScope.MODULE_WITH_DEPENDENCIES) {
        packagesAcrossModules.setSelected(true);
    } else {
        packagesInProject.setSelected(true);
    }
    evaluateModuleClassPath();
    alternateJDK.setPathOrName(config.ALTERNATIVE_JRE_PATH, config.ALTERNATIVE_JRE_PATH_ENABLED);
    propertiesList.clear();
    propertiesList.addAll(data.TEST_PROPERTIES.entrySet());
    propertiesTableModel.setParameterList(propertiesList);
    listenerModel.setListenerList(data.TEST_LISTENERS);
    myUseDefaultReportersCheckBox.setSelected(data.USE_DEFAULT_REPORTERS);
}
Also used : TestSearchScope(com.intellij.execution.testframework.TestSearchScope)

Example 2 with TestSearchScope

use of com.intellij.execution.testframework.TestSearchScope in project intellij-community by JetBrains.

the class TestNGTestPackage method fillTestObjects.

@Override
public void fillTestObjects(Map<PsiClass, Map<PsiMethod, List<String>>> classes) throws CantRunException {
    final String packageName = myConfig.getPersistantData().getPackageName();
    PsiPackage psiPackage = ApplicationManager.getApplication().runReadAction(new Computable<PsiPackage>() {

        @Nullable
        public PsiPackage compute() {
            return JavaPsiFacade.getInstance(myConfig.getProject()).findPackage(packageName);
        }
    });
    if (psiPackage == null) {
        throw CantRunException.packageNotFound(packageName);
    } else {
        TestSearchScope scope = myConfig.getPersistantData().getScope();
        //TODO we should narrow this down by module really, if that's what's specified
        SourceScope sourceScope = scope.getSourceScope(myConfig);
        TestClassFilter projectFilter = new TestClassFilter(sourceScope != null ? sourceScope.getGlobalSearchScope() : GlobalSearchScope.projectScope(myConfig.getProject()), myConfig.getProject(), true, true);
        TestClassFilter filter = projectFilter.intersectionWith(PackageScope.packageScope(psiPackage, true));
        calculateDependencies(null, classes, getSearchScope(), TestNGUtil.getAllTestClasses(filter, false));
        if (classes.size() == 0) {
            throw new CantRunException("No tests found in the package \"" + packageName + '\"');
        }
    }
}
Also used : CantRunException(com.intellij.execution.CantRunException) SourceScope(com.intellij.execution.testframework.SourceScope) TestSearchScope(com.intellij.execution.testframework.TestSearchScope) Nullable(org.jetbrains.annotations.Nullable)

Example 3 with TestSearchScope

use of com.intellij.execution.testframework.TestSearchScope in project intellij-community by JetBrains.

the class JUnitConfigurable method resetEditorFrom.

public void resetEditorFrom(@NotNull final JUnitConfiguration configuration) {
    final int count = configuration.getRepeatCount();
    myRepeatCountField.setText(String.valueOf(count));
    myRepeatCountField.setEnabled(count > 1);
    myRepeatCb.setSelectedItem(configuration.getRepeatMode());
    myModel.reset(configuration);
    myChangeListLabeledComponent.getComponent().setSelectedItem(configuration.getPersistentData().getChangeList());
    myCommonJavaParameters.reset(configuration);
    getModuleSelector().reset(configuration);
    final TestSearchScope scope = configuration.getPersistentData().getScope();
    if (scope == TestSearchScope.SINGLE_MODULE) {
        mySingleModuleScope.setSelected(true);
    } else if (scope == TestSearchScope.MODULE_WITH_DEPENDENCIES) {
        myModuleWDScope.setSelected(true);
    } else {
        myWholeProjectScope.setSelected(true);
    }
    myJrePathEditor.setPathOrName(configuration.getAlternativeJrePath(), configuration.isAlternativeJrePathEnabled());
    myForkCb.setSelectedItem(configuration.getForkMode());
}
Also used : TestSearchScope(com.intellij.execution.testframework.TestSearchScope)

Aggregations

TestSearchScope (com.intellij.execution.testframework.TestSearchScope)3 CantRunException (com.intellij.execution.CantRunException)1 SourceScope (com.intellij.execution.testframework.SourceScope)1 Nullable (org.jetbrains.annotations.Nullable)1