diff options
Diffstat (limited to 'plugins/junit/src/com/intellij/execution/junit2')
6 files changed, 61 insertions, 26 deletions
diff --git a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java index 07e578bae6c8..0a2119fb73d2 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java +++ b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java @@ -118,6 +118,7 @@ public class JUnitConfigurable extends SettingsEditor<JUnitConfiguration> implem myModel = new JUnitConfigurationModel(project); myModuleSelector = new ConfigurationModuleSelector(project, getModulesComponent()); myCommonJavaParameters.setModuleContext(myModuleSelector.getModule()); + myCommonJavaParameters.setHasModuleMacro(); myModule.getComponent().addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { myCommonJavaParameters.setModuleContext(myModuleSelector.getModule()); diff --git a/plugins/junit/src/com/intellij/execution/junit2/states/ComparisonFailureState.java b/plugins/junit/src/com/intellij/execution/junit2/states/ComparisonFailureState.java index d4ef1319d866..c772936f5d20 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/states/ComparisonFailureState.java +++ b/plugins/junit/src/com/intellij/execution/junit2/states/ComparisonFailureState.java @@ -24,7 +24,7 @@ import com.intellij.execution.ui.ConsoleViewContentType; import com.intellij.openapi.project.Project; import org.jetbrains.annotations.NonNls; -public class ComparisonFailureState extends FaultyState implements AbstractTestProxy.AssertEqualsDiffViewerProvider { +public class ComparisonFailureState extends FaultyState implements AbstractTestProxy.AssertEqualsMultiDiffViewProvider { private DiffHyperlink myHyperlink; @NonNls protected static final String EXPECTED_VALUE_MESSAGE_TEXT = "expected:<"; @@ -59,4 +59,19 @@ public class ComparisonFailureState extends FaultyState implements AbstractTestP public void openDiff(final Project project) { if (myHyperlink != null) myHyperlink.openDiff(project); } + + @Override + public void openMultiDiff(Project project, AbstractTestProxy.AssertEqualsDiffChain chain) { + if (myHyperlink != null) { + myHyperlink.openMultiDiff(project, chain); + } + } + + @Override + public String getFilePath() { + if (myHyperlink != null) { + return myHyperlink.getFilePath(); + } + return null; + } } diff --git a/plugins/junit/src/com/intellij/execution/junit2/ui/ConsolePanel.java b/plugins/junit/src/com/intellij/execution/junit2/ui/ConsolePanel.java index 3fe67a6d5e1b..d4102d4df784 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/ui/ConsolePanel.java +++ b/plugins/junit/src/com/intellij/execution/junit2/ui/ConsolePanel.java @@ -41,6 +41,7 @@ import com.intellij.ui.SimpleTextAttributes; import com.intellij.ui.treeStructure.Tree; import com.intellij.util.Alarm; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; import javax.swing.*; import javax.swing.tree.DefaultMutableTreeNode; @@ -69,25 +70,30 @@ public class ConsolePanel extends TestResultsPanel { myPrinter = printer; } + @Override public void initUI() { super.initUI(); myStartingProgress = new StartingProgress(myTreeView); } + @Override protected JComponent createStatisticsPanel() { myStatisticsPanel = new StatisticsPanel(); return myStatisticsPanel; } + @Override protected ToolbarPanel createToolbarPanel() { return new JUnitToolbarPanel(myProperties, myEnvironment, this); } + @Override protected TestStatusLine createStatusLine() { myStatusLine = new JUnitStatusLine(); return myStatusLine; } + @Override protected JComponent createTestTreeView() { myTreeView = new JUnitTestTreeView(); return myTreeView; @@ -129,6 +135,7 @@ public class ConsolePanel extends TestResultsPanel { return myPrinter; } + @Override public void dispose() { stopStartingProgress(); myPrinter = null; @@ -145,8 +152,10 @@ public class ConsolePanel extends TestResultsPanel { private ProcessHandler myProcess; private long myStartedAt = System.currentTimeMillis(); private final ProcessAdapter myProcessListener = new ProcessAdapter() { + @Override public void processTerminated(ProcessEvent event) { ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override public void run() { doStop(); } @@ -162,7 +171,9 @@ public class ConsolePanel extends TestResultsPanel { myTree.setPaintBusy(true); //myStartingLabel.setBackground(UIManager.getColor("Tree.background")); myTree.setCellRenderer(new TreeCellRenderer() { - public Component getTreeCellRendererComponent(final JTree tree, final Object value, + @NotNull + @Override + public Component getTreeCellRendererComponent(@NotNull final JTree tree, final Object value, final boolean selected, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) { myStartingLabel.clear(); @@ -173,7 +184,8 @@ public class ConsolePanel extends TestResultsPanel { } }); myTree.addPropertyChangeListener(JTree.TREE_MODEL_PROPERTY, new PropertyChangeListener() { - public void propertyChange(final PropertyChangeEvent evt) { + @Override + public void propertyChange(@NotNull final PropertyChangeEvent evt) { myTree.removePropertyChangeListener(JTree.TREE_MODEL_PROPERTY, this); doStop(); } @@ -189,6 +201,7 @@ public class ConsolePanel extends TestResultsPanel { myProcess = null; } + @Override public void run() { myModel.nodeChanged(myRootNode); postRepaint(); diff --git a/plugins/junit/src/com/intellij/execution/junit2/ui/JUnitStatusLine.java b/plugins/junit/src/com/intellij/execution/junit2/ui/JUnitStatusLine.java index 88a474cd31ab..c7aef3a9a378 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/ui/JUnitStatusLine.java +++ b/plugins/junit/src/com/intellij/execution/junit2/ui/JUnitStatusLine.java @@ -17,7 +17,7 @@ package com.intellij.execution.junit2.ui; import com.intellij.execution.ExecutionBundle; -import com.intellij.execution.junit2.*; +import com.intellij.execution.junit2.TestProxy; import com.intellij.execution.junit2.events.NewChildEvent; import com.intellij.execution.junit2.events.StateChangedEvent; import com.intellij.execution.junit2.events.TestEvent; @@ -47,15 +47,17 @@ class JUnitStatusLine extends TestStatusLine { public void onProcessStarted(final ProcessHandler process) { if (myTestsBuilt) return; process.addProcessListener(new ProcessAdapter() { + @Override public void processTerminated(ProcessEvent event) { process.removeProcessListener(this); ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override public void run() { myStateInfo.setTerminated(myState); if (!myTestsBuilt && myProgressBar.getFraction() == 0.0) { myProgressBar.setColor(ColorProgressBar.RED); myProgressBar.setFraction(1.0); - myState.setText(ExecutionBundle.message("junit.runing.info.failed.to.start.error.message")); + myState.setText(ExecutionBundle.message("junit.running.info.failed.to.start.error.message")); } } }); @@ -83,21 +85,21 @@ class JUnitStatusLine extends TestStatusLine { myCurrentTestName = currentTest == null ? "" : Formatters.printTest(currentTest); } - public double getComplitedPercents() { + public double getCompletedPercents() { return (double)myCompleted/(double)myTotal; } public void updateLabel(final JLabel label) { - final StringBuffer buffer = new StringBuffer(); + final StringBuilder buffer = new StringBuilder(); if (myDoneEvent != null && myTerminated) { String termMessage = generateTermMessage(getTestCount(0)); buffer.append(termMessage); final String comment = myDoneEvent.getComment(); if (comment.length() > 0) { - buffer.append(" (" + comment + ")"); + buffer.append(" (").append(comment).append(")"); } } else { - buffer.append(ExecutionBundle.message("junit.runing.info.status.running.number.with.name", getTestCount(myDoneEvent != null ? 0 : 1), myCurrentTestName)); + buffer.append(ExecutionBundle.message("junit.running.info.status.running.number.with.name", getTestCount(myDoneEvent != null ? 0 : 1), myCurrentTestName)); } label.setText(buffer.toString()); } @@ -105,16 +107,16 @@ class JUnitStatusLine extends TestStatusLine { private String getTestCount(int offset) { String testCount; if (myDefects > 0) - testCount = ExecutionBundle.message("junit.runing.info.status.completed.from.total.failed", myCompleted + offset, myTotal, myDefects); // += " Failed: " + myDefects + " "; + testCount = ExecutionBundle.message("junit.running.info.status.completed.from.total.failed", myCompleted + offset, myTotal, myDefects); // += " Failed: " + myDefects + " "; else - testCount = ExecutionBundle.message("junit.runing.info.status.completed.from.total", myCompleted + offset, myTotal); // myCompleted + " of " + myTotal + testCount = ExecutionBundle.message("junit.running.info.status.completed.from.total", myCompleted + offset, myTotal); // myCompleted + " of " + myTotal return testCount; } private String generateTermMessage(final String testCount) { switch(myDoneEvent.getType()) { - case DONE: return ExecutionBundle.message("junit.runing.info.status.done.count", testCount); - default: return ExecutionBundle.message("junit.runing.info.status.terminated.count", testCount); + case DONE: return ExecutionBundle.message("junit.running.info.status.done.count", testCount); + default: return ExecutionBundle.message("junit.running.info.status.terminated.count", testCount); } } @@ -131,6 +133,7 @@ class JUnitStatusLine extends TestStatusLine { myProgress = progress; } + @Override public void onRunnerStateChanged(final StateEvent event) { if (!event.isRunning()) { final CompletionEvent completionEvent = (CompletionEvent) event; @@ -143,18 +146,20 @@ class JUnitStatusLine extends TestStatusLine { } } + @Override public void onTestChanged(final TestEvent event) { if (event instanceof StateChangedEvent || event instanceof NewChildEvent) updateCounters(); } + @Override public void doDispose() { myProgress = null; } private void updateCounters() { myStateInfo.updateCounters(myProgress); - myProgressBar.setFraction(myStateInfo.getComplitedPercents()); + myProgressBar.setFraction(myStateInfo.getCompletedPercents()); if (myProgress.hasDefects()) { myProgressBar.setColor(ColorProgressBar.RED); } diff --git a/plugins/junit/src/com/intellij/execution/junit2/ui/JUnitTreeConsoleView.java b/plugins/junit/src/com/intellij/execution/junit2/ui/JUnitTreeConsoleView.java index b311002027b1..4b879594d262 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/ui/JUnitTreeConsoleView.java +++ b/plugins/junit/src/com/intellij/execution/junit2/ui/JUnitTreeConsoleView.java @@ -41,17 +41,20 @@ public class JUnitTreeConsoleView extends BaseTestsOutputConsoleView { myEnvironment = environment; } + @Override protected TestResultsPanel createTestResultsPanel() { myConsolePanel = new ConsolePanel(getConsole().getComponent(), getPrinter(), myProperties, myEnvironment, getConsole().createConsoleActions()); return myConsolePanel; } + @Override public void attachToProcess(final ProcessHandler processHandler) { super.attachToProcess(processHandler); myConsolePanel.onProcessStarted(processHandler); } + @Override public void dispose() { super.dispose(); myConsolePanel = null; diff --git a/plugins/junit/src/com/intellij/execution/junit2/ui/actions/RerunFailedTestsAction.java b/plugins/junit/src/com/intellij/execution/junit2/ui/actions/RerunFailedTestsAction.java index 04c13aa9e6fa..332566b1b3f2 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/ui/actions/RerunFailedTestsAction.java +++ b/plugins/junit/src/com/intellij/execution/junit2/ui/actions/RerunFailedTestsAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 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. @@ -13,40 +13,38 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package com.intellij.execution.junit2.ui.actions; -import com.intellij.execution.ExecutionException; import com.intellij.execution.Executor; import com.intellij.execution.actions.JavaRerunFailedTestsAction; import com.intellij.execution.configurations.RunProfileState; import com.intellij.execution.junit.JUnitConfiguration; import com.intellij.execution.junit.TestMethods; import com.intellij.execution.runners.ExecutionEnvironment; +import com.intellij.execution.testframework.TestConsoleProperties; import com.intellij.openapi.module.Module; import com.intellij.openapi.ui.ComponentContainer; import org.jetbrains.annotations.NotNull; -/** - * @author Alexey - */ public class RerunFailedTestsAction extends JavaRerunFailedTestsAction { - - public RerunFailedTestsAction(@NotNull ComponentContainer componentContainer) { - super(componentContainer); + public RerunFailedTestsAction(@NotNull ComponentContainer componentContainer, @NotNull TestConsoleProperties consoleProperties) { + super(componentContainer, consoleProperties); } @Override - public MyRunProfile getRunProfile() { + protected MyRunProfile getRunProfile(@NotNull ExecutionEnvironment environment) { + //noinspection ConstantConditions final JUnitConfiguration configuration = (JUnitConfiguration)getModel().getProperties().getConfiguration(); - final TestMethods testMethods = new TestMethods(configuration.getProject(), configuration, myEnvironment, getFailedTests(configuration.getProject())); + final TestMethods testMethods = new TestMethods(configuration, environment, getFailedTests(configuration.getProject())); return new MyRunProfile(configuration) { + @Override @NotNull public Module[] getModules() { return testMethods.getModulesToCompile(); } - public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) throws ExecutionException { + @Override + public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment env) { testMethods.clear(); return testMethods; } |