Search in sources :

Example 1 with MissingPluggableTaskViewModel

use of com.thoughtworks.go.presentation.MissingPluggableTaskViewModel in project gocd by gocd.

the class PluggableTaskViewModelFactoryTest method shouldReturnMissingPluginTaskViewIfPluginIsMissing.

@Test
public void shouldReturnMissingPluginTaskViewIfPluginIsMissing() {
    String pluginId = "pluginId";
    PluggableTaskViewModelFactory factory = new PluggableTaskViewModelFactory();
    PluggableViewModel<PluggableTask> viewModel = factory.viewModelFor(new PluggableTask(new PluginConfiguration(pluginId, "1"), new Configuration()), "edit");
    assertThat(viewModel.getParameters().get("template"), is(String.format("Associated plugin '%s' not found. Please contact the Go admin to install the plugin.", pluginId)));
    assertThat(viewModel.getTypeForDisplay(), is(pluginId));
    assertThat(viewModel instanceof MissingPluggableTaskViewModel, is(true));
}
Also used : PluginConfiguration(com.thoughtworks.go.domain.config.PluginConfiguration) Configuration(com.thoughtworks.go.domain.config.Configuration) PluginConfiguration(com.thoughtworks.go.domain.config.PluginConfiguration) MissingPluggableTaskViewModel(com.thoughtworks.go.presentation.MissingPluggableTaskViewModel) PluggableTask(com.thoughtworks.go.config.pluggabletask.PluggableTask) Test(org.junit.Test)

Example 2 with MissingPluggableTaskViewModel

use of com.thoughtworks.go.presentation.MissingPluggableTaskViewModel in project gocd by gocd.

the class MissingPluggableTaskViewModelTest method shouldReturnPluginIdAsDisplayValue.

@Test
public void shouldReturnPluginIdAsDisplayValue() throws Exception {
    PluginConfiguration pluginConfiguration = new PluginConfiguration("test-plugin-1", "1.0");
    PluggableTask pluggableTask = new PluggableTask(pluginConfiguration, new Configuration());
    MissingPluggableTaskViewModel viewModel = new MissingPluggableTaskViewModel(pluggableTask, null);
    assertThat(viewModel.getParameters().get("template"), is(String.format("Associated plugin '%s' not found. Please contact the Go admin to install the plugin.", pluginConfiguration.getId())));
    assertThat(viewModel.getTypeForDisplay(), is(pluginConfiguration.getId()));
}
Also used : Configuration(com.thoughtworks.go.domain.config.Configuration) PluginConfiguration(com.thoughtworks.go.domain.config.PluginConfiguration) PluginConfiguration(com.thoughtworks.go.domain.config.PluginConfiguration) MissingPluggableTaskViewModel(com.thoughtworks.go.presentation.MissingPluggableTaskViewModel) PluggableTask(com.thoughtworks.go.config.pluggabletask.PluggableTask) Test(org.junit.Test)

Aggregations

PluggableTask (com.thoughtworks.go.config.pluggabletask.PluggableTask)2 Configuration (com.thoughtworks.go.domain.config.Configuration)2 PluginConfiguration (com.thoughtworks.go.domain.config.PluginConfiguration)2 MissingPluggableTaskViewModel (com.thoughtworks.go.presentation.MissingPluggableTaskViewModel)2 Test (org.junit.Test)2