Skip to content

Commit

Permalink
support running junit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
turbanoff committed Jun 3, 2017
1 parent a504f96 commit 5101d5d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
out/
.idea/workspace.xml
.idea/kotlinc.xml
.idea/uiDesigner.xml
runInCmdPlugin.jar
6 changes: 5 additions & 1 deletion META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin version="2">
<id>org.turbanov.execution.cmd</id>
<name>RunInCmd</name>
<version>1.5</version>
<version>1.6</version>
<vendor email="[email protected]" url="https://github.com/turbanoff/RunInCmdPlugin">Turbanov Andrey</vendor>

<description><![CDATA[
Expand All @@ -12,6 +12,10 @@
<!--Add change notes here.<br>-->
<!--<em>most HTML tags may be used</em>-->
<change-notes><![CDATA[
<h3>1.6</h3>
<ul>
<li>Support running JUnit tests</li>
</ul>
<h3>1.5</h3>
<ul>
<li>
Expand Down
17 changes: 12 additions & 5 deletions src/org/turbanov/execution/cmd/InCmdRunner.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
package org.turbanov.execution.cmd;

import com.intellij.execution.ExecutionException;
import com.intellij.execution.JavaTestConfigurationBase;
import com.intellij.execution.application.ApplicationConfiguration;
import com.intellij.execution.application.ApplicationConfiguration.JavaApplicationCommandLineState;
import com.intellij.execution.configurations.*;
import com.intellij.execution.configurations.CommandLineBuilder;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.configurations.JavaCommandLineState;
import com.intellij.execution.configurations.JavaParameters;
import com.intellij.execution.configurations.ParametersList;
import com.intellij.execution.configurations.RunProfile;
import com.intellij.execution.configurations.RunProfileState;
import com.intellij.execution.process.CapturingProcessHandler;
import com.intellij.execution.process.ProcessNotCreatedException;
import com.intellij.execution.process.ProcessOutput;
Expand Down Expand Up @@ -37,7 +43,7 @@
/**
* @author Andrey Turbanov
*/
public class InCmdRunner<Settings extends RunnerSettings> extends GenericProgramRunner<Settings> {
public class InCmdRunner extends GenericProgramRunner {

private static final Logger LOG = Logger.getInstance(InCmdRunner.class);
private Boolean terminalPluginEnabled;
Expand All @@ -50,7 +56,8 @@ public String getRunnerId() {

@Override
public boolean canRun(@NotNull String executorId, @NotNull RunProfile profile) {
return executorId.equals(InCmdExecutor.executorId) && profile instanceof ApplicationConfiguration;
return executorId.equals(InCmdExecutor.executorId) &&
(profile instanceof ApplicationConfiguration || profile instanceof JavaTestConfigurationBase);
}

private boolean isTerminalPluginEnabled() {
Expand All @@ -64,7 +71,7 @@ private boolean isTerminalPluginEnabled() {
@Override
protected RunContentDescriptor doExecute(@NotNull RunProfileState runProfileState, @NotNull ExecutionEnvironment environment) throws ExecutionException {
FileDocumentManager.getInstance().saveAllDocuments();
JavaApplicationCommandLineState state = (JavaApplicationCommandLineState) runProfileState;
JavaCommandLineState state = (JavaCommandLineState) runProfileState;
JavaParameters javaParameters = state.getJavaParameters();

GeneralCommandLine oldCommandLine = CommandLineBuilder.createFromJavaParameters(javaParameters, environment.getProject(), false);
Expand Down

0 comments on commit 5101d5d

Please sign in to comment.