use of com.intellij.execution.application.ApplicationConfiguration in project intellij-community by JetBrains.
the class ContextConfigurationTest method testApplication.
public void testApplication() {
PsiClass psiClass = findClass(getModule1(), CLASS_NAME);
PsiMethod psiMethod = psiClass.findMethodsByName("main", false)[0];
ApplicationConfiguration configuration = createConfiguration(psiMethod);
assertEquals(CLASS_NAME, configuration.MAIN_CLASS_NAME);
assertEquals(configuration.suggestedName(), configuration.getName());
assertEquals(SHORT_CLASS_NAME, configuration.getName());
}
use of com.intellij.execution.application.ApplicationConfiguration in project intellij-community by JetBrains.
the class ConfigurationsTest method testRunThirdPartyApplication.
public void testRunThirdPartyApplication() throws ExecutionException {
ApplicationConfiguration configuration = new ApplicationConfiguration("Third party", myProject, ApplicationConfigurationType.getInstance());
configuration.setModule(getModule1());
configuration.MAIN_CLASS_NAME = "third.party.Main";
checkCanRun(configuration);
}
use of com.intellij.execution.application.ApplicationConfiguration in project azure-tools-for-java by Microsoft.
the class Connection method isApplicableFor.
/**
* is this connection applicable for the specified {@code configuration}.<br>
* - the {@code Connect Azure Resource} before run task will take effect if
* applicable: the {@link #prepareBeforeRun} & {@link #updateJavaParametersAtRun}
* will be called.
*
* @return true if this connection should intervene the specified {@code configuration}.
*/
public boolean isApplicableFor(@Nonnull RunConfiguration configuration) {
final boolean javaAppRunConfiguration = configuration instanceof ApplicationConfiguration;
final boolean springbootAppRunConfiguration = StringUtils.equals(configuration.getClass().getName(), SPRING_BOOT_CONFIGURATION);
final boolean azureWebAppRunConfiguration = configuration instanceof IWebAppRunConfiguration;
if (javaAppRunConfiguration || azureWebAppRunConfiguration || springbootAppRunConfiguration) {
final Module module = getTargetModule(configuration);
return Objects.nonNull(module) && Objects.equals(module.getName(), this.consumer.getName());
}
return false;
}
use of com.intellij.execution.application.ApplicationConfiguration in project intellij-community by JetBrains.
the class ConfigurationsTest method testCreatingApplicationConfiguration.
public void testCreatingApplicationConfiguration() throws ConfigurationException {
if (PlatformTestUtil.COVERAGE_ENABLED_BUILD)
return;
ApplicationConfiguration configuration = new ApplicationConfiguration(null, myProject, ApplicationConfigurationType.getInstance());
ApplicationConfigurable editor = new ApplicationConfigurable(myProject);
try {
// To get all the watchers installed.
editor.getComponent();
Configurable configurable = new RunConfigurationConfigurableAdapter(editor, configuration);
configurable.reset();
CommonJavaParametersPanel javaParameters = editor.getCommonProgramParameters();
javaParameters.setProgramParameters("prg");
javaParameters.setVMParameters("vm");
javaParameters.setWorkingDirectory("dir");
assertTrue(configurable.isModified());
configurable.apply();
assertEquals("prg", configuration.getProgramParameters());
assertEquals("vm", configuration.getVMParameters());
assertEquals("dir", configuration.getWorkingDirectory());
} finally {
Disposer.dispose(editor);
}
}
use of com.intellij.execution.application.ApplicationConfiguration in project intellij-community by JetBrains.
the class ConfigurationsTest method testCreateConfiguration.
public void testCreateConfiguration() throws IOException, ExecutionException {
Module module1 = getModule1();
PsiClass psiClass = findTestA(module1);
JUnitConfiguration configuration = createConfiguration(psiClass);
assertEquals(Collections.singleton(module1), ContainerUtilRt.newHashSet(configuration.getModules()));
checkClassName(psiClass.getQualifiedName(), configuration);
assertEquals(psiClass.getName(), configuration.getName());
checkTestObject(JUnitConfiguration.TEST_CLASS, configuration);
Module module2 = getModule2();
Assertion.compareUnordered(new Module[] { module1, module2 }, configuration.getValidModules());
PsiClass innerTest = findClass(module1, INNER_TEST_NAME);
configuration = createJUnitConfiguration(innerTest, TestInClassConfigurationProducer.class, new MapDataContext());
checkClassName(RT_INNER_TEST_NAME, configuration);
checkCanRun(configuration);
PsiMethod[] testMethod = innerTest.findMethodsByName("test", false);
assertEquals(1, testMethod.length);
configuration = createConfiguration(testMethod[0]);
checkClassName(RT_INNER_TEST_NAME, configuration);
checkMethodName("test", configuration);
checkTestObject(JUnitConfiguration.TEST_METHOD, configuration);
checkCanRun(configuration);
PsiMethod mainMethod = innerTest.findMethodsByName("main", false)[0];
ApplicationConfiguration appConfiguration = createConfiguration(mainMethod);
assertEquals(RT_INNER_TEST_NAME, appConfiguration.MAIN_CLASS_NAME);
checkCanRun(configuration);
}
Aggregations