本文整理汇总了Java中com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil类的典型用法代码示例。如果您正苦于以下问题:Java SMTestRunnerConnectionUtil类的具体用法?Java SMTestRunnerConnectionUtil怎么用?Java SMTestRunnerConnectionUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SMTestRunnerConnectionUtil类属于com.intellij.execution.testframework.sm包,在下文中一共展示了SMTestRunnerConnectionUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConsoleView
import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
public static SMTRunnerConsoleView getConsoleView(
Project project,
BlazeCommandRunConfiguration configuration,
Executor executor,
BlazeTestUiSession testUiSession) {
SMTRunnerConsoleProperties properties =
new BlazeTestConsoleProperties(configuration, executor, testUiSession);
SMTRunnerConsoleView console =
(SMTRunnerConsoleView)
SMTestRunnerConnectionUtil.createConsole(BLAZE_FRAMEWORK, properties);
Disposer.register(project, console);
console
.getResultsViewer()
.getTreeView()
.getSelectionModel()
.setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
return console;
}
示例2: execute
import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
@NotNull
@Override
public ExecutionResult execute(@NotNull Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
if (GaugeVersion.isGreaterOrEqual(GaugeRunConfiguration.TEST_RUNNER_SUPPORT_VERSION, false)
&& GaugeSettingsService.getSettings().useIntelliJTestRunner()) {
ProcessHandler handler = startProcess();
GaugeConsoleProperties properties = new GaugeConsoleProperties(config, "Gauge", executor, handler);
ConsoleView console = SMTestRunnerConnectionUtil.createAndAttachConsole("Gauge", handler, properties);
DefaultExecutionResult result = new DefaultExecutionResult(console, handler, createActions(console, handler));
if (ActionManager.getInstance().getAction("RerunFailedTests") != null) {
AbstractRerunFailedTestsAction action = properties.createRerunFailedTestsAction(console);
if (action != null) {
action.setModelProvider(((SMTRunnerConsoleView) console)::getResultsViewer);
result.setRestartActions(action);
}
}
return result;
}
return super.execute(executor, runner);
}
示例3: showMavenToolWindow
import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
public void showMavenToolWindow() {
ConfigurationType configurationType = new JUnitConfigurationType();
ConfigurationFactory configurationFactory = new ConfigurationFactoryEx<JUnitConfiguration>(configurationType) {
@NotNull
@Override
public RunConfiguration createTemplateConfiguration(@NotNull Project project) {
return new JUnitConfiguration(project.getName(), project, this);
}
};
JUnitConfiguration configuration = new JUnitConfiguration(project.getName(), project, configurationFactory);
Executor executor = new DefaultRunExecutor();
ProcessHandler processHandler = new NopProcessHandler();
TestConsoleProperties consoleProperties = new MavenTestConsoleProperties(mavenProject, project, executor, configuration, processHandler);
BaseTestsOutputConsoleView consoleView;
try {
consoleView = SMTestRunnerConnectionUtil.createAndAttachConsole(TOOL_WINDOW_ID, processHandler, consoleProperties);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
showInToolWindow(consoleView, mavenProject.getFinalName());
processHandler.startNotify();
}
示例4: createConsole
import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
public static ConsoleView createConsole(Project project, ProcessHandler processHandler, ExecutionEnvironment executionEnvironment, TesterTestLocator locationProvider) {
TesterRunConfiguration profile = (TesterRunConfiguration) executionEnvironment.getRunProfile();
TesterConsoleProperties properties = new TesterConsoleProperties(profile, executionEnvironment.getExecutor(), locationProvider);
properties.addStackTraceFilter(new XdebugCallStackFilter(project, locationProvider.getPathMapper()));
BaseTestsOutputConsoleView testsOutputConsoleView = SMTestRunnerConnectionUtil.createConsole("Nette Tester", properties);
testsOutputConsoleView.addMessageFilter(new TesterStackTraceFilter(project, locationProvider.getPathMapper()));
testsOutputConsoleView.attachToProcess(processHandler);
Disposer.register(project, testsOutputConsoleView);
return testsOutputConsoleView;
}
示例5: onTestIgnored
import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
public void onTestIgnored(@NotNull final TestIgnoredEvent testIgnoredEvent) {
addToInvokeLater(new Runnable() {
public void run() {
final String testName = ObjectUtils.assertNotNull(testIgnoredEvent.getName());
String ignoreComment = testIgnoredEvent.getIgnoreComment();
final String stackTrace = testIgnoredEvent.getStacktrace();
final String fullTestName = getFullTestName(testName);
SMTestProxy testProxy = getProxyByFullTestName(fullTestName);
if (testProxy == null) {
final boolean debugMode = SMTestRunnerConnectionUtil.isInDebugMode();
logProblem("Test wasn't started! " +
"TestIgnored event: name = {" + testName + "}, " +
"message = {" + ignoreComment + "}. " +
cannotFindFullTestNameMsg(fullTestName));
if (debugMode) {
return;
} else {
// try to fix
// 1. report test opened
onTestStarted(new TestStartedEvent(testName, null));
// 2. report failure
testProxy = getProxyByFullTestName(fullTestName);
}
}
if (testProxy == null) {
return;
}
testProxy.setTestIgnored(ignoreComment, stackTrace);
// fire event
fireOnTestIgnored(testProxy);
}
});
}
示例6: execute
import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
@Nullable
@Override
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
final MyEmptyProcessHandler handler = new MyEmptyProcessHandler();
final SMTRunnerConsoleProperties properties = myRunProfile.getProperties();
RunProfile configuration;
final String frameworkName;
if (properties != null) {
configuration = properties.getConfiguration();
frameworkName = properties.getTestFrameworkName();
}
else {
configuration = myRunProfile;
frameworkName = "Import Test Results";
}
final ImportedTestConsoleProperties consoleProperties = new ImportedTestConsoleProperties(properties, myFile, handler, myRunProfile.getProject(),
configuration, frameworkName, executor);
final BaseTestsOutputConsoleView console = SMTestRunnerConnectionUtil.createConsole(consoleProperties.getTestFrameworkName(),
consoleProperties);
final JComponent component = console.getComponent();
AbstractRerunFailedTestsAction rerunFailedTestsAction = null;
if (component instanceof TestFrameworkRunningModel) {
rerunFailedTestsAction = consoleProperties.createRerunFailedTestsAction(console);
if (rerunFailedTestsAction != null) {
rerunFailedTestsAction.setModelProvider(new Getter<TestFrameworkRunningModel>() {
@Override
public TestFrameworkRunningModel get() {
return (TestFrameworkRunningModel)component;
}
});
}
}
console.attachToProcess(handler);
final DefaultExecutionResult result = new DefaultExecutionResult(console, handler);
if (rerunFailedTestsAction != null) {
result.setRestartActions(rerunFailedTestsAction);
}
return result;
}
示例7: attachConsole
import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
@NotNull
@Override
protected ConsoleView attachConsole(AndroidRunningState state, Executor executor) throws ExecutionException {
AndroidTestConsoleProperties properties = new AndroidTestConsoleProperties(this, executor);
ConsoleView consoleView = SMTestRunnerConnectionUtil.createAndAttachConsole("Android", state.getProcessHandler(), properties);
Disposer.register(state.getFacet().getModule().getProject(), consoleView);
return consoleView;
}
示例8: attachExecutionConsole
import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
@NotNull
@Override
public ExecutionConsole attachExecutionConsole(@NotNull final ExternalSystemTask task,
@NotNull final Project project,
@NotNull final ExternalSystemRunConfiguration configuration,
@NotNull final Executor executor,
@NotNull final ExecutionEnvironment env,
@NotNull final ProcessHandler processHandler) throws ExecutionException {
final GradleConsoleProperties properties = new GradleConsoleProperties(configuration, executor);
myExecutionConsole = (SMTRunnerConsoleView)SMTestRunnerConnectionUtil.createAndAttachConsole(
configuration.getSettings().getExternalSystemId().getReadableName(), processHandler, properties);
TestTreeRenderer originalRenderer =
ObjectUtils.tryCast(myExecutionConsole.getResultsViewer().getTreeView().getCellRenderer(), TestTreeRenderer.class);
if (originalRenderer != null) {
originalRenderer.setAdditionalRootFormatter(new SMRootTestProxyFormatter() {
@Override
public void format(@NotNull SMTestProxy.SMRootTestProxy testProxy, @NotNull TestTreeRenderer renderer) {
final TestStateInfo.Magnitude magnitude = testProxy.getMagnitudeInfo();
if (magnitude == TestStateInfo.Magnitude.RUNNING_INDEX) {
renderer.clear();
renderer.append(GradleBundle.message(
"gradle.test.runner.ui.tests.tree.presentation.labels.waiting.tests"),
SimpleTextAttributes.REGULAR_ATTRIBUTES
);
}
else if (!testProxy.isInProgress() && testProxy.isEmptySuite()) {
renderer.clear();
renderer.append(GradleBundle.message(
"gradle.test.runner.ui.tests.tree.presentation.labels.no.tests.were.found"),
SimpleTextAttributes.REGULAR_ATTRIBUTES
);
}
}
});
}
return myExecutionConsole;
}
示例9: getStockConsoleProvider
import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
private ConsoleProvider getStockConsoleProvider() {
return (parent, handler, executor) -> {
AndroidTestConsoleProperties properties =
new AndroidTestConsoleProperties(runConfiguration, executor);
ConsoleView consoleView =
SMTestRunnerConnectionUtil.createAndAttachConsole("Android", handler, properties);
Disposer.register(parent, consoleView);
return consoleView;
};
}
示例10: onTestStarted
import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
public void onTestStarted(@NotNull final TestStartedEvent testStartedEvent) {
addToInvokeLater(new Runnable() {
public void run() {
final String testName = testStartedEvent.getName();
final String locationUrl = testStartedEvent.getLocationUrl();
final String fullName = getFullTestName(testName);
if (myRunningTestsFullNameToProxy.containsKey(fullName)) {
//Duplicated event
logProblem("Test [" + fullName + "] has been already started");
if (SMTestRunnerConnectionUtil.isInDebugMode()) {
return;
}
}
final SMTestProxy parentSuite = getCurrentSuite();
// creates test
final SMTestProxy testProxy = new SMTestProxy(testName, false, locationUrl);
if (myLocator != null) {
testProxy.setLocator(myLocator);
}
parentSuite.addChild(testProxy);
// adds to running tests map
myRunningTestsFullNameToProxy.put(fullName, testProxy);
//Progress started
testProxy.setStarted();
//fire events
fireOnTestStarted(testProxy);
}
});
}
示例11: onTestIgnored
import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
public void onTestIgnored(@NotNull final TestIgnoredEvent testIgnoredEvent) {
addToInvokeLater(new Runnable() {
public void run() {
final String testName = ObjectUtils.assertNotNull(testIgnoredEvent.getName());
final String ignoreComment = testIgnoredEvent.getIgnoreComment();
final String stackTrace = testIgnoredEvent.getStacktrace();
final String fullTestName = getFullTestName(testName);
SMTestProxy testProxy = getProxyByFullTestName(fullTestName);
if (testProxy == null) {
final boolean debugMode = SMTestRunnerConnectionUtil.isInDebugMode();
logProblem("Test wasn't started! " +
"TestIgnored event: name = {" + testName + "}, " +
"message = {" + ignoreComment + "}. " +
cannotFindFullTestNameMsg(fullTestName));
if (debugMode) {
return;
} else {
// try to fix
// 1. report test opened
onTestStarted(new TestStartedEvent(testName, null));
// 2. report failure
testProxy = getProxyByFullTestName(fullTestName);
}
}
if (testProxy == null) {
return;
}
testProxy.setTestIgnored(ignoreComment, stackTrace);
// fire event
fireOnTestIgnored(testProxy);
}
});
}
示例12: useSmRunner
import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
private ExecutionResult useSmRunner(Executor executor, JUnitProcessHandler handler) {
TestConsoleProperties testConsoleProperties = new SMTRunnerConsoleProperties(
new RuntimeConfigurationProducer.DelegatingRuntimeConfiguration<JUnitConfiguration>(
(JUnitConfiguration)myEnvironment.getRunProfile()),
JUNIT_TEST_FRAMEWORK_NAME,
executor
);
testConsoleProperties.setIfUndefined(TestConsoleProperties.HIDE_PASSED_TESTS, false);
BaseTestsOutputConsoleView smtConsoleView = SMTestRunnerConnectionUtil.createConsoleWithCustomLocator(
JUNIT_TEST_FRAMEWORK_NAME,
testConsoleProperties,
myEnvironment, null);
Disposer.register(myProject, smtConsoleView);
final ConsoleView consoleView = smtConsoleView;
consoleView.attachToProcess(handler);
final RerunFailedTestsAction rerunFailedTestsAction = new RerunFailedTestsAction(consoleView);
rerunFailedTestsAction.init(testConsoleProperties, myEnvironment);
rerunFailedTestsAction.setModelProvider(new Getter<TestFrameworkRunningModel>() {
@Override
public TestFrameworkRunningModel get() {
return ((SMTRunnerConsoleView)consoleView).getResultsViewer();
}
});
final DefaultExecutionResult result = new DefaultExecutionResult(consoleView, handler);
result.setRestartActions(rerunFailedTestsAction);
return result;
}
示例13: execute
import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
@Nullable
@Override
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner)
throws ExecutionException {
final ProcessHandler processHandler = runBuildCommand(executor);
final TestConsoleProperties properties =
new BuckTestConsoleProperties(
processHandler, mProject, mConfiguration, "Buck test", executor);
final ConsoleView console =
SMTestRunnerConnectionUtil.createAndAttachConsole("buck test", processHandler, properties);
return new DefaultExecutionResult(console, processHandler, AnAction.EMPTY_ARRAY);
}
示例14: createConsoleWithCustomLocator
import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
public static SMTRunnerConsoleView createConsoleWithCustomLocator(@Nonnull final String testFrameworkName,
@Nonnull final TestConsoleProperties consoleProperties,
ExecutionEnvironment environment,
@javax.annotation.Nullable final TestLocationProvider locator,
final ThriftTestHandlerFactory factory,
@javax.annotation.Nullable final TestProxyFilterProvider filterProvider) {
String splitterPropertyName = SMTestRunnerConnectionUtil.getSplitterPropertyName(testFrameworkName);
SMTRunnerConsoleView consoleView = new SMTRunnerConsoleView(consoleProperties, splitterPropertyName);
initConsoleView(consoleView, testFrameworkName, locator, factory, filterProvider);
return consoleView;
}
示例15: onTestIgnored
import com.intellij.execution.testframework.sm.SMTestRunnerConnectionUtil; //导入依赖的package包/类
@Override
public void onTestIgnored(@Nonnull final TestIgnoredEvent testIgnoredEvent) {
addToInvokeLater(() -> {
final String testName = testIgnoredEvent.getName();
if (testName == null) {
logProblem("TestIgnored event: no name");
}
String ignoreComment = testIgnoredEvent.getIgnoreComment();
final String stackTrace = testIgnoredEvent.getStacktrace();
final String fullTestName = getFullTestName(testName);
SMTestProxy testProxy = getProxyByFullTestName(fullTestName);
if (testProxy == null) {
final boolean debugMode = SMTestRunnerConnectionUtil.isInDebugMode();
logProblem("Test wasn't started! " +
"TestIgnored event: name = {" + testName + "}, " +
"message = {" + ignoreComment + "}. " +
cannotFindFullTestNameMsg(fullTestName));
if (debugMode) {
return;
} else {
// try to fix
// 1. report test opened
onTestStarted(new TestStartedEvent(testName, null));
// 2. report failure
testProxy = getProxyByFullTestName(fullTestName);
}
}
if (testProxy == null) {
return;
}
testProxy.setTestIgnored(ignoreComment, stackTrace);
// fire event
fireOnTestIgnored(testProxy);
});
}