use of com.intellij.coldFusion.UI.runner.CfmlRunConfiguration in project intellij-plugins by JetBrains.
the class CfmlRunConfigurationTest method getDefaultCfmlRunConfiguration.
public CfmlRunConfiguration getDefaultCfmlRunConfiguration() throws IOException {
final Project project = myFixture.getProject();
final Editor editor = openCfmFileInEditor(indexCfm);
final Presentation presentation = getPresentationForRunAction(editor);
assert editor != null;
final DataContext dataContext = DataManager.getInstance().getDataContext(editor.getComponent());
TestCase.assertEquals("Run 'index.cfm'", presentation.getText());
final ConfigurationContext configurationContext = ConfigurationContext.getFromContext(dataContext);
final List<RunConfigurationProducer<?>> producers = RunConfigurationProducer.getProducers(project);
List<ConfigurationFromContext> configs = new ArrayList<>();
for (RunConfigurationProducer<?> producer : producers) {
final ConfigurationFromContext configurationFromContext = producer.createConfigurationFromContext(configurationContext);
if (configurationFromContext != null)
configs.add(configurationFromContext);
}
TestCase.assertEquals(true, configs.size() == 1);
final ConfigurationFromContext defaultConfigurationFromContext = configs.get(0);
final RunConfiguration configuration = defaultConfigurationFromContext.getConfiguration();
TestCase.assertNotNull(configuration);
UsefulTestCase.assertInstanceOf(configuration, CfmlRunConfiguration.class);
return (CfmlRunConfiguration) configuration;
}
use of com.intellij.coldFusion.UI.runner.CfmlRunConfiguration in project intellij-plugins by JetBrains.
the class CfmlRunConfigurationTest method testNonDefaultRunConfiguration.
public void testNonDefaultRunConfiguration() throws IOException, ConfigurationException {
generateNonDefaultRunConfiguration();
final Editor editor = myFixture.getEditor();
final CfmlRunConfiguration cfmlConfig = getContextRunConfiguration(editor);
assert cfmlConfig != null;
cfmlConfig.getRunnerParameters().getUrl();
assertEquals("http://4.4.4.4/src/index.cfm", cfmlConfig.getRunnerParameters().getUrl());
}
use of com.intellij.coldFusion.UI.runner.CfmlRunConfiguration in project intellij-plugins by JetBrains.
the class CfmlRunConfigurationTest method testCreateContextRunConfiguration.
public void testCreateContextRunConfiguration() throws IOException, ConfigurationException {
generateNonDefaultRunConfiguration();
final Editor editor = openCfmFileInEditor(index2Cfm);
final CfmlRunConfiguration configuration = getContextRunConfiguration(editor);
assert configuration != null;
TestCase.assertEquals("http://localhost:8500/src/index2.cfm", configuration.getRunnerParameters().getUrl());
TestCase.assertEquals("index2.cfm", configuration.getName());
}
use of com.intellij.coldFusion.UI.runner.CfmlRunConfiguration in project intellij-plugins by JetBrains.
the class CfmlRunConfigurationTest method testDefaultRunConfiguration.
public void testDefaultRunConfiguration() throws IOException {
final CfmlRunConfiguration configuration = getDefaultCfmlRunConfiguration();
final String url = configuration.getRunnerParameters().getUrl();
TestCase.assertEquals(true, StringUtil.startsWith(url, "http://localhost:8500/"));
TestCase.assertEquals(false, StringUtil.startsWith(url, "http://localhost:8500//"));
}
use of com.intellij.coldFusion.UI.runner.CfmlRunConfiguration in project intellij-plugins by JetBrains.
the class CfmlRunConfigurationTest method getContextRunConfiguration.
private static CfmlRunConfiguration getContextRunConfiguration(Editor editor) {
final DataContext dataContext = DataManager.getInstance().getDataContext(editor.getComponent());
final ConfigurationContext configurationContext = ConfigurationContext.getFromContext(dataContext);
//this block emulates RunContextAction.perform()
RunnerAndConfigurationSettings configuration = configurationContext.findExisting();
if (configuration == null) {
configuration = configurationContext.getConfiguration();
if (configuration == null) {
return null;
}
((RunManagerEx) configurationContext.getRunManager()).setTemporaryConfiguration(configuration);
}
//end of the emulated block
return (CfmlRunConfiguration) configuration.getConfiguration();
}
Aggregations