mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 11:50:54 +07:00
some tests from execution-tests moved to community
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<orderEntry type="module" module-name="java-impl" />
|
||||
<orderEntry type="module" module-name="idea-ui" />
|
||||
<orderEntry type="module" module-name="community-resources" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="execution-impl" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="execution-impl" />
|
||||
<orderEntry type="module" module-name="platform-api" />
|
||||
<orderEntry type="library" name="Velocity" level="project" />
|
||||
<orderEntry type="module" module-name="java-i18n" />
|
||||
@@ -29,6 +29,7 @@
|
||||
<orderEntry type="module" module-name="platform-tests" scope="TEST" />
|
||||
<orderEntry type="module" module-name="java-indexing-api" scope="TEST" />
|
||||
<orderEntry type="module" module-name="external-system-impl" scope="RUNTIME" />
|
||||
<orderEntry type="module" module-name="junit_rt" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package apackage;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class SampleClass extends TestCase {
|
||||
public void test1() {}
|
||||
|
||||
public static void main(String[] args){ }
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
package junit.framework;
|
||||
public class TestCase {}
|
||||
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
package junit.framework;
|
||||
public class ThirdPartyClass extends TestCase {}
|
||||
@@ -0,0 +1,6 @@
|
||||
package test1;
|
||||
|
||||
import junit.framework.ThirdPartyClass;
|
||||
|
||||
public class DerivedTest extends ThirdPartyClass {
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package test1;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class InnerTest {
|
||||
public static class Inner extends TestCase {
|
||||
public void test() {}
|
||||
public static void main(String[] args) {}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package test1;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class TestA extends TestCase {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package test2;
|
||||
|
||||
public class NotATest {
|
||||
static class InnerApplication {
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package test1;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class TestA extends TestCase {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package test2;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class Test2 extends TestCase {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package test1;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class TestB extends TestCase {}
|
||||
@@ -0,0 +1,3 @@
|
||||
package test2;
|
||||
|
||||
public class NotATest2 {}
|
||||
@@ -0,0 +1,3 @@
|
||||
public class Application {
|
||||
public static void main(String[] args){}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class TestApplication extends TestCase {
|
||||
public void test() { }
|
||||
public static void main(String[] args){ }
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package test1;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class Test5 extends TestCase {
|
||||
public void test() {}
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
package com.intellij.execution;
|
||||
|
||||
import com.intellij.execution.actions.ConfigurationContext;
|
||||
import com.intellij.execution.configurations.RuntimeConfiguration;
|
||||
import com.intellij.execution.junit.JUnitConfiguration;
|
||||
import com.intellij.execution.junit.RuntimeConfigurationProducer;
|
||||
import com.intellij.openapi.actionSystem.DataConstants;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ex.PathManagerEx;
|
||||
import com.intellij.openapi.module.*;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.roots.ModuleRootModificationUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.testFramework.IdeaTestCase;
|
||||
import com.intellij.testFramework.MapDataContext;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.testFramework.TempFiles;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class BaseConfigurationTestCase extends IdeaTestCase {
|
||||
protected TempFiles myTempFiles;
|
||||
private final List<Module> myModulesToDispose = new ArrayList<Module>();
|
||||
protected static final String MOCK_JUNIT = "mock JUnit";
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
myTempFiles = new TempFiles(myFilesToDelete);
|
||||
}
|
||||
|
||||
protected void addModule(String path) throws IOException {
|
||||
addModule(path, true);
|
||||
}
|
||||
|
||||
protected void addModule(String path, boolean addSource) throws IOException {
|
||||
VirtualFile module1Content = findFile(path);
|
||||
createModule(module1Content, addSource);
|
||||
}
|
||||
|
||||
protected void createModule(VirtualFile module1Content, boolean addSource) throws IOException {
|
||||
Module module = createEmptyModule();
|
||||
if (addSource) {
|
||||
PsiTestUtil.addSourceRoot(module, module1Content, true);
|
||||
}
|
||||
else {
|
||||
PsiTestUtil.addContentRoot(module, module1Content);
|
||||
}
|
||||
|
||||
VirtualFile mockJUnit = findFile(MOCK_JUNIT);
|
||||
ModuleRootModificationUtil.addModuleLibrary(module, mockJUnit.getUrl());
|
||||
ModuleRootModificationUtil.setModuleSdk(module, ModuleRootManager.getInstance(myModule).getSdk());
|
||||
GlobalSearchScope scope = GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module);
|
||||
VirtualFile testCase = mockJUnit.findChild("junit").findChild("framework").findChild("TestCase.java");
|
||||
assertNotNull(testCase);
|
||||
assertTrue(scope.contains(testCase));
|
||||
Module missingModule = createTempModule();
|
||||
addDependency(module, missingModule);
|
||||
ModuleManager.getInstance(myProject).disposeModule(missingModule);
|
||||
}
|
||||
|
||||
protected Module createEmptyModule() throws IOException {
|
||||
Module module = createTempModule();
|
||||
myModulesToDispose.add(module);
|
||||
return module;
|
||||
}
|
||||
|
||||
private Module createTempModule() throws IOException {
|
||||
return createTempModule(myTempFiles, myProject);
|
||||
}
|
||||
|
||||
public static Module createTempModule(TempFiles tempFiles, final Project project) {
|
||||
final String tempPath = tempFiles.createTempPath();
|
||||
final Module[] module = new Module[1];
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
module[0] = ModuleManager.getInstance(project).newModule(tempPath, StdModuleTypes.JAVA.getId());
|
||||
}
|
||||
});
|
||||
return module[0];
|
||||
}
|
||||
|
||||
protected static VirtualFile findFile(String path) {
|
||||
String filePath = PathManagerEx.getTestDataPath() + File.separator + "junit" + File.separator + "configurations" +
|
||||
File.separator + path;
|
||||
return LocalFileSystem.getInstance().findFileByPath(filePath.replace(File.separatorChar, '/'));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
myModulesToDispose.clear();
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
protected void disposeModule(Module module) {
|
||||
assertTrue(myModulesToDispose.remove(module));
|
||||
ModuleManager.getInstance(myProject).disposeModule(module);
|
||||
}
|
||||
|
||||
protected Module getModule1() {
|
||||
return getModule(0);
|
||||
}
|
||||
|
||||
protected Module getModule(int index) {
|
||||
return myModulesToDispose.get(index);
|
||||
}
|
||||
|
||||
protected Module getModule2() {
|
||||
return getModule(1);
|
||||
}
|
||||
|
||||
protected Module getModule4() {
|
||||
return getModule(3);
|
||||
}
|
||||
|
||||
protected Module getModule3() {
|
||||
return getModule(2);
|
||||
}
|
||||
|
||||
protected PsiClass findClass(Module module, String qualifiedName) {
|
||||
return findClass(qualifiedName, GlobalSearchScope.moduleScope(module));
|
||||
}
|
||||
|
||||
protected PsiClass findClass(String qualifiedName, GlobalSearchScope scope) {
|
||||
return JavaPsiFacade.getInstance(myProject).findClass(qualifiedName, scope);
|
||||
}
|
||||
|
||||
protected JUnitConfiguration createJUnitConfiguration(final PsiElement psiElement,
|
||||
final Class producerClass,
|
||||
final MapDataContext dataContext) {
|
||||
ConfigurationContext context = createContext(psiElement, dataContext);
|
||||
RuntimeConfigurationProducer producer = RuntimeConfigurationProducer.getInstance(producerClass);
|
||||
assert producer != null;
|
||||
producer = producer.createProducer((Location)dataContext.getData(Location.LOCATION), context);
|
||||
RunnerAndConfigurationSettings settings = context.updateConfiguration(producer);
|
||||
assert settings != null;
|
||||
return (JUnitConfiguration)settings.getConfiguration();
|
||||
}
|
||||
|
||||
protected final <T extends RuntimeConfiguration> T createConfiguration(PsiElement psiElement) {
|
||||
return (T)createConfiguration(psiElement, new MapDataContext());
|
||||
}
|
||||
|
||||
protected <T extends RuntimeConfiguration> T createConfiguration(PsiElement psiElement, MapDataContext dataContext) {
|
||||
ConfigurationContext context = createContext(psiElement, dataContext);
|
||||
RunnerAndConfigurationSettings settings = context.getConfiguration();
|
||||
return settings == null ? null : (T)settings.getConfiguration();
|
||||
}
|
||||
|
||||
public ConfigurationContext createContext(PsiElement psiClass) {
|
||||
MapDataContext dataContext = new MapDataContext();
|
||||
return createContext(psiClass, dataContext);
|
||||
}
|
||||
|
||||
public ConfigurationContext createContext(PsiElement psiClass, MapDataContext dataContext) {
|
||||
dataContext.put(DataConstants.PROJECT, myProject);
|
||||
if (dataContext.getData(DataConstants.MODULE) == null) {
|
||||
dataContext.put(DataConstants.MODULE, ModuleUtilCore.findModuleForPsiElement(psiClass));
|
||||
}
|
||||
dataContext.put(Location.LOCATION, PsiLocation.fromPsiElement(psiClass));
|
||||
return ConfigurationContext.getFromContext(dataContext);
|
||||
}
|
||||
|
||||
protected void addDependency(Module module, Module dependency) {
|
||||
ModuleRootModificationUtil.addDependency(module, dependency);
|
||||
}
|
||||
|
||||
protected void checkPackage(String packageName, JUnitConfiguration configuration) {
|
||||
assertEquals(packageName, configuration.getPersistentData().getPackageName());
|
||||
}
|
||||
|
||||
protected void checkClassName(String className, JUnitConfiguration configuration) {
|
||||
assertEquals(className, configuration.getPersistentData().getMainClassName());
|
||||
}
|
||||
|
||||
protected void checkMethodName(String methodName, JUnitConfiguration configuration) {
|
||||
assertEquals(methodName, configuration.getPersistentData().getMethodName());
|
||||
}
|
||||
|
||||
protected void checkTestObject(String testObjectKey, JUnitConfiguration configuration) {
|
||||
assertEquals(testObjectKey, configuration.getPersistentData().TEST_OBJECT);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
package com.intellij.execution;
|
||||
|
||||
import com.intellij.execution.application.ApplicationConfiguration;
|
||||
import com.intellij.execution.configurations.RuntimeConfiguration;
|
||||
import com.intellij.execution.configurations.RuntimeConfigurationException;
|
||||
import com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl;
|
||||
import com.intellij.execution.junit.AllInPackageConfigurationProducer;
|
||||
import com.intellij.execution.junit.JUnitConfiguration;
|
||||
import com.intellij.execution.junit.JUnitConfigurationType;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.refactoring.PackageWrapper;
|
||||
import com.intellij.refactoring.move.moveClassesOrPackages.MoveClassesOrPackagesProcessor;
|
||||
import com.intellij.refactoring.move.moveClassesOrPackages.SingleSourceRootMoveDestination;
|
||||
import com.intellij.refactoring.move.moveMembers.MockMoveMembersOptions;
|
||||
import com.intellij.refactoring.move.moveMembers.MoveMembersProcessor;
|
||||
import com.intellij.refactoring.rename.RenameProcessor;
|
||||
import com.intellij.testFramework.MapDataContext;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class ConfigurationRefactoringsTest extends BaseConfigurationTestCase {
|
||||
private static final String APPLICATION_CODE = "public class Application {" +
|
||||
" public static void main(String[] args) {\n" +
|
||||
" }" +
|
||||
"}";
|
||||
private static final String TEST_CODE = "import junit.framework.TestCase;" +
|
||||
"public class ATest extends TestCase {" +
|
||||
"public static void test() {}" +
|
||||
"private void otherMethod() {}" +
|
||||
"}";
|
||||
private TestSources mySource;
|
||||
private static final String NOT_A_TEST = "public class NotATest {" +
|
||||
"public void test() {}" +
|
||||
"}";
|
||||
public void testRenameApplication() throws IOException {
|
||||
PsiClass psiClass = mySource.createClass("Application", APPLICATION_CODE);
|
||||
ApplicationConfiguration configuration = createConfiguration(psiClass);
|
||||
assertNotNull(configuration);
|
||||
rename(psiClass, "NewName");
|
||||
try {
|
||||
configuration.checkConfiguration();
|
||||
}
|
||||
catch (RuntimeConfigurationException e) {
|
||||
assertTrue("Unexpected ConfigurationException: " + e ,false);
|
||||
}
|
||||
assertEquals("NewName", configuration.MAIN_CLASS_NAME);
|
||||
}
|
||||
|
||||
public void testMoveApplication() throws IOException {
|
||||
PsiClass psiClass = mySource.createClass("Application", APPLICATION_CODE);
|
||||
ApplicationConfiguration configuration = createConfiguration(psiClass);
|
||||
move(psiClass, "pkg");
|
||||
try {
|
||||
configuration.checkConfiguration();
|
||||
}
|
||||
catch (RuntimeConfigurationException e) {
|
||||
assertTrue("Unexpected ConfigurationException: " + e ,false);
|
||||
}
|
||||
|
||||
assertEquals("pkg.Application", configuration.MAIN_CLASS_NAME);
|
||||
rename(JavaPsiFacade.getInstance(myProject).findPackage("pkg"), "pkg2");
|
||||
assertEquals("pkg2.Application", configuration.MAIN_CLASS_NAME);
|
||||
}
|
||||
|
||||
public void testRenameJUnitPackage() throws IOException {
|
||||
PsiPackage psiPackage = mySource.createPackage("pkg");
|
||||
JUnitConfiguration configuration = createJUnitConfiguration(psiPackage, AllInPackageConfigurationProducer.class, new MapDataContext());
|
||||
rename(psiPackage, "pkg2");
|
||||
checkPackage("pkg2", configuration);
|
||||
PsiPackage outter = mySource.createPackage("outterPkg");
|
||||
move(JavaPsiFacade.getInstance(myProject).findPackage("pkg2"), outter.getQualifiedName());
|
||||
checkPackage("outterPkg.pkg2", configuration);
|
||||
rename(outter, "outter2");
|
||||
checkPackage("outter2.pkg2", configuration);
|
||||
}
|
||||
|
||||
public void testRenameJUnitContainingPackage() throws IOException {
|
||||
PsiClass psiClass = mySource.createClass("ATest", TEST_CODE);
|
||||
JUnitConfiguration configuration = createConfiguration(psiClass);
|
||||
PsiPackage psiPackage = mySource.createPackage("pkg");
|
||||
move(psiClass, "pkg");
|
||||
checkClassName("pkg.ATest", configuration);
|
||||
rename(psiPackage, "newPkg");
|
||||
checkClassName("newPkg.ATest", configuration);
|
||||
psiPackage = mySource.findPackage("newPkg");
|
||||
|
||||
mySource.createPackage("pkg2");
|
||||
move(psiPackage, "pkg2");
|
||||
checkClassName("pkg2.newPkg.ATest", configuration);
|
||||
}
|
||||
|
||||
public void testRefactorTestMethod() throws IOException {
|
||||
PsiClass psiClass = mySource.createClass("ATest", TEST_CODE);
|
||||
PsiMethod testMethod = psiClass.findMethodsByName("test", false)[0];
|
||||
JUnitConfiguration configuration = createConfiguration(testMethod);
|
||||
rename(testMethod, "test1");
|
||||
checkMethodName("test1", configuration);
|
||||
checkClassName("ATest", configuration);
|
||||
assertEquals("ATest.test1", configuration.getName());
|
||||
move(psiClass, "pkg");
|
||||
checkClassName("pkg.ATest", configuration);
|
||||
psiClass = configuration.getConfigurationModule().findClass(configuration.getPersistentData().getMainClassName());
|
||||
rename(psiClass, "TestClassName");
|
||||
assertEquals("TestClassName.test1", configuration.getName());
|
||||
psiClass = configuration.getConfigurationModule().findClass(configuration.getPersistentData().getMainClassName());
|
||||
|
||||
PsiClass otherTest = mySource.createClass("ATest", TEST_CODE);
|
||||
HashSet<PsiMember> members = new HashSet<PsiMember>();
|
||||
members.add(psiClass.findMethodsByName("test1", false)[0]);
|
||||
moveMembers(otherTest, members);
|
||||
psiClass = configuration.getConfigurationModule().findClass(configuration.getPersistentData().getMainClassName());
|
||||
checkMethodName("test1", configuration);
|
||||
checkClassName("ATest", configuration);
|
||||
assertEquals("ATest.test1", configuration.getName());
|
||||
|
||||
PsiMethod otherMethod = psiClass.findMethodsByName("otherMethod", false)[0];
|
||||
rename(otherMethod, "newName");
|
||||
checkMethodName("test1", configuration);
|
||||
}
|
||||
|
||||
public void testRenameBadTestClass() throws IOException {
|
||||
PsiClass psiClass = mySource.createClass("NotATest", NOT_A_TEST);
|
||||
JUnitConfiguration configuration = new JUnitConfiguration("notATest", myProject, JUnitConfigurationType.getInstance().getConfigurationFactories()[0]);
|
||||
configuration.setMainClass(psiClass);
|
||||
configuration.setModule(configuration.getValidModules().iterator().next());
|
||||
|
||||
|
||||
checkConfigurationException("NotATest isn't test class", configuration);
|
||||
|
||||
RunManagerEx.getInstanceEx(myProject).setTemporaryConfiguration(new RunnerAndConfigurationSettingsImpl(null, configuration, false));
|
||||
rename(psiClass, "NotATest2");
|
||||
JUnitConfiguration.Data data = configuration.getPersistentData();
|
||||
assertEquals("NotATest2", data.getMainClassName());
|
||||
|
||||
data.METHOD_NAME = "test";
|
||||
data.TEST_OBJECT = JUnitConfiguration.TEST_METHOD;
|
||||
checkConfigurationException("Test method 'test' doesn't exist", configuration);
|
||||
rename(psiClass.findMethodsByName("test", false)[0], "test2");
|
||||
assertEquals("NotATest2", data.getMainClassName());
|
||||
assertEquals("test2", data.getMethodName());
|
||||
}
|
||||
|
||||
private void checkConfigurationException(String expectedExceptionMessage, JUnitConfiguration configuration) {
|
||||
try {
|
||||
configuration.checkConfiguration();
|
||||
}
|
||||
catch (RuntimeConfigurationException e) {
|
||||
assertEquals(expectedExceptionMessage, e.getLocalizedMessage());
|
||||
return;
|
||||
}
|
||||
assertTrue("ConfigurationException expected", false);
|
||||
}
|
||||
|
||||
public void testRefactorOtherClass() throws IOException {
|
||||
JUnitConfiguration configuration = createConfiguration(mySource.createClass("ATest", TEST_CODE));
|
||||
PsiClass psiClass = mySource.createClass("Application", APPLICATION_CODE);
|
||||
rename(psiClass, "NewName");
|
||||
checkClassName("ATest", configuration);
|
||||
mySource.createPackage("pkg");
|
||||
|
||||
psiClass = mySource.findClass("NewName");
|
||||
move(psiClass, "pkg");
|
||||
checkClassName("ATest", configuration);
|
||||
}
|
||||
|
||||
private void moveMembers(final PsiClass otherTest, final HashSet<PsiMember> members) {
|
||||
new WriteCommandAction(myProject) {
|
||||
@Override
|
||||
protected void run(final Result result) throws Throwable {
|
||||
MockMoveMembersOptions options = new MockMoveMembersOptions(otherTest.getQualifiedName(), members);
|
||||
new MoveMembersProcessor(myProject, null, options).run();
|
||||
}
|
||||
}.executeSilently();
|
||||
}
|
||||
|
||||
private void initModule() throws IOException {
|
||||
mySource.initModule();
|
||||
mySource.copyJdkFrom(myModule);
|
||||
mySource.addLibrary(findFile(MOCK_JUNIT));
|
||||
}
|
||||
|
||||
private void move(final PsiElement psiElement, String packageName) {
|
||||
VirtualFile pkgFile = mySource.createPackageDir(packageName);
|
||||
final PsiDirectory toDir = PsiManager.getInstance(myProject).findDirectory(pkgFile);
|
||||
new WriteCommandAction(myProject, psiElement.getContainingFile()) {
|
||||
@Override
|
||||
protected void run(final Result result) throws Throwable {
|
||||
new MoveClassesOrPackagesProcessor(myProject, new PsiElement[]{psiElement},
|
||||
new SingleSourceRootMoveDestination(
|
||||
PackageWrapper.create(JavaDirectoryService.getInstance().getPackage(toDir)), toDir),
|
||||
false, false, null).run();
|
||||
}
|
||||
}.executeSilently();
|
||||
}
|
||||
|
||||
private void rename(final PsiElement psiElement, final String newName) {
|
||||
new WriteCommandAction(myProject, psiElement.getContainingFile()) {
|
||||
@Override
|
||||
protected void run(final Result result) throws Throwable {
|
||||
new RenameProcessor(myProject, psiElement, newName, false, false).run();
|
||||
}
|
||||
}.executeSilently();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
mySource = new TestSources(myProject, myFilesToDelete);
|
||||
initModule();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
mySource.tearDown();
|
||||
mySource = null;
|
||||
super.tearDown(); //To change body of overriden methods use Options | File Templates.
|
||||
}
|
||||
|
||||
@Override
|
||||
protected <T extends RuntimeConfiguration> T createConfiguration(PsiElement psiClass, MapDataContext dataContext) {
|
||||
T configuration = (T)super.createConfiguration(psiClass, dataContext);
|
||||
RunManagerEx.getInstanceEx(myProject).setTemporaryConfiguration(new RunnerAndConfigurationSettingsImpl(null, configuration, false));
|
||||
return configuration;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected JUnitConfiguration createJUnitConfiguration(final PsiElement psiElement, final Class producerClass, final MapDataContext dataContext) {
|
||||
final JUnitConfiguration configuration = super.createJUnitConfiguration(psiElement, producerClass, dataContext);
|
||||
RunManagerEx.getInstanceEx(myProject).setTemporaryConfiguration(new RunnerAndConfigurationSettingsImpl(null, configuration, false));
|
||||
return configuration;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,572 @@
|
||||
package com.intellij.execution;
|
||||
|
||||
import com.intellij.execution.application.ApplicationConfigurable;
|
||||
import com.intellij.execution.application.ApplicationConfiguration;
|
||||
import com.intellij.execution.application.ApplicationConfigurationType;
|
||||
import com.intellij.execution.configurations.*;
|
||||
import com.intellij.execution.executors.DefaultRunExecutor;
|
||||
import com.intellij.execution.junit.*;
|
||||
import com.intellij.execution.junit2.configuration.JUnitConfigurable;
|
||||
import com.intellij.execution.junit2.configuration.JUnitConfigurationModel;
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.execution.testframework.TestSearchScope;
|
||||
import com.intellij.execution.ui.CommonJavaParametersPanel;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.CompilerModuleExtension;
|
||||
import com.intellij.openapi.roots.ContentEntry;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.roots.ModuleRootModificationUtil;
|
||||
import com.intellij.openapi.ui.LabeledComponent;
|
||||
import com.intellij.openapi.util.*;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.JarFileSystem;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.rt.execution.junit.JUnitStarter;
|
||||
import com.intellij.rt.execution.junit.segments.SegmentedOutputStream;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.MapDataContext;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.ui.EditorTextFieldWithBrowseButton;
|
||||
import com.intellij.util.Assertion;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import junit.framework.TestCase;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
|
||||
public class ConfigurationsTest extends BaseConfigurationTestCase {
|
||||
private final Assertion CHECK = new Assertion();
|
||||
|
||||
private Sdk myJdk;
|
||||
private static final String INNER_TEST_NAME = "test1.InnerTest.Inner";
|
||||
private static final String RT_INNER_TEST_NAME = "test1.InnerTest$Inner";
|
||||
private static final Executor MOCK_EXECUTOR = new DefaultRunExecutor() {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getId() {
|
||||
return "mock";
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
addModule("module1");
|
||||
addModule("module2");
|
||||
addModule("module3");
|
||||
assignJdk(getModule1());
|
||||
}
|
||||
|
||||
public void testCreateConfiguration() throws IOException, ExecutionException {
|
||||
Module module1 = getModule1();
|
||||
PsiClass psiClass = findTestA(module1);
|
||||
JUnitConfiguration configuration = createConfiguration(psiClass);
|
||||
assertEquals(Collections.singleton(module1), new HashSet(Arrays.asList(configuration.getModules())));
|
||||
checkClassName(psiClass.getQualifiedName(), configuration);
|
||||
assertEquals(psiClass.getName(), configuration.getName());
|
||||
checkTestObject(JUnitConfiguration.TEST_CLASS, configuration);
|
||||
Module module2 = getModule2();
|
||||
CHECK.compareUnordered(new Module[]{module1, module2}, configuration.getValidModules());
|
||||
|
||||
PsiClass innerTest = findClass(module1, INNER_TEST_NAME);
|
||||
configuration = createJUnitConfiguration(innerTest, TestClassConfigurationProducer.class, new MapDataContext());
|
||||
checkClassName(RT_INNER_TEST_NAME, configuration);
|
||||
checkCanRun(configuration);
|
||||
|
||||
PsiMethod[] testMethod = innerTest.findMethodsByName("test", false);
|
||||
assertEquals(1, testMethod.length);
|
||||
configuration = createConfiguration(testMethod[0]);
|
||||
checkClassName(RT_INNER_TEST_NAME, configuration);
|
||||
checkMethodName("test", configuration);
|
||||
checkTestObject(JUnitConfiguration.TEST_METHOD, configuration);
|
||||
checkCanRun(configuration);
|
||||
|
||||
PsiMethod mainMethod = innerTest.findMethodsByName("main", false)[0];
|
||||
ApplicationConfiguration appConfiguration = createConfiguration(mainMethod);
|
||||
assertEquals(RT_INNER_TEST_NAME, appConfiguration.MAIN_CLASS_NAME);
|
||||
checkCanRun(configuration);
|
||||
}
|
||||
|
||||
public void testModulesSelector() throws ConfigurationException {
|
||||
if (IdeaTestUtil.COVERAGE_ENABLED_BUILD) return;
|
||||
|
||||
Module module1 = getModule1();
|
||||
Module module2 = getModule2();
|
||||
JUnitConfigurable editor = new JUnitConfigurable(myProject);
|
||||
try {
|
||||
JUnitConfiguration configuration = createConfiguration(findTestA(module2));
|
||||
editor.getComponent(); // To get all the watchers installed.
|
||||
Configurable configurable = new RunConfigurationConfigurableAdapter(editor, configuration);
|
||||
JComboBox comboBox = editor.getModulesComponent();
|
||||
configurable.reset();
|
||||
assertFalse(configurable.isModified());
|
||||
assertEquals(module2.getName(), ((Module)comboBox.getSelectedItem()).getName());
|
||||
assertEquals(ModuleManager.getInstance(myProject).getModules().length + 1, comboBox.getModel().getSize()); //no module
|
||||
comboBox.setSelectedItem(module1);
|
||||
assertTrue(configurable.isModified());
|
||||
configurable.apply();
|
||||
assertFalse(configurable.isModified());
|
||||
assertEquals(Collections.singleton(module1), new HashSet(Arrays.asList(configuration.getModules())));
|
||||
}
|
||||
finally {
|
||||
Disposer.dispose(editor);
|
||||
}
|
||||
}
|
||||
|
||||
public void testCantCreateConfiguration() {
|
||||
PsiClass objectClass =
|
||||
JavaPsiFacade.getInstance(myProject).findClass(CommonClassNames.JAVA_LANG_OBJECT, GlobalSearchScope.allScope(myProject));
|
||||
assertNull(createConfiguration(objectClass));
|
||||
assertNull(createConfiguration(JUnitUtil.getContainingPackage(objectClass)));
|
||||
}
|
||||
|
||||
public void testRunningJUnit() throws ExecutionException {
|
||||
PsiClass testA = findTestA(getModule1());
|
||||
JUnitConfiguration configuration = createConfiguration(testA);
|
||||
JavaParameters parameters = checkCanRun(configuration);
|
||||
CHECK.empty(parameters.getVMParametersList().getList());
|
||||
assertTrue(JUnitStarter.checkVersion(parameters.getProgramParametersList().getArray(),
|
||||
new SegmentedOutputStream(System.out)));
|
||||
assertTrue(parameters.getProgramParametersList().getList().contains(testA.getQualifiedName()));
|
||||
assertEquals(JUnitStarter.class.getName(), parameters.getMainClass());
|
||||
assertEquals(myJdk.getHomeDirectory().getPresentableUrl(), parameters.getJdkPath());
|
||||
}
|
||||
|
||||
public void testRunningAllInPackage() throws IOException, ExecutionException {
|
||||
Module module1 = getModule1();
|
||||
GlobalSearchScope module1AndLibraries = GlobalSearchScope.moduleWithLibrariesScope(module1);
|
||||
PsiClass testCase = findClass(TestCase.class.getName(), module1AndLibraries);
|
||||
PsiClass psiClass = findTestA(module1);
|
||||
PsiClass psiClass2 = findTestA(getModule2());
|
||||
PsiClass derivedTest = findClass(module1, "test1.DerivedTest");
|
||||
PsiClass baseTestCase = findClass("junit.framework.ThirdPartyClass", module1AndLibraries);
|
||||
PsiClass testB = findClass(getModule3(), "test1.TestB");
|
||||
assertNotNull(testCase);
|
||||
assertNotNull(derivedTest);
|
||||
assertNotNull(psiClass);
|
||||
assertTrue(psiClass.isInheritor(testCase, false));
|
||||
assertEquals(baseTestCase, derivedTest.getSuperClass());
|
||||
assertTrue(baseTestCase.isInheritor(testCase, true));
|
||||
assertTrue(derivedTest.isInheritor(testCase, true));
|
||||
PsiPackage psiPackage = JUnitUtil.getContainingPackage(psiClass);
|
||||
JUnitConfiguration configuration = createConfiguration(psiPackage, module1);
|
||||
JavaParameters parameters = checkCanRun(configuration);
|
||||
List<String> lines = extractAllInPackageTests(parameters, psiPackage);
|
||||
CHECK.compareUnordered(
|
||||
new Object[]{psiClass.getQualifiedName(), psiClass2.getQualifiedName(), derivedTest.getQualifiedName(), RT_INNER_TEST_NAME,
|
||||
testB.getQualifiedName()},
|
||||
lines);
|
||||
}
|
||||
|
||||
public void testRunAllInPackageWhenPackageIsEmptyInModule() throws ExecutionException {
|
||||
assignJdk(getModule2());
|
||||
JUnitConfiguration configuration =
|
||||
new JUnitConfiguration("", myProject, JUnitConfigurationType.getInstance().getConfigurationFactories()[0]);
|
||||
configuration.getPersistentData().TEST_OBJECT = JUnitConfiguration.TEST_PACKAGE;
|
||||
configuration.getPersistentData().PACKAGE_NAME = "test2";
|
||||
configuration.getPersistentData().setScope(TestSearchScope.WHOLE_PROJECT);
|
||||
assertEmpty(configuration.getModules());
|
||||
checkCanRun(configuration);
|
||||
configuration.getPersistentData().PACKAGE_NAME = "noTests";
|
||||
// checkCantRun(configuration, "No tests found in the package '");
|
||||
|
||||
configuration.getPersistentData().PACKAGE_NAME = "com.abcent";
|
||||
checkCantRun(configuration, "Package 'com.abcent' not found");
|
||||
}
|
||||
|
||||
public void testAllInPackageForCommonAncestorModule() throws IOException, ExecutionException {
|
||||
disposeModule(getModule2());
|
||||
addModule("module5", true);
|
||||
Module ancestor = getModule1();
|
||||
Module child1 = getModule2();
|
||||
Module child2 = getModule3();
|
||||
addDependency(ancestor, child1);
|
||||
addDependency(ancestor, child2);
|
||||
PsiPackage psiPackage = JavaPsiFacade.getInstance(myProject).findPackage("test1");
|
||||
JUnitConfiguration configuration = createJUnitConfiguration(psiPackage, AllInPackageConfigurationProducer.class, new MapDataContext());
|
||||
configuration.getPersistentData().setScope(TestSearchScope.WHOLE_PROJECT);
|
||||
assertNotNull(configuration);
|
||||
checkPackage(psiPackage.getQualifiedName(), configuration);
|
||||
assertEmpty(configuration.getModules());
|
||||
JavaParameters parameters = checkCanRun(configuration);
|
||||
List<String> tests = extractAllInPackageTests(parameters, psiPackage);
|
||||
String childTest1 = findClass(child1, "test1.TestB").getQualifiedName();
|
||||
String childTest2 = findClass(child2, "test1.Test5").getQualifiedName();
|
||||
String ancestorTest = findClass(ancestor, "test1.TestA").getQualifiedName();
|
||||
CHECK.containsAll(tests, new Object[]{ancestorTest, childTest1, childTest2});
|
||||
}
|
||||
|
||||
public void testClasspathConfiguration() throws CantRunException {
|
||||
JavaParameters parameters = new JavaParameters();
|
||||
RunConfigurationModule module = new JavaRunConfigurationModule(myProject, false);
|
||||
Module module1 = getModule1();
|
||||
Module module2 = getModule2();
|
||||
addDependency(module1, module2);
|
||||
Module module3 = getModule3();
|
||||
addDependency(module2, module3);
|
||||
addDependency(module1, module3);
|
||||
addOutputs(module1, 1);
|
||||
addOutputs(module2, 2);
|
||||
addOutputs(module3, 3);
|
||||
module.setModule(module1);
|
||||
parameters.configureByModule(module.getModule(), JavaParameters.JDK_AND_CLASSES_AND_TESTS);
|
||||
ArrayList<String> classPath = new ArrayList<String>();
|
||||
StringTokenizer tokenizer = new StringTokenizer(parameters.getClassPath().getPathsString(), File.pathSeparator);
|
||||
while (tokenizer.hasMoreTokens()) {
|
||||
String token = tokenizer.nextToken();
|
||||
classPath.add(token);
|
||||
}
|
||||
CHECK.singleOccurence(classPath, getOutput(module1, false));
|
||||
CHECK.singleOccurence(classPath, getOutput(module1, false));
|
||||
CHECK.singleOccurence(classPath, getOutput(module1, true));
|
||||
CHECK.singleOccurence(classPath, getOutput(module2, false));
|
||||
CHECK.singleOccurence(classPath, getOutput(module2, true));
|
||||
CHECK.singleOccurence(classPath, getOutput(module3, false));
|
||||
CHECK.singleOccurence(classPath, getOutput(module3, true));
|
||||
CHECK.singleOccurence(classPath, getFSPath(findFile(MOCK_JUNIT)));
|
||||
}
|
||||
|
||||
public void testExternalizeJUnitConfiguration() throws WriteExternalException, InvalidDataException {
|
||||
JUnitConfiguration configuration = createConfiguration(findTestA(getModule1()));
|
||||
Element element = new Element("cfg");
|
||||
configuration.writeExternal(element);
|
||||
JUnitConfiguration newCfg =
|
||||
new JUnitConfiguration(null, myProject, JUnitConfigurationType.getInstance().getConfigurationFactories()[0]);
|
||||
|
||||
newCfg.readExternal(element);
|
||||
checkTestObject(configuration.getPersistentData().TEST_OBJECT, newCfg);
|
||||
assertEquals(Collections.singleton(getModule1()), new HashSet(Arrays.asList(newCfg.getModules())));
|
||||
checkClassName(configuration.getPersistentData().getMainClassName(), newCfg);
|
||||
}
|
||||
|
||||
public void testTestClassPathWhenRunningConfigurations() throws IOException, ExecutionException {
|
||||
addModule("module4", false);
|
||||
Module module4 = getModule4();
|
||||
assignJdk(module4);
|
||||
addSourcePath(module4, "testSrc", true);
|
||||
addSourcePath(module4, "src", false);
|
||||
String output = setCompilerOutput(module4, "classes", false);
|
||||
String testOuput = setCompilerOutput(module4, "testClasses", true);
|
||||
|
||||
ApplicationConfiguration applicationConfiguration = createConfiguration(findClass(module4, "Application"));
|
||||
JavaParameters parameters = checkCanRun(applicationConfiguration);
|
||||
String classPath = parameters.getClassPath().getPathsString();
|
||||
checkDoesNotContain(classPath, testOuput);
|
||||
checkContains(classPath, output);
|
||||
|
||||
JUnitConfiguration junitConfiguration =
|
||||
createJUnitConfiguration(findClass(module4, "TestApplication"), TestClassConfigurationProducer.class, new MapDataContext());
|
||||
parameters = checkCanRun(junitConfiguration);
|
||||
classPath = parameters.getClassPath().getPathsString();
|
||||
checkContains(classPath, testOuput);
|
||||
checkContains(classPath, output);
|
||||
|
||||
applicationConfiguration.MAIN_CLASS_NAME = junitConfiguration.getPersistentData().getMainClassName();
|
||||
classPath = checkCanRun(applicationConfiguration).getClassPath().getPathsString();
|
||||
checkContains(classPath, testOuput);
|
||||
checkContains(classPath, output);
|
||||
}
|
||||
|
||||
public void testSameTestAndCommonOutput() throws IOException, ExecutionException {
|
||||
addModule("module4", false);
|
||||
Module module = getModule4();
|
||||
assignJdk(module);
|
||||
addSourcePath(module, "src", false);
|
||||
addSourcePath(module, "testSrc", false);
|
||||
String output = setCompilerOutput(module, "classes", false);
|
||||
assertEquals(output, setCompilerOutput(module, "classes", true));
|
||||
|
||||
RuntimeConfiguration configuration = createConfiguration(findClass(module, "Application"));
|
||||
JavaParameters javaParameters = checkCanRun(configuration);
|
||||
checkContains(javaParameters.getClassPath().getPathsString(), output);
|
||||
|
||||
configuration = createConfiguration(findClass(module, "TestApplication"));
|
||||
javaParameters = checkCanRun(configuration);
|
||||
checkContains(javaParameters.getClassPath().getPathsString(), output);
|
||||
}
|
||||
|
||||
public void testCreatingApplicationConfiguration() throws ConfigurationException {
|
||||
if (IdeaTestUtil.COVERAGE_ENABLED_BUILD) return;
|
||||
|
||||
ApplicationConfiguration configuration = new ApplicationConfiguration(null, myProject, ApplicationConfigurationType.getInstance());
|
||||
ApplicationConfigurable editor = new ApplicationConfigurable(myProject);
|
||||
try {
|
||||
editor.getComponent(); // To get all the watchers installed.
|
||||
Configurable configurable = new RunConfigurationConfigurableAdapter(editor, configuration);
|
||||
configurable.reset();
|
||||
CommonJavaParametersPanel javaParameters = editor.getCommonProgramParameters();
|
||||
javaParameters.setProgramParameters("prg");
|
||||
javaParameters.setVMParameters("vm");
|
||||
javaParameters.setWorkingDirectory("dir");
|
||||
assertTrue(configurable.isModified());
|
||||
configurable.apply();
|
||||
assertEquals("prg", configuration.getProgramParameters());
|
||||
assertEquals("vm", configuration.getVMParameters());
|
||||
assertEquals("dir", configuration.getWorkingDirectory());
|
||||
}
|
||||
finally {
|
||||
Disposer.dispose(editor);
|
||||
}
|
||||
}
|
||||
|
||||
public void testCreateInnerPackageLocalApplication() throws ExecutionException {
|
||||
PsiClass psiClass = findClass(getModule1(), "test2.NotATest.InnerApplication");
|
||||
assertNotNull(psiClass);
|
||||
ApplicationConfiguration configuration = createConfiguration(psiClass);
|
||||
assertEquals("test2.NotATest$InnerApplication", configuration.MAIN_CLASS_NAME);
|
||||
checkCanRun(configuration);
|
||||
}
|
||||
|
||||
public void testEditJUnitConfiguration() throws ConfigurationException {
|
||||
if (IdeaTestUtil.COVERAGE_ENABLED_BUILD) return;
|
||||
|
||||
PsiClass testA = findTestA(getModule2());
|
||||
JUnitConfiguration configuration = createConfiguration(testA);
|
||||
JUnitConfigurable editor = new JUnitConfigurable(myProject);
|
||||
try {
|
||||
Configurable configurable = new RunConfigurationConfigurableAdapter(editor, configuration);
|
||||
configurable.reset();
|
||||
final EditorTextFieldWithBrowseButton component =
|
||||
((LabeledComponent<EditorTextFieldWithBrowseButton>)editor.getTestLocation(JUnitConfigurationModel.CLASS)).getComponent();
|
||||
assertEquals(testA.getQualifiedName(), component.getText());
|
||||
PsiClass otherTest = findClass(getModule2(), "test2.Test2");
|
||||
component.setText(otherTest.getQualifiedName());
|
||||
configurable.apply();
|
||||
assertEquals(otherTest.getName(), configuration.getName());
|
||||
String specialName = "My name";
|
||||
configuration.setName(specialName);
|
||||
configurable.reset();
|
||||
component.setText(testA.getQualifiedName());
|
||||
configurable.apply();
|
||||
assertEquals(specialName, configuration.getName());
|
||||
}
|
||||
finally {
|
||||
Disposer.dispose(editor);
|
||||
}
|
||||
}
|
||||
|
||||
public void testRunThridPartyApplication() throws ExecutionException {
|
||||
ApplicationConfiguration configuration =
|
||||
new ApplicationConfiguration("Thrid party", myProject, ApplicationConfigurationType.getInstance());
|
||||
configuration.setModule(getModule1());
|
||||
configuration.MAIN_CLASS_NAME = "thrid.party.Main";
|
||||
checkCanRun(configuration);
|
||||
}
|
||||
|
||||
public void testAllInPackageForProject() throws IOException, ExecutionException {
|
||||
// module1 -> module2 -> module3
|
||||
// module5
|
||||
addModule("module5");
|
||||
addDependency(getModule1(), getModule2());
|
||||
addDependency(getModule2(), getModule3());
|
||||
String[][] outputs = new String[4][];
|
||||
for (int i = 0; i < 4; i++) {
|
||||
outputs[i] = addOutputs(getModule(i), i + 1);
|
||||
}
|
||||
|
||||
|
||||
PsiPackage defaultPackage = JavaPsiFacade.getInstance(myProject).findPackage("");
|
||||
JUnitConfiguration configuration =
|
||||
createJUnitConfiguration(defaultPackage, AllInPackageConfigurationProducer.class, new MapDataContext());
|
||||
configuration.getPersistentData().setScope(TestSearchScope.WHOLE_PROJECT);
|
||||
JavaParameters javaParameters = checkCanRun(configuration);
|
||||
String classPath = javaParameters.getClassPath().getPathsString();
|
||||
assertEquals(-1, classPath.indexOf(JarFileSystem.PROTOCOL_PREFIX));
|
||||
assertEquals(-1, classPath.indexOf(LocalFileSystem.PROTOCOL_PREFIX));
|
||||
for (int i = 0; i < 4; i++) {
|
||||
checkContains(classPath, outputs[i][0]);
|
||||
checkContains(classPath, outputs[i][1]);
|
||||
}
|
||||
}
|
||||
|
||||
private void assignJdk(Module module) {
|
||||
myJdk = ModuleRootManager.getInstance(myModule).getSdk();
|
||||
ModuleRootModificationUtil.setModuleSdk(module, myJdk);
|
||||
}
|
||||
|
||||
private static String getOutput(Module module1, boolean test) {
|
||||
CompilerModuleExtension compilerModuleExtension = CompilerModuleExtension.getInstance(module1);
|
||||
assertNotNull(compilerModuleExtension);
|
||||
VirtualFile output = test ? compilerModuleExtension.getCompilerOutputPathForTests() : compilerModuleExtension.getCompilerOutputPath();
|
||||
return getFSPath(output);
|
||||
}
|
||||
|
||||
private static String getFSPath(VirtualFile output) {
|
||||
return PathUtil.getLocalPath(output);
|
||||
}
|
||||
|
||||
private String[] addOutputs(Module module, int index) {
|
||||
String[] outputs = new String[2];
|
||||
String prefix = "outputs" + File.separatorChar;
|
||||
VirtualFile generalOutput = findFile(prefix + "general " + index);
|
||||
VirtualFile testOutput = findFile(prefix + "tests" + index);
|
||||
outputs[0] = generalOutput.getPresentableUrl();
|
||||
outputs[1] = testOutput.getPresentableUrl();
|
||||
PsiTestUtil.setCompilerOutputPath(module, generalOutput.getUrl(), false);
|
||||
PsiTestUtil.setCompilerOutputPath(module, testOutput.getUrl(), true);
|
||||
return outputs;
|
||||
}
|
||||
|
||||
private JavaParameters checkCanRun(RuntimeConfiguration configuration) throws ExecutionException {
|
||||
final RunProfileState state;
|
||||
state = configuration.getState(MOCK_EXECUTOR, new ExecutionEnvironment(new MockProfile(), myProject, null));
|
||||
assertNotNull(state);
|
||||
assertTrue(state instanceof JavaCommandLine);
|
||||
if (state instanceof TestPackage) {
|
||||
final JavaParameters parameters = ((TestPackage)state).getJavaParameters();
|
||||
((TestPackage)state).findTests();
|
||||
}
|
||||
try {
|
||||
configuration.checkConfiguration();
|
||||
}
|
||||
catch (RuntimeConfigurationError e) {
|
||||
fail("cannot run: " + e.getMessage());
|
||||
}
|
||||
catch (RuntimeConfigurationException e) {
|
||||
//ignore
|
||||
}
|
||||
return ((JavaCommandLine)state).getJavaParameters();
|
||||
}
|
||||
|
||||
private void checkCantRun(RuntimeConfiguration configuration, String reasonBegining) throws ExecutionException {
|
||||
//MockRunRequest request = new MockRunRequest(myProject);
|
||||
//CantRunException rejectReason;
|
||||
//try {
|
||||
// configuration.runRequested(request);
|
||||
// rejectReason = request.myRejectReason;
|
||||
//}
|
||||
//catch (CantRunException e) {
|
||||
// rejectReason = e;
|
||||
//}
|
||||
//if (rejectReason == null) fail("Should not run");
|
||||
//rejectReason.getMessage().startsWith(reasonBegining);
|
||||
|
||||
try {
|
||||
configuration.checkConfiguration();
|
||||
}
|
||||
catch (RuntimeConfigurationError e) {
|
||||
assertTrue(e.getLocalizedMessage().startsWith(reasonBegining));
|
||||
return;
|
||||
}
|
||||
catch (RuntimeConfigurationException e) {
|
||||
|
||||
}
|
||||
|
||||
final RunProfileState state = configuration
|
||||
.getState(MOCK_EXECUTOR, new ExecutionEnvironment(new MockProfile(), myProject, null));
|
||||
assertTrue(state instanceof JavaCommandLine);
|
||||
|
||||
try {
|
||||
((JavaCommandLine)state).getJavaParameters();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
assertTrue(e.getLocalizedMessage().startsWith(reasonBegining));
|
||||
return;
|
||||
}
|
||||
|
||||
fail("Should not run");
|
||||
}
|
||||
|
||||
private static String setCompilerOutput(Module module, String path, boolean testOutput) {
|
||||
VirtualFile output = ModuleRootManager.getInstance(module).getContentEntries()[0].getFile().findChild(path);
|
||||
assertNotNull(output);
|
||||
PsiTestUtil.setCompilerOutputPath(module, output.getUrl(), testOutput);
|
||||
return output.getPath().replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
private static void addSourcePath(Module module, String path, boolean testSource) {
|
||||
final ContentEntry entry = ModuleRootManager.getInstance(module).getContentEntries()[0];
|
||||
VirtualFile child = entry.getFile().findChild(path);
|
||||
assertNotNull(child);
|
||||
PsiTestUtil.addSourceRoot(module, child, testSource);
|
||||
}
|
||||
|
||||
private JUnitConfiguration createConfiguration(PsiPackage psiPackage, Module module) {
|
||||
JUnitConfiguration configuration =
|
||||
new JUnitConfiguration("", myProject, JUnitConfigurationType.getInstance().getConfigurationFactories()[0]);
|
||||
configuration.getPersistentData().TEST_OBJECT = JUnitConfiguration.TEST_PACKAGE;
|
||||
configuration.getPersistentData().PACKAGE_NAME = psiPackage.getQualifiedName();
|
||||
configuration.getPersistentData().setScope(TestSearchScope.WHOLE_PROJECT);
|
||||
configuration.setModule(module);
|
||||
return configuration;
|
||||
}
|
||||
|
||||
private PsiClass findTestA(Module module) {
|
||||
return findClass(module, "test1.TestA");
|
||||
}
|
||||
|
||||
private static List<String> readLinesFrom(File file) throws IOException {
|
||||
if (!file.exists()) file.createNewFile();
|
||||
ArrayList<String> result = new ArrayList<String>();
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
|
||||
try {
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) result.add(line);
|
||||
return result;
|
||||
}
|
||||
finally {
|
||||
reader.close();
|
||||
}
|
||||
}
|
||||
|
||||
private static List<String> extractAllInPackageTests(JavaParameters parameters, PsiPackage psiPackage)
|
||||
throws IOException {
|
||||
String filePath = ContainerUtil.find(parameters.getProgramParametersList().getArray(), new Condition<String>() {
|
||||
@Override
|
||||
public boolean value(String value) {
|
||||
return StringUtil.startsWithChar(value, '@');
|
||||
}
|
||||
}).substring(1);
|
||||
List<String> lines = readLinesFrom(new File(filePath));
|
||||
assertEquals(psiPackage.getQualifiedName(), lines.get(0));
|
||||
//lines.remove(0);
|
||||
lines.remove(0);
|
||||
return lines;
|
||||
}
|
||||
|
||||
private static void checkContains(String string, String fragment) {
|
||||
assertTrue(fragment + " in " + string, string.indexOf(fragment) >= 0);
|
||||
}
|
||||
|
||||
private static void checkDoesNotContain(String string, String fragment) {
|
||||
assertFalse(fragment + " in " + string, string.indexOf(fragment) >= 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
myJdk = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
private static class MockProfile implements RunProfile {
|
||||
@Override
|
||||
public RunProfileState getState(@NotNull final Executor executor, @NotNull final ExecutionEnvironment env) throws ExecutionException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void checkConfiguration() throws RuntimeConfigurationException {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.intellij.execution;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.roots.ModuleRootModificationUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.JavaPsiFacade;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiPackage;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.testFramework.TempFiles;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Collection;
|
||||
|
||||
public class TestSources {
|
||||
private final Project myProject;
|
||||
private final TempFiles myTempFiles;
|
||||
private File mySrc;
|
||||
private Module myModule;
|
||||
|
||||
public TestSources(Project project, Collection<File> filesToDelete) {
|
||||
myProject = project;
|
||||
myTempFiles = new TempFiles(filesToDelete);
|
||||
}
|
||||
|
||||
public void tearDown() {
|
||||
if (myModule != null) {
|
||||
disposeModule(myModule);
|
||||
myModule = null;
|
||||
}
|
||||
}
|
||||
|
||||
public PsiPackage createPackage(String name) {
|
||||
File dir = new File(mySrc, name);
|
||||
dir.mkdir();
|
||||
LocalFileSystem.getInstance().refreshAndFindFileByIoFile(dir);
|
||||
return findPackage(name);
|
||||
}
|
||||
|
||||
public PsiPackage findPackage(String name) {
|
||||
return JavaPsiFacade.getInstance(myProject).findPackage(name);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PsiClass createClass(String className, String code) throws FileNotFoundException {
|
||||
File file = new File(mySrc, className + ".java");
|
||||
PrintStream stream = new PrintStream(new FileOutputStream(file));
|
||||
try {
|
||||
stream.println(code);
|
||||
}
|
||||
finally {
|
||||
stream.close();
|
||||
}
|
||||
LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
|
||||
return JavaPsiFacade.getInstance(myProject).findClass(className, GlobalSearchScope.allScope(myProject));
|
||||
}
|
||||
|
||||
public void initModule() throws IOException {
|
||||
if (myModule != null) disposeModule(myModule);
|
||||
mySrc = myTempFiles.createTempDir();
|
||||
myModule = BaseConfigurationTestCase.createTempModule(myTempFiles, myProject);
|
||||
VirtualFile moduleContent = TempFiles.getVFileByFile(mySrc);
|
||||
PsiTestUtil.addSourceRoot(myModule, moduleContent);
|
||||
|
||||
Module tempModule = BaseConfigurationTestCase.createTempModule(myTempFiles, myProject);
|
||||
ModuleRootModificationUtil.addDependency(myModule, tempModule);
|
||||
disposeModule(tempModule);
|
||||
}
|
||||
|
||||
private void disposeModule(Module tempModule) {
|
||||
ModuleManager.getInstance(myProject).disposeModule(tempModule);
|
||||
}
|
||||
|
||||
public void copyJdkFrom(Module module) {
|
||||
ModuleRootModificationUtil.setModuleSdk(myModule, ModuleRootManager.getInstance(module).getSdk());
|
||||
}
|
||||
|
||||
public void addLibrary(VirtualFile lib) {
|
||||
ModuleRootModificationUtil.addModuleLibrary(myModule, lib.getUrl());
|
||||
}
|
||||
|
||||
public VirtualFile createPackageDir(String packageName) {
|
||||
File pkg = new File(mySrc, packageName);
|
||||
pkg.mkdirs();
|
||||
VirtualFile pkgFile = TempFiles.getVFileByFile(pkg);
|
||||
return pkgFile;
|
||||
}
|
||||
|
||||
public PsiClass findClass(String fqName) {
|
||||
return JavaPsiFacade.getInstance(myProject).findClass(fqName, GlobalSearchScope.moduleScope(myModule));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.intellij.execution.actions;
|
||||
|
||||
import com.intellij.execution.application.ApplicationConfiguration;
|
||||
import com.intellij.execution.application.ApplicationConfigurationType;
|
||||
import com.intellij.execution.configurations.RuntimeConfiguration;
|
||||
import com.intellij.execution.junit.JUnitConfiguration;
|
||||
import com.intellij.execution.junit.JUnitConfigurationType;
|
||||
import com.intellij.testFramework.LightIdeaTestCase;
|
||||
|
||||
public class BaseRunConfigurationActionTest extends LightIdeaTestCase {
|
||||
public void testRunApplicationName() {
|
||||
ApplicationConfiguration configuration = new ApplicationConfiguration(null, getProject(), ApplicationConfigurationType.getInstance());
|
||||
|
||||
configuration.MAIN_CLASS_NAME = "com.comp.AClass";
|
||||
configuration.setGeneratedName();
|
||||
checkSuggestedName("AClass.main()", configuration);
|
||||
|
||||
configuration.setName("Other name");
|
||||
checkSuggestedName("Other name", configuration);
|
||||
|
||||
configuration.setName("1234567890123456789012345 other long name");
|
||||
checkSuggestedName("12345678901234567890...", configuration);
|
||||
|
||||
configuration.MAIN_CLASS_NAME = "com.comp.A12345678901234567890123LongName";
|
||||
configuration.setGeneratedName();
|
||||
checkSuggestedName("A1234567890123....main()", configuration);
|
||||
}
|
||||
|
||||
public void testRunTestMethodName() {
|
||||
JUnitConfiguration configuration = new JUnitConfiguration(null, getProject(), JUnitConfigurationType.getInstance().getConfigurationFactories()[0]);
|
||||
JUnitConfiguration.Data data = configuration.getPersistentData();
|
||||
|
||||
data.MAIN_CLASS_NAME = "com.comp.ATestClass";
|
||||
configuration.setGeneratedName();
|
||||
checkSuggestedName("ATestClass", configuration);
|
||||
|
||||
configuration.setName("Other name");
|
||||
checkSuggestedName("Other name", configuration);
|
||||
|
||||
data.METHOD_NAME = "testSmth";
|
||||
data.TEST_OBJECT = JUnitConfiguration.TEST_METHOD;
|
||||
configuration.setGeneratedName();
|
||||
checkSuggestedName("testSmth()", configuration);
|
||||
|
||||
data.METHOD_NAME = "12345678901234567890";
|
||||
configuration.setGeneratedName();
|
||||
checkSuggestedName("123456789012345678...()", configuration);
|
||||
}
|
||||
|
||||
private static void checkSuggestedName(String expectedName, RuntimeConfiguration configuration) {
|
||||
String suggestedName = BaseRunConfigurationAction.suggestRunActionName(configuration);
|
||||
assertEquals(expectedName, suggestedName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.intellij.execution.actions;
|
||||
|
||||
import com.intellij.execution.BaseConfigurationTestCase;
|
||||
import com.intellij.execution.RunManagerEx;
|
||||
import com.intellij.execution.RunnerAndConfigurationSettings;
|
||||
import com.intellij.execution.application.ApplicationConfiguration;
|
||||
import com.intellij.execution.junit.*;
|
||||
import com.intellij.execution.testframework.TestSearchScope;
|
||||
import com.intellij.openapi.actionSystem.DataConstants;
|
||||
import com.intellij.openapi.actionSystem.ex.DataConstantsEx;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleUtil;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import com.intellij.psi.PsiPackage;
|
||||
import com.intellij.testFramework.MapDataContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class ContextConfigurationTest extends BaseConfigurationTestCase {
|
||||
private static final String PACKAGE_NAME = "apackage";
|
||||
private static final String SHORT_CLASS_NAME = "SampleClass";
|
||||
private static final String CLASS_NAME = PACKAGE_NAME + "." + SHORT_CLASS_NAME;
|
||||
private static final String METHOD_NAME = "test1";
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
addModule("commonConfiguration");
|
||||
}
|
||||
|
||||
public void testJUnitMethodTest() {
|
||||
PsiClass psiClass = findClass(getModule1(), CLASS_NAME);
|
||||
PsiMethod testMethod = psiClass.findMethodsByName(METHOD_NAME, false)[0];
|
||||
JUnitConfiguration configuration = (JUnitConfiguration)createConfiguration(testMethod);
|
||||
checkTestObject(JUnitConfiguration.TEST_METHOD, configuration);
|
||||
checkClassName(CLASS_NAME, configuration);
|
||||
checkMethodName(METHOD_NAME, configuration);
|
||||
checkPackage(PACKAGE_NAME, configuration);
|
||||
checkGenaratedName(configuration, SHORT_CLASS_NAME + "." + METHOD_NAME);
|
||||
}
|
||||
|
||||
public void testJUnitClassTest() {
|
||||
PsiClass psiClass = findClass(getModule1(), CLASS_NAME);
|
||||
final MapDataContext dataContext = new MapDataContext();
|
||||
JUnitConfiguration configuration = createJUnitConfiguration(psiClass, TestClassConfigurationProducer.class, dataContext);
|
||||
checkTestObject(JUnitConfiguration.TEST_CLASS, configuration);
|
||||
checkClassName(CLASS_NAME, configuration);
|
||||
checkPackage(PACKAGE_NAME, configuration);
|
||||
checkGenaratedName(configuration, SHORT_CLASS_NAME);
|
||||
}
|
||||
|
||||
|
||||
public void testRecreateJUnitClass() throws IOException {
|
||||
createEmptyModule();
|
||||
addDependency(getModule2(), getModule1());
|
||||
PsiClass psiClass = findClass(getModule1(), CLASS_NAME);
|
||||
PsiPackage psiPackage = JUnitUtil.getContainingPackage(psiClass);
|
||||
JUnitConfiguration configuration = createJUnitConfiguration(psiPackage, AllInPackageConfigurationProducer.class, new MapDataContext());
|
||||
configuration.getPersistentData().setScope(TestSearchScope.MODULE_WITH_DEPENDENCIES);
|
||||
configuration.setModule(getModule2());
|
||||
MapDataContext dataContext = new MapDataContext();
|
||||
dataContext.put(DataConstantsEx.RUNTIME_CONFIGURATION, configuration);
|
||||
configuration = createJUnitConfiguration(psiClass, TestClassConfigurationProducer.class, dataContext);
|
||||
checkClassName(psiClass.getQualifiedName(), configuration);
|
||||
assertEquals(Collections.singleton(getModule2()), new HashSet(Arrays.asList(configuration.getModules())));
|
||||
}
|
||||
|
||||
public void testJUnitPackage() {
|
||||
PsiClass psiClass = findClass(getModule1(), CLASS_NAME);
|
||||
PsiPackage psiPackage = JUnitUtil.getContainingPackage(psiClass);
|
||||
final MapDataContext dataContext = new MapDataContext();
|
||||
final Module module = ModuleUtil.findModuleForPsiElement(psiClass);
|
||||
dataContext.put(DataConstants.MODULE, module);
|
||||
JUnitConfiguration configuration = createJUnitConfiguration(psiPackage, AllInPackageConfigurationProducer.class, dataContext);
|
||||
checkTestObject(JUnitConfiguration.TEST_PACKAGE, configuration);
|
||||
checkPackage(PACKAGE_NAME, configuration);
|
||||
checkGenaratedName(configuration, PACKAGE_NAME + " in " + module.getName());
|
||||
}
|
||||
|
||||
public void testJUnitDefaultPackage() {
|
||||
PsiClass psiClass = findClass(getModule1(), CLASS_NAME);
|
||||
PsiPackage psiPackage = JUnitUtil.getContainingPackage(psiClass);
|
||||
PsiPackage defaultPackage = psiPackage.getParentPackage();
|
||||
final Module module = ModuleUtil.findModuleForPsiElement(psiClass);
|
||||
final MapDataContext dataContext = new MapDataContext();
|
||||
dataContext.put(DataConstants.MODULE, module);
|
||||
JUnitConfiguration configuration = createJUnitConfiguration(defaultPackage, AllInPackageConfigurationProducer.class, dataContext);
|
||||
checkTestObject(JUnitConfiguration.TEST_PACKAGE, configuration);
|
||||
checkPackage("", configuration);
|
||||
checkGenaratedName(configuration, "All in " + module.getName());
|
||||
}
|
||||
|
||||
public void testApplication() {
|
||||
PsiClass psiClass = findClass(getModule1(), CLASS_NAME);
|
||||
PsiMethod psiMethod = psiClass.findMethodsByName("main", false)[0];
|
||||
ApplicationConfiguration configuration = createConfiguration(psiMethod);
|
||||
assertEquals(CLASS_NAME, configuration.MAIN_CLASS_NAME);
|
||||
assertEquals(configuration.getGeneratedName(), configuration.getName());
|
||||
assertEquals(SHORT_CLASS_NAME, configuration.getName());
|
||||
}
|
||||
|
||||
public void testReusingConfiguration() {
|
||||
RunManagerEx runManager = RunManagerEx.getInstanceEx(myProject);
|
||||
PsiClass psiClass = findClass(getModule1(), CLASS_NAME);
|
||||
PsiPackage psiPackage = JUnitUtil.getContainingPackage(psiClass);
|
||||
|
||||
ConfigurationContext context = createContext(psiClass);
|
||||
assertEquals(null, context.findExisting());
|
||||
RunnerAndConfigurationSettings testClass = context.getConfiguration();
|
||||
runManager.addConfiguration(testClass, false);
|
||||
context = createContext(psiClass);
|
||||
assertSame(testClass, context.findExisting());
|
||||
|
||||
runManager.setActiveConfiguration(testClass);
|
||||
context = createContext(psiPackage);
|
||||
assertEquals(null, context.findExisting());
|
||||
RunnerAndConfigurationSettings testPackage = context.getConfiguration();
|
||||
runManager.addConfiguration(testPackage, false);
|
||||
context = createContext(psiPackage);
|
||||
assertSame(testPackage, context.findExisting());
|
||||
assertSame(testClass, runManager.getSelectedConfiguration());
|
||||
runManager.setActiveConfiguration(context.findExisting());
|
||||
assertSame(testPackage, runManager.getSelectedConfiguration());
|
||||
}
|
||||
|
||||
public void testJUnitGeneratedName() {
|
||||
PsiClass psiClass = findClass(getModule1(), CLASS_NAME);
|
||||
PsiPackage psiPackage = JUnitUtil.getContainingPackage(psiClass);
|
||||
JUnitConfiguration configuration = new JUnitConfiguration(null, myProject, JUnitConfigurationType.getInstance().getConfigurationFactories()[0]);
|
||||
JUnitConfiguration.Data data = configuration.getPersistentData();
|
||||
data.PACKAGE_NAME = psiPackage.getQualifiedName();
|
||||
data.TEST_OBJECT = JUnitConfiguration.TEST_PACKAGE;
|
||||
assertEquals(PACKAGE_NAME, configuration.getGeneratedName());
|
||||
data.PACKAGE_NAME = "not.existing.pkg";
|
||||
assertEquals("not.existing.pkg", configuration.getGeneratedName());
|
||||
|
||||
data.TEST_OBJECT = JUnitConfiguration.TEST_CLASS;
|
||||
data.MAIN_CLASS_NAME = psiClass.getQualifiedName();
|
||||
assertEquals(SHORT_CLASS_NAME, configuration.getGeneratedName());
|
||||
data.MAIN_CLASS_NAME = "not.existing.TestClass";
|
||||
assertEquals("TestClass", configuration.getGeneratedName());
|
||||
data.MAIN_CLASS_NAME = "pkg.TestClass.";
|
||||
assertEquals("pkg.TestClass.", configuration.getGeneratedName());
|
||||
data.MAIN_CLASS_NAME = "TestClass";
|
||||
assertEquals("TestClass", configuration.getGeneratedName());
|
||||
|
||||
data.TEST_OBJECT = JUnitConfiguration.TEST_METHOD;
|
||||
data.MAIN_CLASS_NAME = psiClass.getQualifiedName();
|
||||
data.METHOD_NAME = METHOD_NAME;
|
||||
assertEquals(SHORT_CLASS_NAME + "." + METHOD_NAME, configuration.getGeneratedName());
|
||||
data.MAIN_CLASS_NAME = "not.existing.TestClass";
|
||||
assertEquals("TestClass." + METHOD_NAME, configuration.getGeneratedName());
|
||||
}
|
||||
|
||||
private void checkGenaratedName(JUnitConfiguration configuration, String name) {
|
||||
assertEquals(configuration.getGeneratedName(), configuration.getName());
|
||||
assertEquals(name, configuration.getName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.intellij.execution.filters;
|
||||
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
import com.intellij.util.Consumer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author gregsh
|
||||
*/
|
||||
public class ExceptionWorkerTest extends LightCodeInsightFixtureTestCase {
|
||||
|
||||
public void testParsing() {
|
||||
myFixture.addClass("package com.sample;\n" +
|
||||
"\n" +
|
||||
"/**\n" +
|
||||
" * Created with IntelliJ IDEA.\n" +
|
||||
" * User: jetbrains\n" +
|
||||
" * Date: 11/26/12\n" +
|
||||
" * Time: 6:08 PM\n" +
|
||||
" * To change this template use File | Settings | File Templates.\n" +
|
||||
" */\n" +
|
||||
"public class RunningMain {\n" +
|
||||
" public static void main(String[] args) throws Exception {\n" +
|
||||
" try {\n" +
|
||||
" func1();\n" +
|
||||
" }\n" +
|
||||
" finally {\n" +
|
||||
"\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" static void func1() {\n" +
|
||||
" try {\n" +
|
||||
" func();\n" +
|
||||
" }\n" +
|
||||
" finally {\n" +
|
||||
"\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
" static void func() {\n" +
|
||||
" throw new NullPointerException();\n" +
|
||||
" }\n" +
|
||||
"}\n");
|
||||
|
||||
final String testData = "Exception in thread \"main\" java.lang.NullPointerException\n" +
|
||||
"\tat com.sample.RunningMain.func(RunningMain.java:30)\n" +
|
||||
"\tat com.sample.RunningMain.func1(RunningMain.java:22)\n" +
|
||||
"\tat com.sample.RunningMain.main(RunningMain.java:13)\n";
|
||||
final Document document = EditorFactory.getInstance().createDocument(testData);
|
||||
FilterMixin filter = (FilterMixin)new ExceptionExFilterFactory().create(GlobalSearchScope.projectScope(getProject()));
|
||||
final ArrayList<String> result = new ArrayList<String>();
|
||||
filter.applyHeavyFilter(document, 0, 0, new Consumer<FilterMixin.AdditionalHighlight>() {
|
||||
@Override
|
||||
public void consume(FilterMixin.AdditionalHighlight highlight) {
|
||||
result.add(new TextRange(highlight.getStart(), highlight.getEnd()-1).substring(testData));
|
||||
}
|
||||
});
|
||||
assertSameElements(result, "com.sample.RunningMain.func1", "com.sample.RunningMain.main");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,717 @@
|
||||
package com.intellij.execution.impl;
|
||||
|
||||
import com.intellij.execution.application.ApplicationConfigurationType;
|
||||
import com.intellij.execution.configurations.ConfigurationType;
|
||||
import com.intellij.execution.configurations.UnknownConfigurationType;
|
||||
import com.intellij.execution.junit.JUnitConfigurationType;
|
||||
import com.intellij.ide.util.PropertiesComponent;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.JDOMUtil;
|
||||
import com.intellij.openapi.util.Trinity;
|
||||
import com.intellij.testFramework.LightIdeaTestCase;
|
||||
import com.intellij.ui.RowsDnDSupport;
|
||||
import com.intellij.ui.treeStructure.Tree;
|
||||
import org.jdom.Element;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import javax.swing.tree.TreePath;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.execution.impl.RunConfigurable.NodeKind.*;
|
||||
import static com.intellij.ui.RowsDnDSupport.RefinedDropSupport.Position.*;
|
||||
|
||||
/**
|
||||
* User: Vassiliy.Kudryashov
|
||||
*/
|
||||
public class RunConfigurableTest extends LightIdeaTestCase {
|
||||
private static final RunConfigurable.NodeKind[] ORDER = {
|
||||
CONFIGURATION_TYPE,//Application
|
||||
FOLDER,//1
|
||||
CONFIGURATION, CONFIGURATION, CONFIGURATION, CONFIGURATION, CONFIGURATION,
|
||||
TEMPORARY_CONFIGURATION, TEMPORARY_CONFIGURATION,
|
||||
FOLDER,//2
|
||||
TEMPORARY_CONFIGURATION,
|
||||
FOLDER,//3
|
||||
CONFIGURATION,
|
||||
TEMPORARY_CONFIGURATION,
|
||||
CONFIGURATION_TYPE,//JUnit
|
||||
FOLDER,//4
|
||||
CONFIGURATION, CONFIGURATION,
|
||||
FOLDER,//5
|
||||
CONFIGURATION, CONFIGURATION,
|
||||
TEMPORARY_CONFIGURATION,
|
||||
UNKNOWN//Defaults
|
||||
};
|
||||
private MockRunConfigurable myConfigurable;
|
||||
private Tree myTree;
|
||||
private DefaultMutableTreeNode myRoot;
|
||||
private RunConfigurable.MyTreeModel myModel;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
myConfigurable = new MockRunConfigurable(createRunManager(JDOMUtil.loadDocument(FOLDERS_CONFIGURATION).getRootElement()));
|
||||
myTree = myConfigurable.myTree;
|
||||
myRoot = myConfigurable.myRoot;
|
||||
myModel = myConfigurable.myTreeModel;
|
||||
doExpand();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
myConfigurable.disposeUIResources();
|
||||
myConfigurable = null;
|
||||
myTree = null;
|
||||
myRoot = null;
|
||||
myModel = null;
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void testDND() throws Exception {
|
||||
int[] never = {-1, 0, 14, 22, 23, 999};
|
||||
for (int i = -1; i < 17; i++) {
|
||||
for (int j : never) {
|
||||
if ((j == 14 || j == 21) && i == j) {
|
||||
continue;
|
||||
}
|
||||
assertCannot(j,i,ABOVE);
|
||||
assertCannot(j,i,INTO);
|
||||
assertCannot(j,i,BELOW);
|
||||
}
|
||||
}
|
||||
assertCan(3, 3, BELOW);
|
||||
assertCan(3, 3, ABOVE);
|
||||
assertCannot(3, 2, BELOW);
|
||||
assertCan(3, 2, ABOVE);
|
||||
assertCannot(3, 1, BELOW);
|
||||
assertCannot(3, 0, BELOW);
|
||||
assertCan(2, 14, ABOVE);
|
||||
assertCan(1, 14, ABOVE);
|
||||
assertCan(1, 11, ABOVE);
|
||||
assertCannot(1, 10, ABOVE);
|
||||
assertCannot(1, 10, BELOW);
|
||||
assertCannot(8, 6, ABOVE);
|
||||
assertCan(8, 6, BELOW);
|
||||
assertCannot(5, 7, BELOW);
|
||||
assertCan(5, 7, ABOVE);
|
||||
assertCannot(15, 11, INTO);
|
||||
assertCannot(18, 21, ABOVE);
|
||||
assertCan(15, 21, ABOVE);
|
||||
|
||||
assertTrue(myModel.isDropInto(myTree, 2, 9));
|
||||
assertTrue(myModel.isDropInto(myTree, 2, 1));
|
||||
assertTrue(myModel.isDropInto(myTree, 12, 9));
|
||||
assertTrue(myModel.isDropInto(myTree, 12, 1));
|
||||
assertFalse(myModel.isDropInto(myTree, 999, 9));
|
||||
assertFalse(myModel.isDropInto(myTree, 999, 1));
|
||||
assertFalse(myModel.isDropInto(myTree, 2, 999));
|
||||
assertFalse(myModel.isDropInto(myTree, 2, -1));
|
||||
}
|
||||
|
||||
private void doExpand() {
|
||||
List<DefaultMutableTreeNode> toExpand = new ArrayList<DefaultMutableTreeNode>();
|
||||
RunConfigurable.collectNodesRecursively(myRoot, toExpand, FOLDER);
|
||||
assertEquals(toExpand.size(), 5);
|
||||
List<DefaultMutableTreeNode> toExpand2 = new ArrayList<DefaultMutableTreeNode>();
|
||||
RunConfigurable.collectNodesRecursively(myRoot, toExpand2, CONFIGURATION_TYPE);
|
||||
toExpand.addAll(toExpand2);
|
||||
for (DefaultMutableTreeNode node : toExpand) {
|
||||
myTree.expandPath(new TreePath(node.getPath()));
|
||||
}
|
||||
for (int i = 0; i < ORDER.length; i++) {
|
||||
DefaultMutableTreeNode node = (DefaultMutableTreeNode)myTree.getPathForRow(i).getLastPathComponent();
|
||||
assertEquals("Row #" + i, RunConfigurable.getKind(node), ORDER[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void assertCan(int oldIndex, int newIndex, RowsDnDSupport.RefinedDropSupport.Position position) {
|
||||
assertDrop(oldIndex, newIndex, position, true);
|
||||
}
|
||||
|
||||
private void assertCannot(int oldIndex, int newIndex, RowsDnDSupport.RefinedDropSupport.Position position) {
|
||||
assertDrop(oldIndex, newIndex, position, false);
|
||||
}
|
||||
|
||||
private void assertDrop(int oldIndex, int newIndex, RowsDnDSupport.RefinedDropSupport.Position position, boolean canDrop) {
|
||||
StringBuilder message = new StringBuilder();
|
||||
message.append("(").append(oldIndex).append(")").append(myTree.getPathForRow(oldIndex)).append("->");
|
||||
message.append("(").append(newIndex).append(")").append(myTree.getPathForRow(newIndex)).append(position);
|
||||
if (canDrop) {
|
||||
assertTrue(message.toString(), myModel.canDrop(oldIndex, newIndex, position));
|
||||
}
|
||||
else {
|
||||
assertFalse(message.toString(), myModel.canDrop(oldIndex, newIndex, position));
|
||||
}
|
||||
}
|
||||
|
||||
public void testMoveUpDown() {
|
||||
checkPositionToMove(0, 1, null);
|
||||
checkPositionToMove(2, 1, Trinity.create(2, 3, BELOW));
|
||||
checkPositionToMove(2, -1, null);
|
||||
checkPositionToMove(14, 1, null);
|
||||
checkPositionToMove(14, -1, null);
|
||||
checkPositionToMove(15, -1, null);
|
||||
checkPositionToMove(16, -1, null);
|
||||
checkPositionToMove(3, -1, Trinity.create(3, 2, ABOVE));
|
||||
checkPositionToMove(6, 1, Trinity.create(6, 9, BELOW));
|
||||
checkPositionToMove(7, 1, Trinity.create(7, 8, BELOW));
|
||||
checkPositionToMove(10, -1, Trinity.create(10, 8, BELOW));
|
||||
checkPositionToMove(8, 1, Trinity.create(8, 9, BELOW));
|
||||
checkPositionToMove(21, -1, Trinity.create(21, 20, BELOW));
|
||||
checkPositionToMove(21, 1, null);
|
||||
checkPositionToMove(20, 1, Trinity.create(20, 21, ABOVE));
|
||||
checkPositionToMove(20, -1, Trinity.create(20, 19, ABOVE));
|
||||
checkPositionToMove(19, 1, Trinity.create(19, 20, BELOW));
|
||||
checkPositionToMove(19, -1, Trinity.create(19, 17, BELOW));
|
||||
checkPositionToMove(17, -1, Trinity.create(17, 16, ABOVE));
|
||||
checkPositionToMove(17, 1, Trinity.create(17, 18, BELOW));
|
||||
}
|
||||
|
||||
private void checkPositionToMove(int selectedRow,
|
||||
int direction,
|
||||
Trinity<Integer, Integer, RowsDnDSupport.RefinedDropSupport.Position> expected) {
|
||||
myTree.setSelectionRow(selectedRow);
|
||||
assertEquals(expected, myConfigurable.getAvailableDropPosition(direction));
|
||||
}
|
||||
|
||||
private static RunManagerImpl createRunManager(Element element) throws InvalidDataException {
|
||||
RunManagerImpl runManager = new RunManagerImpl(getProject(), PropertiesComponent.getInstance());
|
||||
runManager.initializeConfigurationTypes(new ConfigurationType[]{ApplicationConfigurationType.getInstance(),
|
||||
JUnitConfigurationType.getInstance(), UnknownConfigurationType.INSTANCE});
|
||||
runManager.initComponent();
|
||||
runManager.readExternal(element);
|
||||
return runManager;
|
||||
}
|
||||
|
||||
private static class MockRunConfigurable extends RunConfigurable {
|
||||
private final RunManagerImpl myTestManager;
|
||||
|
||||
private MockRunConfigurable(RunManagerImpl runManager) {
|
||||
super(getProject());
|
||||
myTestManager = runManager;
|
||||
createComponent();
|
||||
}
|
||||
|
||||
@Override
|
||||
RunManagerImpl getRunManager() {
|
||||
return myTestManager;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
00 Application
|
||||
01 1
|
||||
02 CodeGenerator
|
||||
03 Renamer
|
||||
04 UI
|
||||
05 AuTest
|
||||
06 Simples
|
||||
07 OutAndErr (tmp)
|
||||
08 C148C_TersePrincess (tmp)
|
||||
09 2
|
||||
10 Periods (tmp)
|
||||
11 3
|
||||
12 C148E_Porcelain
|
||||
13 ErrAndOut (tmp)
|
||||
14 JUnit
|
||||
15 4
|
||||
16 All in titled
|
||||
17 All in titled2
|
||||
18 5
|
||||
19 All in titled3
|
||||
20 All in titled4
|
||||
21 All in titled5
|
||||
16 Defaults
|
||||
...
|
||||
*/
|
||||
private static final String FOLDERS_CONFIGURATION = " <component name=\"RunManager\" selected=\"Application.UI\">\n" +
|
||||
" <configuration default=\"false\" name=\"OutAndErr\" type=\"Application\" factoryName=\"Application\" folderName=\"1\" temporary=\"true\">\n" +
|
||||
" <extension name=\"coverage\" enabled=\"false\" merge=\"false\" sample_coverage=\"true\" runner=\"idea\" />\n" +
|
||||
" <option name=\"MAIN_CLASS_NAME\" value=\"OutAndErr\" />\n" +
|
||||
" <option name=\"VM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"PROGRAM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"WORKING_DIRECTORY\" value=\"file://$PROJECT_DIR$\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH_ENABLED\" value=\"false\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH\" value=\"\" />\n" +
|
||||
" <option name=\"ENABLE_SWING_INSPECTOR\" value=\"false\" />\n" +
|
||||
" <option name=\"ENV_VARIABLES\" />\n" +
|
||||
" <option name=\"PASS_PARENT_ENVS\" value=\"true\" />\n" +
|
||||
" <module name=\"titled\" />\n" +
|
||||
" <envs />\n" +
|
||||
" <RunnerSettings RunnerId=\"Debug\">\n" +
|
||||
" <option name=\"DEBUG_PORT\" value=\"\" />\n" +
|
||||
" <option name=\"TRANSPORT\" value=\"0\" />\n" +
|
||||
" <option name=\"LOCAL\" value=\"true\" />\n" +
|
||||
" </RunnerSettings>\n" +
|
||||
" <RunnerSettings RunnerId=\"Run\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Debug\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Run\" />\n" +
|
||||
" <method />\n" +
|
||||
" </configuration>\n" +
|
||||
" <configuration default=\"false\" name=\"C148C_TersePrincess\" type=\"Application\" factoryName=\"Application\" folderName=\"1\" temporary=\"true\">\n" +
|
||||
" <extension name=\"coverage\" enabled=\"false\" merge=\"false\" sample_coverage=\"true\" runner=\"idea\" />\n" +
|
||||
" <option name=\"MAIN_CLASS_NAME\" value=\"C148C_TersePrincess\" />\n" +
|
||||
" <option name=\"VM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"PROGRAM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"WORKING_DIRECTORY\" value=\"file://$PROJECT_DIR$\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH_ENABLED\" value=\"false\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH\" value=\"\" />\n" +
|
||||
" <option name=\"ENABLE_SWING_INSPECTOR\" value=\"false\" />\n" +
|
||||
" <option name=\"ENV_VARIABLES\" />\n" +
|
||||
" <option name=\"PASS_PARENT_ENVS\" value=\"true\" />\n" +
|
||||
" <module name=\"titled\" />\n" +
|
||||
" <envs />\n" +
|
||||
" <RunnerSettings RunnerId=\"Debug\">\n" +
|
||||
" <option name=\"DEBUG_PORT\" value=\"\" />\n" +
|
||||
" <option name=\"TRANSPORT\" value=\"0\" />\n" +
|
||||
" <option name=\"LOCAL\" value=\"true\" />\n" +
|
||||
" </RunnerSettings>\n" +
|
||||
" <RunnerSettings RunnerId=\"Run\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Debug\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Run\" />\n" +
|
||||
" <method />\n" +
|
||||
" </configuration>\n" +
|
||||
" <configuration default=\"false\" name=\"Periods\" type=\"Application\" factoryName=\"Application\" folderName=\"2\" temporary=\"true\">\n" +
|
||||
" <extension name=\"coverage\" enabled=\"false\" merge=\"false\" sample_coverage=\"true\" runner=\"idea\">\n" +
|
||||
" <pattern>\n" +
|
||||
" <option name=\"PATTERN\" value=\"v.*\" />\n" +
|
||||
" <option name=\"ENABLED\" value=\"true\" />\n" +
|
||||
" </pattern>\n" +
|
||||
" </extension>\n" +
|
||||
" <option name=\"MAIN_CLASS_NAME\" value=\"v.Periods\" />\n" +
|
||||
" <option name=\"VM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"PROGRAM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"WORKING_DIRECTORY\" value=\"file://$PROJECT_DIR$\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH_ENABLED\" value=\"false\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH\" value=\"\" />\n" +
|
||||
" <option name=\"ENABLE_SWING_INSPECTOR\" value=\"false\" />\n" +
|
||||
" <option name=\"ENV_VARIABLES\" />\n" +
|
||||
" <option name=\"PASS_PARENT_ENVS\" value=\"true\" />\n" +
|
||||
" <module name=\"titled\" />\n" +
|
||||
" <envs />\n" +
|
||||
" <RunnerSettings RunnerId=\"Debug\">\n" +
|
||||
" <option name=\"DEBUG_PORT\" value=\"\" />\n" +
|
||||
" <option name=\"TRANSPORT\" value=\"0\" />\n" +
|
||||
" <option name=\"LOCAL\" value=\"true\" />\n" +
|
||||
" </RunnerSettings>\n" +
|
||||
" <RunnerSettings RunnerId=\"Run\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Debug\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Run\" />\n" +
|
||||
" <method />\n" +
|
||||
" </configuration>\n" +
|
||||
" <configuration default=\"false\" name=\"ErrAndOut\" type=\"Application\" factoryName=\"Application\" folderName=\"3\" temporary=\"true\">\n" +
|
||||
" <extension name=\"coverage\" enabled=\"false\" merge=\"false\" sample_coverage=\"true\" runner=\"idea\" />\n" +
|
||||
" <option name=\"MAIN_CLASS_NAME\" value=\"ErrAndOut\" />\n" +
|
||||
" <option name=\"VM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"PROGRAM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"WORKING_DIRECTORY\" value=\"file://$PROJECT_DIR$\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH_ENABLED\" value=\"false\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH\" value=\"\" />\n" +
|
||||
" <option name=\"ENABLE_SWING_INSPECTOR\" value=\"false\" />\n" +
|
||||
" <option name=\"ENV_VARIABLES\" />\n" +
|
||||
" <option name=\"PASS_PARENT_ENVS\" value=\"true\" />\n" +
|
||||
" <module name=\"titled\" />\n" +
|
||||
" <envs />\n" +
|
||||
" <RunnerSettings RunnerId=\"Debug\">\n" +
|
||||
" <option name=\"DEBUG_PORT\" value=\"\" />\n" +
|
||||
" <option name=\"TRANSPORT\" value=\"0\" />\n" +
|
||||
" <option name=\"LOCAL\" value=\"true\" />\n" +
|
||||
" </RunnerSettings>\n" +
|
||||
" <RunnerSettings RunnerId=\"Run\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Debug\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Run\" />\n" +
|
||||
" <method />\n" +
|
||||
" </configuration>\n" +
|
||||
" <configuration default=\"true\" type=\"MavenRunConfiguration\" factoryName=\"Maven\">\n" +
|
||||
" <MavenSettings>\n" +
|
||||
" <option name=\"myGeneralSettings\" />\n" +
|
||||
" <option name=\"myRunnerSettings\" />\n" +
|
||||
" <option name=\"myRunnerParameters\">\n" +
|
||||
" <MavenRunnerParameters>\n" +
|
||||
" <option name=\"profiles\">\n" +
|
||||
" <set />\n" +
|
||||
" </option>\n" +
|
||||
" <option name=\"goals\">\n" +
|
||||
" <list />\n" +
|
||||
" </option>\n" +
|
||||
" <option name=\"profilesMap\">\n" +
|
||||
" <map />\n" +
|
||||
" </option>\n" +
|
||||
" <option name=\"workingDirPath\" value=\"\" />\n" +
|
||||
" </MavenRunnerParameters>\n" +
|
||||
" </option>\n" +
|
||||
" </MavenSettings>\n" +
|
||||
" <method />\n" +
|
||||
" </configuration>\n" +
|
||||
" <configuration default=\"true\" type=\"JUnit\" factoryName=\"JUnit\">\n" +
|
||||
" <extension name=\"coverage\" enabled=\"false\" merge=\"false\" sample_coverage=\"true\" runner=\"idea\" />\n" +
|
||||
" <module name=\"\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH_ENABLED\" value=\"false\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH\" value=\"\" />\n" +
|
||||
" <option name=\"PACKAGE_NAME\" />\n" +
|
||||
" <option name=\"MAIN_CLASS_NAME\" value=\"\" />\n" +
|
||||
" <option name=\"METHOD_NAME\" value=\"\" />\n" +
|
||||
" <option name=\"TEST_OBJECT\" value=\"class\" />\n" +
|
||||
" <option name=\"VM_PARAMETERS\" value=\"-ea\" />\n" +
|
||||
" <option name=\"PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"WORKING_DIRECTORY\" value=\"file://$PROJECT_DIR$\" />\n" +
|
||||
" <option name=\"ENV_VARIABLES\" />\n" +
|
||||
" <option name=\"PASS_PARENT_ENVS\" value=\"true\" />\n" +
|
||||
" <option name=\"TEST_SEARCH_SCOPE\">\n" +
|
||||
" <value defaultName=\"moduleWithDependencies\" />\n" +
|
||||
" </option>\n" +
|
||||
" <envs />\n" +
|
||||
" <patterns />\n" +
|
||||
" <method>\n" +
|
||||
" <option name=\"Make\" enabled=\"false\" />\n" +
|
||||
" </method>\n" +
|
||||
" </configuration>\n" +
|
||||
" <configuration default=\"true\" type=\"Application\" factoryName=\"Application\">\n" +
|
||||
" <extension name=\"coverage\" enabled=\"false\" merge=\"false\" sample_coverage=\"true\" runner=\"idea\" />\n" +
|
||||
" <option name=\"MAIN_CLASS_NAME\" value=\"\" />\n" +
|
||||
" <option name=\"VM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"PROGRAM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"WORKING_DIRECTORY\" value=\"file://$PROJECT_DIR$\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH_ENABLED\" value=\"false\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH\" value=\"\" />\n" +
|
||||
" <option name=\"ENABLE_SWING_INSPECTOR\" value=\"false\" />\n" +
|
||||
" <option name=\"ENV_VARIABLES\" />\n" +
|
||||
" <option name=\"PASS_PARENT_ENVS\" value=\"true\" />\n" +
|
||||
" <module name=\"\" />\n" +
|
||||
" <envs />\n" +
|
||||
" <method />\n" +
|
||||
" </configuration>\n" +
|
||||
" <configuration default=\"false\" name=\"CodeGenerator\" type=\"Application\" factoryName=\"Application\" folderName=\"1\">\n" +
|
||||
" <extension name=\"coverage\" enabled=\"false\" merge=\"false\" sample_coverage=\"true\" runner=\"idea\">\n" +
|
||||
" <pattern>\n" +
|
||||
" <option name=\"PATTERN\" value=\"codegen.*\" />\n" +
|
||||
" <option name=\"ENABLED\" value=\"true\" />\n" +
|
||||
" </pattern>\n" +
|
||||
" </extension>\n" +
|
||||
" <option name=\"MAIN_CLASS_NAME\" value=\"codegen.CodeGenerator\" />\n" +
|
||||
" <option name=\"VM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"PROGRAM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"WORKING_DIRECTORY\" value=\"file://$PROJECT_DIR$\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH_ENABLED\" value=\"false\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH\" value=\"\" />\n" +
|
||||
" <option name=\"ENABLE_SWING_INSPECTOR\" value=\"false\" />\n" +
|
||||
" <option name=\"ENV_VARIABLES\" />\n" +
|
||||
" <option name=\"PASS_PARENT_ENVS\" value=\"true\" />\n" +
|
||||
" <module name=\"titled\" />\n" +
|
||||
" <envs />\n" +
|
||||
" <RunnerSettings RunnerId=\"Run\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Run\" />\n" +
|
||||
" <method />\n" +
|
||||
" </configuration>\n" +
|
||||
" <configuration default=\"false\" name=\"Renamer\" type=\"Application\" factoryName=\"Application\" folderName=\"1\">\n" +
|
||||
" <extension name=\"coverage\" enabled=\"false\" merge=\"false\" sample_coverage=\"true\" runner=\"idea\" />\n" +
|
||||
" <option name=\"MAIN_CLASS_NAME\" value=\"Renamer\" />\n" +
|
||||
" <option name=\"VM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"PROGRAM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"WORKING_DIRECTORY\" value=\"file://$PROJECT_DIR$\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH_ENABLED\" value=\"false\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH\" value=\"\" />\n" +
|
||||
" <option name=\"ENABLE_SWING_INSPECTOR\" value=\"false\" />\n" +
|
||||
" <option name=\"ENV_VARIABLES\" />\n" +
|
||||
" <option name=\"PASS_PARENT_ENVS\" value=\"true\" />\n" +
|
||||
" <module name=\"titled\" />\n" +
|
||||
" <envs />\n" +
|
||||
" <RunnerSettings RunnerId=\"Debug\">\n" +
|
||||
" <option name=\"DEBUG_PORT\" value=\"\" />\n" +
|
||||
" <option name=\"TRANSPORT\" value=\"0\" />\n" +
|
||||
" <option name=\"LOCAL\" value=\"true\" />\n" +
|
||||
" </RunnerSettings>\n" +
|
||||
" <RunnerSettings RunnerId=\"Run\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Debug\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Run\" />\n" +
|
||||
" <method />\n" +
|
||||
" </configuration>\n" +
|
||||
" <configuration default=\"false\" name=\"UI\" type=\"Application\" factoryName=\"Application\" folderName=\"1\">\n" +
|
||||
" <extension name=\"coverage\" enabled=\"false\" merge=\"false\" sample_coverage=\"true\" runner=\"idea\" />\n" +
|
||||
" <option name=\"MAIN_CLASS_NAME\" value=\"UI\" />\n" +
|
||||
" <option name=\"VM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"PROGRAM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"WORKING_DIRECTORY\" value=\"file://$PROJECT_DIR$\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH_ENABLED\" value=\"false\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH\" value=\"\" />\n" +
|
||||
" <option name=\"ENABLE_SWING_INSPECTOR\" value=\"false\" />\n" +
|
||||
" <option name=\"ENV_VARIABLES\" />\n" +
|
||||
" <option name=\"PASS_PARENT_ENVS\" value=\"true\" />\n" +
|
||||
" <module name=\"titled\" />\n" +
|
||||
" <envs />\n" +
|
||||
" <RunnerSettings RunnerId=\"Debug\">\n" +
|
||||
" <option name=\"DEBUG_PORT\" value=\"\" />\n" +
|
||||
" <option name=\"TRANSPORT\" value=\"0\" />\n" +
|
||||
" <option name=\"LOCAL\" value=\"true\" />\n" +
|
||||
" </RunnerSettings>\n" +
|
||||
" <RunnerSettings RunnerId=\"Run\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Debug\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Run\" />\n" +
|
||||
" <method />\n" +
|
||||
" </configuration>\n" +
|
||||
" <configuration default=\"false\" name=\"AuTest\" type=\"Application\" factoryName=\"Application\" folderName=\"1\">\n" +
|
||||
" <extension name=\"coverage\" enabled=\"false\" merge=\"false\" sample_coverage=\"true\" runner=\"idea\">\n" +
|
||||
" <pattern>\n" +
|
||||
" <option name=\"PATTERN\" value=\"au.*\" />\n" +
|
||||
" <option name=\"ENABLED\" value=\"true\" />\n" +
|
||||
" </pattern>\n" +
|
||||
" </extension>\n" +
|
||||
" <option name=\"MAIN_CLASS_NAME\" value=\"au.AuTest\" />\n" +
|
||||
" <option name=\"VM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"PROGRAM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"WORKING_DIRECTORY\" value=\"file://$PROJECT_DIR$\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH_ENABLED\" value=\"false\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH\" value=\"\" />\n" +
|
||||
" <option name=\"ENABLE_SWING_INSPECTOR\" value=\"false\" />\n" +
|
||||
" <option name=\"ENV_VARIABLES\" />\n" +
|
||||
" <option name=\"PASS_PARENT_ENVS\" value=\"true\" />\n" +
|
||||
" <module name=\"titled\" />\n" +
|
||||
" <envs />\n" +
|
||||
" <RunnerSettings RunnerId=\"Debug\">\n" +
|
||||
" <option name=\"DEBUG_PORT\" value=\"\" />\n" +
|
||||
" <option name=\"TRANSPORT\" value=\"0\" />\n" +
|
||||
" <option name=\"LOCAL\" value=\"true\" />\n" +
|
||||
" </RunnerSettings>\n" +
|
||||
" <RunnerSettings RunnerId=\"Run\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Debug\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Run\" />\n" +
|
||||
" <method />\n" +
|
||||
" </configuration>\n" +
|
||||
" <configuration default=\"false\" name=\"Simples\" type=\"Application\" factoryName=\"Application\" folderName=\"1\">\n" +
|
||||
" <extension name=\"coverage\" enabled=\"false\" merge=\"false\" sample_coverage=\"true\" runner=\"idea\" />\n" +
|
||||
" <option name=\"MAIN_CLASS_NAME\" value=\"Simples\" />\n" +
|
||||
" <option name=\"VM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"PROGRAM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"WORKING_DIRECTORY\" value=\"file://$PROJECT_DIR$\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH_ENABLED\" value=\"false\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH\" value=\"\" />\n" +
|
||||
" <option name=\"ENABLE_SWING_INSPECTOR\" value=\"false\" />\n" +
|
||||
" <option name=\"ENV_VARIABLES\" />\n" +
|
||||
" <option name=\"PASS_PARENT_ENVS\" value=\"true\" />\n" +
|
||||
" <module name=\"titled\" />\n" +
|
||||
" <envs />\n" +
|
||||
" <RunnerSettings RunnerId=\"Debug\">\n" +
|
||||
" <option name=\"DEBUG_PORT\" value=\"\" />\n" +
|
||||
" <option name=\"TRANSPORT\" value=\"0\" />\n" +
|
||||
" <option name=\"LOCAL\" value=\"true\" />\n" +
|
||||
" </RunnerSettings>\n" +
|
||||
" <RunnerSettings RunnerId=\"Run\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Debug\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Run\" />\n" +
|
||||
" <method />\n" +
|
||||
" </configuration>\n" +
|
||||
" <configuration default=\"false\" name=\"C148E_Porcelain\" type=\"Application\" factoryName=\"Application\" folderName=\"3\">\n" +
|
||||
" <extension name=\"coverage\" enabled=\"false\" merge=\"false\" sample_coverage=\"true\" runner=\"idea\" />\n" +
|
||||
" <option name=\"MAIN_CLASS_NAME\" value=\"C148E_Porcelain\" />\n" +
|
||||
" <option name=\"VM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"PROGRAM_PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"WORKING_DIRECTORY\" value=\"file://$PROJECT_DIR$\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH_ENABLED\" value=\"false\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH\" value=\"\" />\n" +
|
||||
" <option name=\"ENABLE_SWING_INSPECTOR\" value=\"false\" />\n" +
|
||||
" <option name=\"ENV_VARIABLES\" />\n" +
|
||||
" <option name=\"PASS_PARENT_ENVS\" value=\"true\" />\n" +
|
||||
" <module name=\"titled\" />\n" +
|
||||
" <envs />\n" +
|
||||
" <RunnerSettings RunnerId=\"Debug\">\n" +
|
||||
" <option name=\"DEBUG_PORT\" value=\"\" />\n" +
|
||||
" <option name=\"TRANSPORT\" value=\"0\" />\n" +
|
||||
" <option name=\"LOCAL\" value=\"true\" />\n" +
|
||||
" </RunnerSettings>\n" +
|
||||
" <RunnerSettings RunnerId=\"Run\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Debug\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Run\" />\n" +
|
||||
" <method />\n" +
|
||||
" </configuration>\n" +
|
||||
" <configuration default=\"false\" name=\"All in titled\" type=\"JUnit\" factoryName=\"JUnit\" folderName=\"4\">\n" +
|
||||
" <output_file path=\"C:/tst.txt\" is_save=\"true\" />\n" +
|
||||
" <extension name=\"coverage\" enabled=\"false\" merge=\"false\" sample_coverage=\"true\" runner=\"idea\" />\n" +
|
||||
" <module name=\"titled\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH_ENABLED\" value=\"false\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH\" value=\"\" />\n" +
|
||||
" <option name=\"PACKAGE_NAME\" value=\"\" />\n" +
|
||||
" <option name=\"MAIN_CLASS_NAME\" value=\"\" />\n" +
|
||||
" <option name=\"METHOD_NAME\" value=\"\" />\n" +
|
||||
" <option name=\"TEST_OBJECT\" value=\"package\" />\n" +
|
||||
" <option name=\"VM_PARAMETERS\" value=\"-ea\" />\n" +
|
||||
" <option name=\"PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"WORKING_DIRECTORY\" value=\"file://$PROJECT_DIR$\" />\n" +
|
||||
" <option name=\"ENV_VARIABLES\" />\n" +
|
||||
" <option name=\"PASS_PARENT_ENVS\" value=\"true\" />\n" +
|
||||
" <option name=\"TEST_SEARCH_SCOPE\">\n" +
|
||||
" <value defaultName=\"moduleWithDependencies\" />\n" +
|
||||
" </option>\n" +
|
||||
" <envs />\n" +
|
||||
" <patterns />\n" +
|
||||
" <RunnerSettings RunnerId=\"Debug\">\n" +
|
||||
" <option name=\"DEBUG_PORT\" value=\"\" />\n" +
|
||||
" <option name=\"TRANSPORT\" value=\"0\" />\n" +
|
||||
" <option name=\"LOCAL\" value=\"true\" />\n" +
|
||||
" </RunnerSettings>\n" +
|
||||
" <RunnerSettings RunnerId=\"Run\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Debug\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Run\" />\n" +
|
||||
" <method>\n" +
|
||||
" <option name=\"Make\" enabled=\"true\" />\n" +
|
||||
" </method>\n" +
|
||||
" </configuration>\n" +
|
||||
" <configuration default=\"false\" name=\"All in titled2\" type=\"JUnit\" factoryName=\"JUnit\" folderName=\"4\">\n" +
|
||||
" <output_file path=\"C:/tst.txt\" is_save=\"true\" />\n" +
|
||||
" <extension name=\"coverage\" enabled=\"false\" merge=\"false\" sample_coverage=\"true\" runner=\"idea\" />\n" +
|
||||
" <module name=\"titled\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH_ENABLED\" value=\"false\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH\" value=\"\" />\n" +
|
||||
" <option name=\"PACKAGE_NAME\" value=\"\" />\n" +
|
||||
" <option name=\"MAIN_CLASS_NAME\" value=\"\" />\n" +
|
||||
" <option name=\"METHOD_NAME\" value=\"\" />\n" +
|
||||
" <option name=\"TEST_OBJECT\" value=\"package\" />\n" +
|
||||
" <option name=\"VM_PARAMETERS\" value=\"-ea\" />\n" +
|
||||
" <option name=\"PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"WORKING_DIRECTORY\" value=\"file://$PROJECT_DIR$\" />\n" +
|
||||
" <option name=\"ENV_VARIABLES\" />\n" +
|
||||
" <option name=\"PASS_PARENT_ENVS\" value=\"true\" />\n" +
|
||||
" <option name=\"TEST_SEARCH_SCOPE\">\n" +
|
||||
" <value defaultName=\"moduleWithDependencies\" />\n" +
|
||||
" </option>\n" +
|
||||
" <envs />\n" +
|
||||
" <patterns />\n" +
|
||||
" <RunnerSettings RunnerId=\"Debug\">\n" +
|
||||
" <option name=\"DEBUG_PORT\" value=\"\" />\n" +
|
||||
" <option name=\"TRANSPORT\" value=\"0\" />\n" +
|
||||
" <option name=\"LOCAL\" value=\"true\" />\n" +
|
||||
" </RunnerSettings>\n" +
|
||||
" <RunnerSettings RunnerId=\"Run\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Debug\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Run\" />\n" +
|
||||
" <method>\n" +
|
||||
" <option name=\"Make\" enabled=\"true\" />\n" +
|
||||
" </method>\n" +
|
||||
" </configuration>\n" +
|
||||
" <configuration default=\"false\" name=\"All in titled3\" type=\"JUnit\" factoryName=\"JUnit\" folderName=\"5\">\n" +
|
||||
" <output_file path=\"C:/tst.txt\" is_save=\"true\" />\n" +
|
||||
" <extension name=\"coverage\" enabled=\"false\" merge=\"false\" sample_coverage=\"true\" runner=\"idea\" />\n" +
|
||||
" <module name=\"titled\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH_ENABLED\" value=\"false\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH\" value=\"\" />\n" +
|
||||
" <option name=\"PACKAGE_NAME\" value=\"\" />\n" +
|
||||
" <option name=\"MAIN_CLASS_NAME\" value=\"\" />\n" +
|
||||
" <option name=\"METHOD_NAME\" value=\"\" />\n" +
|
||||
" <option name=\"TEST_OBJECT\" value=\"package\" />\n" +
|
||||
" <option name=\"VM_PARAMETERS\" value=\"-ea\" />\n" +
|
||||
" <option name=\"PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"WORKING_DIRECTORY\" value=\"file://$PROJECT_DIR$\" />\n" +
|
||||
" <option name=\"ENV_VARIABLES\" />\n" +
|
||||
" <option name=\"PASS_PARENT_ENVS\" value=\"true\" />\n" +
|
||||
" <option name=\"TEST_SEARCH_SCOPE\">\n" +
|
||||
" <value defaultName=\"moduleWithDependencies\" />\n" +
|
||||
" </option>\n" +
|
||||
" <envs />\n" +
|
||||
" <patterns />\n" +
|
||||
" <RunnerSettings RunnerId=\"Debug\">\n" +
|
||||
" <option name=\"DEBUG_PORT\" value=\"\" />\n" +
|
||||
" <option name=\"TRANSPORT\" value=\"0\" />\n" +
|
||||
" <option name=\"LOCAL\" value=\"true\" />\n" +
|
||||
" </RunnerSettings>\n" +
|
||||
" <RunnerSettings RunnerId=\"Run\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Debug\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Run\" />\n" +
|
||||
" <method>\n" +
|
||||
" <option name=\"Make\" enabled=\"true\" />\n" +
|
||||
" </method>\n" +
|
||||
" </configuration>\n" +
|
||||
" <configuration default=\"false\" name=\"All in titled4\" type=\"JUnit\" factoryName=\"JUnit\" folderName=\"5\">\n" +
|
||||
" <output_file path=\"C:/tst.txt\" is_save=\"true\" />\n" +
|
||||
" <extension name=\"coverage\" enabled=\"false\" merge=\"false\" sample_coverage=\"true\" runner=\"idea\" />\n" +
|
||||
" <module name=\"titled\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH_ENABLED\" value=\"false\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH\" value=\"\" />\n" +
|
||||
" <option name=\"PACKAGE_NAME\" value=\"\" />\n" +
|
||||
" <option name=\"MAIN_CLASS_NAME\" value=\"\" />\n" +
|
||||
" <option name=\"METHOD_NAME\" value=\"\" />\n" +
|
||||
" <option name=\"TEST_OBJECT\" value=\"package\" />\n" +
|
||||
" <option name=\"VM_PARAMETERS\" value=\"-ea\" />\n" +
|
||||
" <option name=\"PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"WORKING_DIRECTORY\" value=\"file://$PROJECT_DIR$\" />\n" +
|
||||
" <option name=\"ENV_VARIABLES\" />\n" +
|
||||
" <option name=\"PASS_PARENT_ENVS\" value=\"true\" />\n" +
|
||||
" <option name=\"TEST_SEARCH_SCOPE\">\n" +
|
||||
" <value defaultName=\"moduleWithDependencies\" />\n" +
|
||||
" </option>\n" +
|
||||
" <envs />\n" +
|
||||
" <patterns />\n" +
|
||||
" <RunnerSettings RunnerId=\"Debug\">\n" +
|
||||
" <option name=\"DEBUG_PORT\" value=\"\" />\n" +
|
||||
" <option name=\"TRANSPORT\" value=\"0\" />\n" +
|
||||
" <option name=\"LOCAL\" value=\"true\" />\n" +
|
||||
" </RunnerSettings>\n" +
|
||||
" <RunnerSettings RunnerId=\"Run\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Debug\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Run\" />\n" +
|
||||
" <method>\n" +
|
||||
" <option name=\"Make\" enabled=\"true\" />\n" +
|
||||
" </method>\n" +
|
||||
" </configuration>\n" +
|
||||
" <configuration default=\"false\" name=\"All in titled5\" type=\"JUnit\" factoryName=\"JUnit\" temporary=\"true\">\n" +
|
||||
" <output_file path=\"C:/tst.txt\" is_save=\"true\" />\n" +
|
||||
" <extension name=\"coverage\" enabled=\"false\" merge=\"false\" sample_coverage=\"true\" runner=\"idea\" />\n" +
|
||||
" <module name=\"titled\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH_ENABLED\" value=\"false\" />\n" +
|
||||
" <option name=\"ALTERNATIVE_JRE_PATH\" value=\"\" />\n" +
|
||||
" <option name=\"PACKAGE_NAME\" value=\"\" />\n" +
|
||||
" <option name=\"MAIN_CLASS_NAME\" value=\"\" />\n" +
|
||||
" <option name=\"METHOD_NAME\" value=\"\" />\n" +
|
||||
" <option name=\"TEST_OBJECT\" value=\"package\" />\n" +
|
||||
" <option name=\"VM_PARAMETERS\" value=\"-ea\" />\n" +
|
||||
" <option name=\"PARAMETERS\" value=\"\" />\n" +
|
||||
" <option name=\"WORKING_DIRECTORY\" value=\"file://$PROJECT_DIR$\" />\n" +
|
||||
" <option name=\"ENV_VARIABLES\" />\n" +
|
||||
" <option name=\"PASS_PARENT_ENVS\" value=\"true\" />\n" +
|
||||
" <option name=\"TEST_SEARCH_SCOPE\">\n" +
|
||||
" <value defaultName=\"moduleWithDependencies\" />\n" +
|
||||
" </option>\n" +
|
||||
" <envs />\n" +
|
||||
" <patterns />\n" +
|
||||
" <RunnerSettings RunnerId=\"Debug\">\n" +
|
||||
" <option name=\"DEBUG_PORT\" value=\"\" />\n" +
|
||||
" <option name=\"TRANSPORT\" value=\"0\" />\n" +
|
||||
" <option name=\"LOCAL\" value=\"true\" />\n" +
|
||||
" </RunnerSettings>\n" +
|
||||
" <RunnerSettings RunnerId=\"Run\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Debug\" />\n" +
|
||||
" <ConfigurationWrapper RunnerId=\"Run\" />\n" +
|
||||
" <method>\n" +
|
||||
" <option name=\"Make\" enabled=\"true\" />\n" +
|
||||
" </method>\n" +
|
||||
" </configuration>\n" +
|
||||
" <list size=\"16\">\n" +
|
||||
" <item index=\"0\" class=\"java.lang.String\" itemvalue=\"Application.CodeGenerator\" />\n" +
|
||||
" <item index=\"1\" class=\"java.lang.String\" itemvalue=\"Application.Renamer\" />\n" +
|
||||
" <item index=\"2\" class=\"java.lang.String\" itemvalue=\"Application.UI\" />\n" +
|
||||
" <item index=\"3\" class=\"java.lang.String\" itemvalue=\"Application.AuTest\" />\n" +
|
||||
" <item index=\"4\" class=\"java.lang.String\" itemvalue=\"Application.Simples\" />\n" +
|
||||
" <item index=\"5\" class=\"java.lang.String\" itemvalue=\"Application.OutAndErr\" />\n" +
|
||||
" <item index=\"6\" class=\"java.lang.String\" itemvalue=\"Application.C148C_TersePrincess\" />\n" +
|
||||
" <item index=\"7\" class=\"java.lang.String\" itemvalue=\"Application.Periods\" />\n" +
|
||||
" <item index=\"8\" class=\"java.lang.String\" itemvalue=\"Application.C148E_Porcelain\" />\n" +
|
||||
" <item index=\"9\" class=\"java.lang.String\" itemvalue=\"Application.ErrAndOut\" />\n" +
|
||||
" <item index=\"10\" class=\"java.lang.String\" itemvalue=\"JUnit.All in titled\" />\n" +
|
||||
" <item index=\"11\" class=\"java.lang.String\" itemvalue=\"JUnit.All in titled2\" />\n" +
|
||||
" <item index=\"12\" class=\"java.lang.String\" itemvalue=\"JUnit.All in titled3\" />\n" +
|
||||
" <item index=\"13\" class=\"java.lang.String\" itemvalue=\"JUnit.All in titled4\" />\n" +
|
||||
" <item index=\"14\" class=\"java.lang.String\" itemvalue=\"JUnit.All in titled5\" />\n" +
|
||||
" </list>\n" +
|
||||
" <recent_temporary>\n" +
|
||||
" <list size=\"4\">\n" +
|
||||
" <item index=\"0\" class=\"java.lang.String\" itemvalue=\"Application.ErrAndOut\" />\n" +
|
||||
" <item index=\"1\" class=\"java.lang.String\" itemvalue=\"Application.Periods\" />\n" +
|
||||
" <item index=\"2\" class=\"java.lang.String\" itemvalue=\"Application.OutAndErr\" />\n" +
|
||||
" <item index=\"3\" class=\"java.lang.String\" itemvalue=\"Application.C148C_TersePrincess\" />\n" +
|
||||
" </list>\n" +
|
||||
" </recent_temporary>\n" +
|
||||
" <configuration name=\"<template>\" type=\"WebApp\" default=\"true\" selected=\"false\">\n" +
|
||||
" <Host>localhost</Host>\n" +
|
||||
" <Port>5050</Port>\n" +
|
||||
" </configuration>\n" +
|
||||
" </component>\n";
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.intellij.execution;
|
||||
|
||||
import com.intellij.util.Assertion;
|
||||
import com.intellij.util.PathsList;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class PathListBuilderTest extends TestCase {
|
||||
private final PathsList myBuilder = new PathsList();
|
||||
private final Assertion CHECK = new Assertion();
|
||||
|
||||
public void testOrder() {
|
||||
myBuilder.add("a");
|
||||
myBuilder.addFirst("2");
|
||||
myBuilder.addTail("A");
|
||||
myBuilder.addFirst("1");
|
||||
myBuilder.add("b");
|
||||
myBuilder.addTail("B");
|
||||
CHECK.compareAll(new String[]{"1", "2", "a", "b", "A", "B"}, myBuilder.getPathList());
|
||||
}
|
||||
|
||||
public void testDuplications() {
|
||||
myBuilder.add("b");
|
||||
myBuilder.add("b");
|
||||
|
||||
myBuilder.addFirst("a");
|
||||
myBuilder.addFirst("a");
|
||||
|
||||
myBuilder.addTail("c");
|
||||
myBuilder.addTail("c");
|
||||
|
||||
CHECK.compareAll(new String[]{"a", "b", "c"}, myBuilder.getPathList());
|
||||
}
|
||||
|
||||
public void testComplexDuplications() {
|
||||
myBuilder.add("a" + File.pathSeparatorChar + "b");
|
||||
myBuilder.add("c" + File.pathSeparatorChar + "b");
|
||||
CHECK.compareAll(new String[]{"a", "b", "c"}, myBuilder.getPathList());
|
||||
}
|
||||
|
||||
public void testAddTwice() {
|
||||
myBuilder.add("a" + File.pathSeparatorChar + "a");
|
||||
myBuilder.add("b");
|
||||
CHECK.compareAll(new String[]{"a", "b"}, myBuilder.getPathList());
|
||||
}
|
||||
|
||||
public void testAddFirstTwice() {
|
||||
myBuilder.addFirst("b" + File.pathSeparatorChar + "b");
|
||||
myBuilder.addFirst("a");
|
||||
CHECK.compareAll(new String[]{"a", "b"}, myBuilder.getPathList());
|
||||
}
|
||||
|
||||
public void testAsString() {
|
||||
myBuilder.add("a" + File.pathSeparatorChar + "b" + File.pathSeparatorChar);
|
||||
myBuilder.add("c" + File.pathSeparatorChar);
|
||||
assertEquals("a" + File.pathSeparatorChar + "b" + File.pathSeparatorChar + "c", myBuilder.getPathsString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.intellij.execution.filters;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
public class RegexpFilterTest extends TestCase {
|
||||
private static final String FILE = RegexpFilter.FILE_PATH_MACROS;
|
||||
private static final String LINE = RegexpFilter.LINE_MACROS;
|
||||
private static final String COLUMN = RegexpFilter.COLUMN_MACROS;
|
||||
private RegexpFilter myFilter;
|
||||
|
||||
public void test() {
|
||||
createFilter(FILE);
|
||||
String line = "C:\\Work\\SampleProjects\\makeOutput.cmd";
|
||||
Filter.Result result = applyFilter(line);
|
||||
assertEquals(0, result.highlightStartOffset);
|
||||
assertEquals(line.length(), result.highlightEndOffset);
|
||||
HLInfo info = (HLInfo)result.hyperlinkInfo;
|
||||
info.checkInfo(line, 0, 0);
|
||||
}
|
||||
|
||||
public void testFileLineComlumn() {
|
||||
createFilter(FILE + "x" + LINE + "y" + COLUMN);
|
||||
String fileName = "C:\\file";
|
||||
Filter.Result result = applyFilter(fileName + "x12y34");
|
||||
assertEquals(0, result.highlightStartOffset);
|
||||
assertEquals(fileName.length(), result.highlightEndOffset);
|
||||
HLInfo info = (HLInfo) result.hyperlinkInfo;
|
||||
info.checkInfo(fileName, 11, 33);
|
||||
}
|
||||
|
||||
public void testFileLineColumnWithTail() {
|
||||
createFilter(FILE + ":" + LINE + ":" + COLUMN + ".*");
|
||||
String fileName = "C:/file";
|
||||
Filter.Result result = applyFilter(fileName + ":12:34.1tail2");
|
||||
assertEquals(0, result.highlightStartOffset);
|
||||
assertEquals(fileName.length(), result.highlightEndOffset);
|
||||
HLInfo info = (HLInfo) result.hyperlinkInfo;
|
||||
info.checkInfo(fileName, 11, 33);
|
||||
}
|
||||
|
||||
public void test4814() {
|
||||
createFilter(FILE + ":" + LINE + ":" + COLUMN + ".*");
|
||||
String fileName = "C:/work/dev/C3C/V9_9_9_9/src/java/strata/pswitch/ss5e/dataSync/BFGParser.java";
|
||||
String line = fileName + ":544:13:544:13:";
|
||||
Filter.Result result = applyFilter(line);
|
||||
HLInfo info = (HLInfo) result.hyperlinkInfo;
|
||||
info.checkInfo(fileName, 543, 12);
|
||||
}
|
||||
|
||||
public void testWithSpaces() {
|
||||
createFilter("$FILE_PATH$\\s+\\($LINE$\\:$COLUMN$\\)");
|
||||
String line = "C:\\d ir\\file.ext (1:2)message";
|
||||
Filter.Result result = applyFilter(line);
|
||||
HLInfo info = (HLInfo)result.hyperlinkInfo;
|
||||
info.checkInfo("C:\\d ir\\file.ext", 0, 1);
|
||||
}
|
||||
|
||||
private Filter.Result applyFilter(String line) {
|
||||
return myFilter.applyFilter(line, line.length());
|
||||
}
|
||||
|
||||
private void createFilter(String string) {
|
||||
myFilter = new RegexpFilter(null, string){
|
||||
@Override
|
||||
protected HyperlinkInfo createOpenFileHyperlink(String filePath, int line, int column) {
|
||||
return createOpenFile(filePath, line, column);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public HyperlinkInfo createOpenFile(String fileName, int line, int comumn) {return new HLInfo(fileName, line, comumn); }
|
||||
|
||||
private static class HLInfo implements HyperlinkInfo {
|
||||
public String myFileName;
|
||||
public int myLine;
|
||||
public int myColumn;
|
||||
|
||||
public HLInfo(String fileName, int line, int column) {
|
||||
myColumn = column;
|
||||
myFileName = fileName;
|
||||
myLine = line;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void navigate(Project project) { }
|
||||
|
||||
public void checkInfo(String fileName, int line, int column) {
|
||||
assertEquals(fileName, myFileName);
|
||||
assertEquals(line, myLine);
|
||||
assertEquals(column, myColumn);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user