LazyRunConfigurationProducer — junit

This commit is contained in:
Vladimir Krivosheev
2018-12-13 16:50:38 +01:00
parent 41fb273196
commit 1034b51b3a
8 changed files with 41 additions and 91 deletions
+1 -1
View File
@@ -31,7 +31,7 @@
<version>1.0</version>
<vendor>JetBrains</vendor>
<extensions defaultExtensionNs="com.intellij">
<runConfigurationProducer implementation="com.intellij.execution.junit.AllInDirectoryConfigurationProducer"/>
<runConfigurationProducer implementation="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer"/>
<runConfigurationProducer implementation="com.intellij.execution.junit.AllInPackageConfigurationProducer"/>
<runConfigurationProducer implementation="com.intellij.execution.junit.PatternConfigurationProducer"/>
<runConfigurationProducer implementation="com.intellij.execution.junit.TestInClassConfigurationProducer"/>
@@ -1,5 +1,4 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.execution.junit;
import com.intellij.execution.actions.ConfigurationContext;
@@ -16,13 +15,18 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiPackage;
import org.jetbrains.jps.model.java.JavaSourceRootType;
public abstract class AbstractAllInDirectoryConfigurationProducer extends JUnitConfigurationProducer {
public class AbstractAllInDirectoryConfigurationProducer extends JUnitConfigurationProducer {
/**
* @deprecated Override {@link #getConfigurationFactory()}.
*/
@Deprecated
protected AbstractAllInDirectoryConfigurationProducer(ConfigurationType configurationType) {
super(configurationType);
}
public AbstractAllInDirectoryConfigurationProducer() {
}
@Override
protected boolean isApplicableTestType(String type, ConfigurationContext context) {
return JUnitConfiguration.TEST_DIRECTORY.equals(type);
@@ -1,5 +1,4 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.execution.junit;
import com.intellij.execution.actions.ConfigurationContext;
@@ -11,13 +10,18 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiPackage;
import com.siyeh.ig.junit.JUnitCommonClassNames;
public abstract class AbstractAllInPackageConfigurationProducer extends JUnitConfigurationProducer {
/**
* @deprecated Override {@link #getConfigurationFactory()}.
*/
@Deprecated
protected AbstractAllInPackageConfigurationProducer(ConfigurationType configurationType) {
super(configurationType);
}
protected AbstractAllInPackageConfigurationProducer() {
}
@Override
protected boolean isApplicableTestType(String type, ConfigurationContext context) {
return JUnitConfiguration.TEST_PACKAGE.equals(type);
@@ -1,22 +1,9 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.execution.junit;
@SuppressWarnings("unused")
@Deprecated
public class AllInDirectoryConfigurationProducer extends AbstractAllInDirectoryConfigurationProducer {
public AllInDirectoryConfigurationProducer() {
super(JUnitConfigurationType.getInstance());
}
}
@@ -1,22 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.execution.junit;
public class AllInPackageConfigurationProducer extends AbstractAllInPackageConfigurationProducer {
public AllInPackageConfigurationProducer() {
super(JUnitConfigurationType.getInstance());
}
}
@@ -1,31 +1,27 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.execution.junit;
import com.intellij.execution.configurations.ConfigurationFactory;
import com.intellij.execution.configurations.ConfigurationType;
import com.intellij.execution.testframework.AbstractJavaTestConfigurationProducer;
import org.jetbrains.annotations.NotNull;
public abstract class JUnitConfigurationProducer extends AbstractJavaTestConfigurationProducer<JUnitConfiguration> implements Cloneable {
public JUnitConfigurationProducer() {
super(JUnitConfigurationType.getInstance());
super();
}
/**
* @deprecated Override {@link #getConfigurationFactory()}.
*/
@Deprecated
protected JUnitConfigurationProducer(ConfigurationType configurationType) {
super(configurationType);
}
@NotNull
@Override
public ConfigurationFactory getConfigurationFactory() {
return JUnitConfigurationType.getInstance().getConfigurationFactories()[0];
}
}
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.execution.junit;
import com.intellij.execution.actions.ConfigurationContext;
@@ -23,11 +9,8 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMember;
import org.jetbrains.annotations.NotNull;
public class TestInClassConfigurationProducer extends JUnitConfigurationProducer {
public final class TestInClassConfigurationProducer extends JUnitConfigurationProducer {
private final JUnitInClassConfigurationProducerDelegate myDelegate = new JUnitInClassConfigurationProducerDelegate();
public TestInClassConfigurationProducer() {
super(JUnitConfigurationType.getInstance());
}
@Override
protected boolean setupConfigurationFromContext(JUnitConfiguration configuration,
@@ -1,5 +1,4 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.execution.junit;
import com.intellij.execution.actions.ConfigurationContext;
@@ -16,13 +15,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.Objects;
public class UniqueIdConfigurationProducer extends JUnitConfigurationProducer {
protected UniqueIdConfigurationProducer() {
super(JUnitConfigurationType.getInstance());
}
@Override
protected boolean setupConfigurationFromContext(JUnitConfiguration configuration,
ConfigurationContext context,
@@ -50,10 +43,10 @@ public class UniqueIdConfigurationProducer extends JUnitConfigurationProducer {
RunConfiguration runConfiguration = dataContext.getData(RunConfiguration.DATA_KEY);
if (!(runConfiguration instanceof JUnitConfiguration)) return null;
Module module = ((JUnitConfiguration)runConfiguration).getConfigurationModule().getModule();
GlobalSearchScope searchScope =
module != null ? GlobalSearchScope.moduleWithDependenciesScope(module) : GlobalSearchScope.projectScope(context.getProject());
return
return
Arrays.stream(testProxies).map(testProxy -> TestUniqueId.getEffectiveNodeId(testProxy, context.getProject(), searchScope))
.filter(Objects::nonNull)
.toArray(String[]::new);