Search in sources :

Example 76 with LinkedHashSet

use of java.util.LinkedHashSet in project intellij-community by JetBrains.

the class TaskProjectConfiguration method getState.

public TaskProjectConfiguration getState() {
    LinkedHashSet<SharedServer> set = new LinkedHashSet<>(this.servers);
    for (TaskRepository repository : myManager.getAllRepositories()) {
        if (repository.isShared()) {
            SharedServer server = new SharedServer();
            server.type = repository.getRepositoryType().getName();
            server.url = repository.getUrl();
            set.add(server);
        }
    }
    servers.clear();
    servers.addAll(set);
    return this;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) TaskRepository(com.intellij.tasks.TaskRepository)

Example 77 with LinkedHashSet

use of java.util.LinkedHashSet in project intellij-community by JetBrains.

the class GrFieldNameSuggester method suggestNames.

@NotNull
public LinkedHashSet<String> suggestNames() {
    final GrExpression expression = myContext.getExpression();
    final GrVariable var = myContext.getVar();
    final StringPartInfo stringPart = myContext.getStringPart();
    if (expression != null) {
        return new LinkedHashSet<>(Arrays.asList(GroovyNameSuggestionUtil.suggestVariableNames(expression, myValidator, myForStatic)));
    } else if (stringPart != null) {
        return new LinkedHashSet<>(Arrays.asList(GroovyNameSuggestionUtil.suggestVariableNames(stringPart.getLiteral(), myValidator, myForStatic)));
    } else {
        assert var != null;
        return new LinkedHashSet<>(Arrays.asList(GroovyNameSuggestionUtil.suggestVariableNameByType(var.getType(), myValidator)));
    }
}
Also used : GrVariable(org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable) LinkedHashSet(java.util.LinkedHashSet) GrExpression(org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression) StringPartInfo(org.jetbrains.plugins.groovy.refactoring.introduce.StringPartInfo) NotNull(org.jetbrains.annotations.NotNull)

Example 78 with LinkedHashSet

use of java.util.LinkedHashSet in project intellij-community by JetBrains.

the class AbstractTestNGPatternConfigurationProducer method setupConfigurationFromContext.

@Override
protected boolean setupConfigurationFromContext(TestNGConfiguration configuration, ConfigurationContext context, Ref<PsiElement> sourceElement) {
    final LinkedHashSet<String> classes = new LinkedHashSet<>();
    final PsiElement element = checkPatterns(context, classes);
    if (element == null) {
        return false;
    }
    sourceElement.set(element);
    final TestData data = configuration.getPersistantData();
    data.setPatterns(classes);
    data.TEST_OBJECT = TestType.PATTERN.getType();
    data.setScope(setupPackageConfiguration(context, configuration, data.getScope()));
    configuration.setGeneratedName();
    setupConfigurationParamName(configuration, context.getLocation());
    return true;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) TestData(com.theoryinpractice.testng.model.TestData) PsiElement(com.intellij.psi.PsiElement)

Example 79 with LinkedHashSet

use of java.util.LinkedHashSet in project intellij-community by JetBrains.

the class TestsPattern method createSearchingForTestsTask.

@Override
public SearchForTestsTask createSearchingForTestsTask() {
    final JUnitConfiguration.Data data = getConfiguration().getPersistentData();
    final Project project = getConfiguration().getProject();
    final Set<String> classNames = new LinkedHashSet<>();
    for (String className : data.getPatterns()) {
        final PsiClass psiClass = getTestClass(project, className);
        if (psiClass != null && JUnitUtil.isTestClass(psiClass)) {
            classNames.add(className);
        }
    }
    if (classNames.size() == data.getPatterns().size()) {
        return new SearchForTestsTask(project, myServerSocket) {

            @Override
            protected void search() throws ExecutionException {
                final Function<String, String> nameFunction = StringUtil.isEmpty(data.METHOD_NAME) ? FunctionUtil.<String>id() : (Function<String, String>) className -> className;
                addClassesListToJavaParameters(classNames, nameFunction, "", false, getJavaParameters());
            }

            @Override
            protected void onFound() {
            }
        };
    }
    return super.createSearchingForTestsTask();
}
Also used : LinkedHashSet(java.util.LinkedHashSet) RuntimeConfigurationException(com.intellij.execution.configurations.RuntimeConfigurationException) ExecutionException(com.intellij.execution.ExecutionException) StringUtil(com.intellij.openapi.util.text.StringUtil) RefactoringElementListener(com.intellij.refactoring.listeners.RefactoringElementListener) GlobalSearchScope(com.intellij.psi.search.GlobalSearchScope) Set(java.util.Set) JavaExecutionUtil(com.intellij.execution.JavaExecutionUtil) Nullable(org.jetbrains.annotations.Nullable) ExecutionEnvironment(com.intellij.execution.runners.ExecutionEnvironment) RefactoringElementListenerComposite(com.intellij.refactoring.listeners.RefactoringElementListenerComposite) Function(com.intellij.util.Function) SearchForTestsTask(com.intellij.execution.testframework.SearchForTestsTask) Project(com.intellij.openapi.project.Project) com.intellij.psi(com.intellij.psi) FunctionUtil(com.intellij.util.FunctionUtil) CantRunException(com.intellij.execution.CantRunException) RuntimeConfigurationWarning(com.intellij.execution.configurations.RuntimeConfigurationWarning) Module(com.intellij.openapi.module.Module) LinkedHashSet(java.util.LinkedHashSet) Project(com.intellij.openapi.project.Project) SearchForTestsTask(com.intellij.execution.testframework.SearchForTestsTask)

Example 80 with LinkedHashSet

use of java.util.LinkedHashSet in project intellij-community by JetBrains.

the class JUnitConfigurationModel method applyTo.

private void applyTo(final JUnitConfiguration.Data data, final Module module) {
    final String testObject = getTestObject();
    final String className = getJUnitTextValue(CLASS);
    data.TEST_OBJECT = testObject;
    if (testObject != JUnitConfiguration.TEST_PACKAGE && testObject != JUnitConfiguration.TEST_PATTERN && testObject != JUnitConfiguration.TEST_DIRECTORY && testObject != JUnitConfiguration.TEST_CATEGORY && testObject != JUnitConfiguration.BY_SOURCE_CHANGES) {
        try {
            data.METHOD_NAME = getJUnitTextValue(METHOD);
            final PsiClass testClass = !myProject.isDefault() && !StringUtil.isEmptyOrSpaces(className) ? JUnitUtil.findPsiClass(className, module, myProject) : null;
            if (testClass != null && testClass.isValid()) {
                data.setMainClass(testClass);
            } else {
                data.MAIN_CLASS_NAME = className;
            }
        } catch (ProcessCanceledException | IndexNotReadyException e) {
            data.MAIN_CLASS_NAME = className;
        }
    } else if (testObject != JUnitConfiguration.BY_SOURCE_CHANGES) {
        if (testObject == JUnitConfiguration.TEST_PACKAGE) {
            data.PACKAGE_NAME = getJUnitTextValue(ALL_IN_PACKAGE);
        } else if (testObject == JUnitConfiguration.TEST_DIRECTORY) {
            data.setDirName(getJUnitTextValue(DIR));
        } else if (testObject == JUnitConfiguration.TEST_CATEGORY) {
            data.setCategoryName(getJUnitTextValue(CATEGORY));
        } else {
            final LinkedHashSet<String> set = new LinkedHashSet<>();
            final String[] patterns = getJUnitTextValue(PATTERN).split("\\|\\|");
            for (String pattern : patterns) {
                if (pattern.length() > 0) {
                    set.add(pattern);
                }
            }
            data.setPatterns(set);
        }
        data.MAIN_CLASS_NAME = "";
        data.METHOD_NAME = "";
    }
}
Also used : LinkedHashSet(java.util.LinkedHashSet) PsiClass(com.intellij.psi.PsiClass) IndexNotReadyException(com.intellij.openapi.project.IndexNotReadyException) ProcessCanceledException(com.intellij.openapi.progress.ProcessCanceledException)

Aggregations

LinkedHashSet (java.util.LinkedHashSet)3111 ArrayList (java.util.ArrayList)632 Set (java.util.Set)410 HashSet (java.util.HashSet)334 HashMap (java.util.HashMap)312 Map (java.util.Map)284 List (java.util.List)269 File (java.io.File)266 LinkedHashMap (java.util.LinkedHashMap)257 IOException (java.io.IOException)240 Test (org.junit.Test)239 LinkedList (java.util.LinkedList)139 Collection (java.util.Collection)103 URL (java.net.URL)83 ProcessResult (org.asqatasun.entity.audit.ProcessResult)76 Iterator (java.util.Iterator)73 SourceCodeRemark (org.asqatasun.entity.audit.SourceCodeRemark)73 TreeMap (java.util.TreeMap)70 TreeSet (java.util.TreeSet)70 Collectors (java.util.stream.Collectors)69