String outputDirectoryPath = state.getConfiguration().getOutputFilePath(); RunnerAndConfigurationSettings settings = environment.getRunnerAndConfigurationSettings(); String configurationName = settings != null ? settings.getName() : "application"; if (StringUtil.isEmpty(outputDirectoryPath)) { try {
public static synchronized String allocateId( Project project, RunnerAndConfigurationSettings setting) { final String base = project.getName() + ":" + setting.getName(); if (!sRunningProcs.containsKey(base)) { sRunningProcs.put(base, null); return base; } String alternate; int i = 0; do { alternate = base + ":" + i; } while (sRunningProcs.containsKey(alternate)); sRunningProcs.put(alternate, null); return alternate; }
@Override public void setValue(Object value) { if (value instanceof RunnerAndConfigurationSettings) { RunnerAndConfigurationSettings runnerAndConfigurationSettings = (RunnerAndConfigurationSettings) value; setText(runnerAndConfigurationSettings.getName()); } else { setText(""); } } }
RunConfigInfo(RunnerAndConfigurationSettings config) { name = config.getName(); type = config.getType().getDisplayName(); }
@Before public void setUp() { when(mockRunnerAndConfigurationSettings.getName()).thenReturn("name"); }
/** Public for testing */ public static RunnerAndConfigurationSettings pickRunSetting(Project project, String configuration) { final RunManager manager = RunManager.getInstance(project); // go with "last run" if (configuration == null) { RunnerAndConfigurationSettings selected = manager.getSelectedConfiguration(); if (selected != null) return selected; } for (RunnerAndConfigurationSettings setting : manager.getAllSettings()) { if (configuration == null) { return setting; // just use the first we see, I guess } else if (configuration.equals(setting.getName())) { // found it! return setting; } } // couldn't find it :( return null; } }
!ExecutionTargetManager.canRun(configuration, target)) { throw new ExecutionException(StringUtil.escapeXml("Cannot run '" + configuration.getName() + "' on '" + target.getDisplayName() + "'"));
public void testRun() throws Exception { Project project = prepareProject(RUNNABLE_PROJECT); final RunManager manager = RunManager.getInstance(project); for (RunnerAndConfigurationSettings setting : manager.getAllSettings()) { System.out.println(setting.getName()); } LoggingRunner runner = new LoggingRunner(); SimpleResult result = (SimpleResult) new RunCommand(project, runner).execute(); assertSuccess(result); if (!runner.awaitTermination(TIMEOUT)) fail("RunnableProject did not finish execution in time"); // launch manager should clear it assertThat(LaunchManager.get(runner.launchId)) .isNull(); // make sure we got our output SoftAssertions softly = new SoftAssertions(); softly.assertThat(runner.cancelled).as("Run Cancelled").isFalse(); softly.assertThat(runner.stderr).as("stderr").contains("Standard Error"); softly.assertThat(runner.stdout).as("stdout").contains("Standard Output"); softly.assertThat(runner.system).as("system") .hasSize(2) // first one is the command line .contains("Process finished with exit code 0"); softly.assertAll(); }