Running JUnit tests, initial.

This commit is contained in:
Maxim Shafirov
2012-02-16 20:21:46 +04:00
parent c41a186f81
commit fccc991c19
9 changed files with 137 additions and 6 deletions
+20
View File
@@ -0,0 +1,20 @@
<component name="ArtifactManager">
<artifact name="LocalPlugin">
<output-path>$PROJECT_DIR$/out/LocalPlugin</output-path>
<root id="root">
<element id="directory" name="lib">
<element id="archive" name="KotlinPlugin.jar">
<element id="module-output" name="backend" />
<element id="module-output" name="frontend" />
<element id="module-output" name="frontend.java" />
<element id="module-output" name="stdlib" />
<element id="module-output" name="util" />
<element id="module-output" name="idea" />
<element id="module-output" name="jet.as.java.psi" />
<element id="module-output" name="j2k" />
</element>
<element id="library" level="project" name="asm" />
</element>
</root>
</artifact>
</component>
+9
View File
@@ -0,0 +1,9 @@
<component name="libraryTable">
<library name="junit-plugin">
<CLASSES>
<root url="jar://$PROJECT_DIR$/ideaSDK/plugins/junit/lib/idea-junit.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
+1
View File
@@ -13,6 +13,7 @@
<module fileurl="file://$PROJECT_DIR$/compiler/frontend.java/frontend.java.iml" filepath="$PROJECT_DIR$/compiler/frontend.java/frontend.java.iml" />
<module fileurl="file://$PROJECT_DIR$/grammar/grammar.iml" filepath="$PROJECT_DIR$/grammar/grammar.iml" />
<module fileurl="file://$PROJECT_DIR$/idea/idea.iml" filepath="$PROJECT_DIR$/idea/idea.iml" />
<module fileurl="file://$PROJECT_DIR$/idea_runner/idea_runner.iml" filepath="$PROJECT_DIR$/idea_runner/idea_runner.iml" />
<module fileurl="file://$PROJECT_DIR$/j2k/j2k.iml" filepath="$PROJECT_DIR$/j2k/j2k.iml" />
<module fileurl="file://$PROJECT_DIR$/j2k/tests/j2k-tests.iml" filepath="$PROJECT_DIR$/j2k/tests/j2k-tests.iml" />
<module fileurl="file://$PROJECT_DIR$/compiler/jet.as.java.psi/jet.as.java.psi.iml" filepath="$PROJECT_DIR$/compiler/jet.as.java.psi/jet.as.java.psi.iml" />
+7 -3
View File
@@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="IDEA" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" value="com.intellij.idea.Main" />
<option name="VM_PARAMETERS" value="-Xmx500m -XX:ReservedCodeCacheSize=64m -XX:MaxPermSize=250m -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=../system-idea -Didea.config.path=../config -Dapple.laf.useScreenMenuBar=true" />
<option name="VM_PARAMETERS" value="-Xmx500m -XX:ReservedCodeCacheSize=64m -XX:MaxPermSize=250m -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=../system-idea -Didea.config.path=../config -Dapple.laf.useScreenMenuBar=true -Dplugin.path=$PROJECT_DIR$/out/LocalPlugin" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/ideaSDK/bin" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@@ -9,7 +9,7 @@
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="idea" />
<module name="idea_runner" />
<envs />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="" />
@@ -19,6 +19,10 @@
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Debug" />
<ConfigurationWrapper RunnerId="Run" />
<method />
<method>
<option name="BuildArtifacts" enabled="true">
<artifact name="LocalPlugin" />
</option>
</method>
</configuration>
</component>
@@ -2,7 +2,7 @@
<configuration default="false" name="IDEA (No ProcessCanceledException)" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="com.intellij.idea.Main" />
<option name="VM_PARAMETERS" value="-Xmx500m -XX:ReservedCodeCacheSize=64m -XX:MaxPermSize=250m -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=../system-idea -Didea.config.path=../config -Dapple.laf.useScreenMenuBar=true -Didea.ProcessCanceledException=disabled" />
<option name="VM_PARAMETERS" value="-Xmx500m -XX:ReservedCodeCacheSize=64m -XX:MaxPermSize=250m -ea -Didea.is.internal=true -Didea.debug.mode=true -Didea.system.path=../system-idea -Didea.config.path=../config -Dapple.laf.useScreenMenuBar=true -Dplugin.path=$PROJECT_DIR$/out/LocalPlugin -Didea.ProcessCanceledException=disabled" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$/ideaSDK/bin" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@@ -10,7 +10,7 @@
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="idea" />
<module name="idea_runner" />
<envs />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="" />
@@ -20,6 +20,10 @@
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Debug" />
<ConfigurationWrapper RunnerId="Run" />
<method />
<method>
<option name="BuildArtifacts" enabled="true">
<artifact name="LocalPlugin" />
</option>
</method>
</configuration>
</component>
+1
View File
@@ -24,6 +24,7 @@
<orderEntry type="module" module-name="compiler-tests" scope="TEST" />
<orderEntry type="module" module-name="jet.as.java.psi" />
<orderEntry type="library" name="idea-full" level="project" />
<orderEntry type="library" scope="PROVIDED" name="junit-plugin" level="project" />
<orderEntry type="module" module-name="j2k" />
</component>
</module>
+3
View File
@@ -4,6 +4,8 @@
<version>@snapshot@</version>
<vendor>JetBrains</vendor>
<depends optional="true">JUnit</depends>
<project-components>
<component>
<implementation-class>org.jetbrains.jet.plugin.compiler.JetCompilerManager</implementation-class>
@@ -106,6 +108,7 @@
<documentationProvider implementation="org.jetbrains.jet.plugin.JetQuickDocumentationProvider"/>
<configurationType implementation="org.jetbrains.jet.plugin.run.JetRunConfigurationType"/>
<configurationProducer implementation="org.jetbrains.jet.plugin.run.JetRunConfigurationProducer"/>
<configurationProducer implementation="org.jetbrains.jet.plugin.run.JetJUnitConfigurationProducer"/>
<codeInsight.lineMarkerProvider language="jet" implementationClass="org.jetbrains.jet.plugin.annotations.JetLineMarkerProvider"/>
<iconProvider implementation="org.jetbrains.jet.plugin.JetIconProvider"/>
<elementDescriptionProvider implementation="org.jetbrains.jet.plugin.findUsages.JetElementDescriptionProvider"/>
@@ -0,0 +1,78 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @author max
*/
package org.jetbrains.jet.plugin.run;
import com.intellij.execution.JavaRunConfigurationExtensionManager;
import com.intellij.execution.Location;
import com.intellij.execution.RunnerAndConfigurationSettings;
import com.intellij.execution.actions.ConfigurationContext;
import com.intellij.execution.junit.JUnitConfiguration;
import com.intellij.execution.junit.JUnitConfigurationType;
import com.intellij.execution.junit.RuntimeConfigurationProducer;
import com.intellij.openapi.module.Module;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.intellij.psi.util.PsiTreeUtil;
import org.jetbrains.jet.asJava.JetLightClass;
import org.jetbrains.jet.lang.psi.JetClass;
import org.jetbrains.jet.lang.psi.JetElement;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetPsiUtil;
public class JetJUnitConfigurationProducer extends RuntimeConfigurationProducer {
private JetElement myElement;
public JetJUnitConfigurationProducer() {
super(JUnitConfigurationType.getInstance());
}
@Override
public PsiElement getSourceElement() {
return myElement;
}
@Override
protected RunnerAndConfigurationSettings createConfigurationByElement(Location location, ConfigurationContext context) {
PsiElement leaf = location.getPsiElement();
JetClass jetClass = PsiTreeUtil.getParentOfType(leaf, JetClass.class);
if (jetClass != null) {
myElement = jetClass;
PsiClass delegate = new JetLightClass(jetClass.getManager(), (JetFile) jetClass.getContainingFile(), JetPsiUtil.getFQName(jetClass));
RunnerAndConfigurationSettings settings = cloneTemplateConfiguration(jetClass.getProject(), context);
final JUnitConfiguration configuration = (JUnitConfiguration)settings.getConfiguration();
final Module originalModule = configuration.getConfigurationModule().getModule();
configuration.beClassConfiguration(delegate);
configuration.restoreOriginalModule(originalModule);
JavaRunConfigurationExtensionManager.getInstance().extendCreatedConfiguration(configuration, location);
return settings;
}
return null;
}
@Override
public int compareTo(Object o) {
return 0;
}
}
+11
View File
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" scope="RUNTIME" name="idea-full" level="project" />
</component>
</module>