use of com.intellij.execution.configurations.JavaParameters in project intellij-community by JetBrains.
the class GroovyConsole method createProcessHandler.
private static ProcessHandler createProcessHandler(Module module) {
try {
final JavaParameters javaParameters = createJavaParameters(module);
final GeneralCommandLine commandLine = javaParameters.toCommandLine();
return new OSProcessHandler(commandLine) {
@Override
public boolean isSilentlyDestroyOnClose() {
return true;
}
};
} catch (ExecutionException e) {
LOG.warn(e);
return null;
}
}
use of com.intellij.execution.configurations.JavaParameters in project intellij-community by JetBrains.
the class GroovyConsole method createJavaParameters.
private static JavaParameters createJavaParameters(@NotNull Module module) throws ExecutionException {
JavaParameters res = GroovyScriptRunConfiguration.createJavaParametersWithSdk(module);
DefaultGroovyScriptRunner.configureGenericGroovyRunner(res, module, "groovy.ui.GroovyMain", !GroovyConsoleUtil.hasGroovyAll(module), true);
PathsList list = GroovyScriptRunner.getClassPathFromRootModel(module, true, res, true, res.getClassPath());
if (list != null) {
res.getClassPath().addAll(list.getPathList());
}
res.getProgramParametersList().addAll("-p", GroovyScriptRunner.getPathInConf("console.txt"));
res.setWorkingDirectory(ModuleRootManager.getInstance(module).getContentRoots()[0].getPath());
res.setUseDynamicClasspath(true);
return res;
}
use of com.intellij.execution.configurations.JavaParameters in project intellij-community by JetBrains.
the class DefaultGroovyShellRunner method createJavaParameters.
@NotNull
@Override
public JavaParameters createJavaParameters(@NotNull Module module) throws ExecutionException {
JavaParameters res = GroovyScriptRunConfiguration.createJavaParametersWithSdk(module);
DefaultGroovyScriptRunner.configureGenericGroovyRunner(res, module, "org.codehaus.groovy.tools.shell.Main", false, true);
res.setWorkingDirectory(getWorkingDirectory(module));
return res;
}
use of com.intellij.execution.configurations.JavaParameters in project intellij-community by JetBrains.
the class JUnit4IntegrationTest method ignoredTestMethod.
@Test
public void ignoredTestMethod() throws Throwable {
EdtTestUtil.runInEdtAndWait(() -> {
PsiClass psiClass = findClass(getModule1(), CLASS_NAME);
assertNotNull(psiClass);
PsiMethod testMethod = psiClass.findMethodsByName(METHOD_NAME, false)[0];
JUnitConfiguration configuration = createConfiguration(testMethod);
Executor executor = DefaultRunExecutor.getRunExecutorInstance();
RunnerAndConfigurationSettingsImpl settings = new RunnerAndConfigurationSettingsImpl(RunManagerImpl.getInstanceImpl(getProject()), configuration, false);
ExecutionEnvironment environment = new ExecutionEnvironment(executor, ProgramRunnerUtil.getRunner(DefaultRunExecutor.EXECUTOR_ID, settings), settings, getProject());
TestObject state = configuration.getState(executor, environment);
JavaParameters parameters = state.getJavaParameters();
parameters.setUseDynamicClasspath(getProject());
GeneralCommandLine commandLine = parameters.toCommandLine();
StringBuffer buf = new StringBuffer();
StringBuffer err = new StringBuffer();
OSProcessHandler process = new OSProcessHandler(commandLine);
process.addProcessListener(new ProcessAdapter() {
@Override
public void onTextAvailable(ProcessEvent event, Key outputType) {
String text = event.getText();
try {
if (outputType == ProcessOutputTypes.STDOUT && !text.isEmpty() && ServiceMessage.parse(text.trim()) == null) {
buf.append(text);
}
if (outputType == ProcessOutputTypes.STDERR) {
err.append(text);
}
} catch (ParseException e) {
e.printStackTrace();
}
}
});
process.startNotify();
process.waitFor();
process.destroyProcess();
String testOutput = buf.toString();
assertEmpty(err.toString());
switch(myJUnitVersion) {
//shouldn't work for old versions
case "4.4":
//shouldn't work for old versions
case "4.5":
break;
default:
assertTrue(testOutput, testOutput.contains("Test1"));
}
});
}
use of com.intellij.execution.configurations.JavaParameters in project intellij-community by JetBrains.
the class MavenJUnitPatcherTest method testVmPropertiesResolve.
public void testVmPropertiesResolve() throws Exception {
VirtualFile m1 = createModulePom("m1", "<groupId>test</groupId>" + "<artifactId>m1</artifactId>" + "<version>1</version>" + "<dependencies>" + " <dependency>" + " <groupId>test</groupId>" + " <artifactId>m2</artifactId>" + " <version>1</version>" + " </dependency>" + "</dependencies>" + "<build><plugins>" + " <plugin>" + " <groupId>org.apache.maven.plugins</groupId>" + " <artifactId>maven-surefire-plugin</artifactId>" + " <version>2.16</version>" + " <configuration>" + " <argLine>-Xmx2048M -XX:MaxPermSize=512M \"-Dargs=can have spaces\" ${argLineApx}</argLine>" + " </configuration>" + " </plugin>" + "</plugins></build>");
importProjects(m1);
Module module = getModule("m1");
MavenJUnitPatcher mavenJUnitPatcher = new MavenJUnitPatcher();
JavaParameters javaParameters = new JavaParameters();
javaParameters.getVMParametersList().addProperty("argLineApx", "-DsomeKey=someValue");
mavenJUnitPatcher.patchJavaParameters(module, javaParameters);
assertEquals(asList("-DargLineApx=-DsomeKey=someValue", "-Xmx2048M", "-XX:MaxPermSize=512M", "-Dargs=can have spaces", "-DsomeKey=someValue"), javaParameters.getVMParametersList().getList());
}
Aggregations