Search in sources :

Example 1 with Configuration

use of com.thoughtworks.go.domain.config.Configuration in project gocd by gocd.

the class GoConfigMaterialsTest method getPackageMaterialConfigWithAutoUpdateFalse.

private PackageMaterialConfig getPackageMaterialConfigWithAutoUpdateFalse() {
    PackageDefinition packageDefinition = new PackageDefinition("packageWithAutoUpdateFalse", "DLF Package", new Configuration());
    packageDefinition.setRepository(PackageRepositoryMother.create("DLF"));
    packageDefinition.setAutoUpdate(false);
    return new PackageMaterialConfig(new CaseInsensitiveString("JamesBond"), "packageWithAutoUpdateFalse", packageDefinition);
}
Also used : PackageMaterialConfig(com.thoughtworks.go.config.materials.PackageMaterialConfig) Configuration(com.thoughtworks.go.domain.config.Configuration) PackageDefinition(com.thoughtworks.go.domain.packagerepository.PackageDefinition)

Example 2 with Configuration

use of com.thoughtworks.go.domain.config.Configuration 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 3 with Configuration

use of com.thoughtworks.go.domain.config.Configuration in project gocd by gocd.

the class PluggableTaskViewModelFactoryTest method dataForViewShouldIncludeErrorsIfAny.

@Test
public void dataForViewShouldIncludeErrorsIfAny() throws Exception {
    ConfigurationProperty property1 = create("key1", false, "value1");
    property1.addError("key1", "error msg");
    ConfigurationProperty property2 = create("KEY2", false, "value2");
    Configuration configuration = new Configuration(property1, property2);
    PluggableTask taskConfig = new PluggableTask(new PluginConfiguration("plugin-1", "2"), configuration);
    PluggableTaskViewModelFactory factory = new PluggableTaskViewModelFactory();
    PluggableViewModel<PluggableTask> viewModel = factory.viewModelFor(taskConfig, "new");
    String actualData = (String) viewModel.getParameters().get("data");
    Gson gson = new Gson();
    Map actual = gson.fromJson(actualData, Map.class);
    Map expected = gson.fromJson("{\"KEY2\":{\"value\": \"value2\"},\"key1\":{\"value\" : \"value1\", \"errors\" : \"error msg\"}}", Map.class);
    assertEquals(expected, actual);
}
Also used : ConfigurationProperty(com.thoughtworks.go.domain.config.ConfigurationProperty) PluginConfiguration(com.thoughtworks.go.domain.config.PluginConfiguration) Configuration(com.thoughtworks.go.domain.config.Configuration) PluginConfiguration(com.thoughtworks.go.domain.config.PluginConfiguration) Gson(com.google.gson.Gson) PluggableTask(com.thoughtworks.go.config.pluggabletask.PluggableTask) Map(java.util.Map) Test(org.junit.Test)

Example 4 with Configuration

use of com.thoughtworks.go.domain.config.Configuration in project gocd by gocd.

the class PluggableTaskViewModelFactoryTest method typeForDisplayAndTemplateOfViewModelShouldBeGotFromThePlugin.

@Test
public void typeForDisplayAndTemplateOfViewModelShouldBeGotFromThePlugin() throws Exception {
    PluggableTask pluggableTask = new PluggableTask(new PluginConfiguration("plugin-1", "2"), new Configuration());
    PluggableTaskViewModelFactory factory = new PluggableTaskViewModelFactory();
    PluggableViewModel<PluggableTask> viewModel = factory.viewModelFor(pluggableTask, "new");
    assertThat(viewModel.getTypeForDisplay(), is("First plugin"));
    assertThat(viewModel.getParameters().get("template"), is("<input type='text' ng-model='abc'></input>"));
}
Also used : PluginConfiguration(com.thoughtworks.go.domain.config.PluginConfiguration) Configuration(com.thoughtworks.go.domain.config.Configuration) PluginConfiguration(com.thoughtworks.go.domain.config.PluginConfiguration) PluggableTask(com.thoughtworks.go.config.pluggabletask.PluggableTask) Test(org.junit.Test)

Example 5 with Configuration

use of com.thoughtworks.go.domain.config.Configuration in project gocd by gocd.

the class XmlPartialConfigProviderTest method shouldUseExplicitPatternWhenProvided.

@Test
public void shouldUseExplicitPatternWhenProvided() throws Exception {
    GoConfigMother mother = new GoConfigMother();
    PipelineConfig pipe1 = mother.cruiseConfigWithOnePipelineGroup().getAllPipelineConfigs().get(0);
    File file1 = helper.addFileWithPipeline("pipe1.myextension", pipe1);
    File file2 = helper.addFileWithPipeline("pipe1.gcd.xml", pipe1);
    File file3 = helper.addFileWithPipeline("subdir/pipe1.gocd.xml", pipe1);
    File file4 = helper.addFileWithPipeline("subdir/sub/pipe1.gocd.xml", pipe1);
    PartialConfigLoadContext context = mock(PartialConfigLoadContext.class);
    Configuration configs = new Configuration();
    configs.addNewConfigurationWithValue("pattern", "*.myextension", false);
    when(context.configuration()).thenReturn(configs);
    File[] matchingFiles = xmlPartialProvider.getFiles(tmpFolder, context);
    File[] expected = new File[1];
    expected[0] = file1;
    assertArrayEquals(expected, matchingFiles);
}
Also used : Configuration(com.thoughtworks.go.domain.config.Configuration) File(java.io.File) GoConfigMother(com.thoughtworks.go.helper.GoConfigMother) Test(org.junit.Test)

Aggregations

Configuration (com.thoughtworks.go.domain.config.Configuration)134 Test (org.junit.Test)116 PluginConfiguration (com.thoughtworks.go.domain.config.PluginConfiguration)95 PackageConfiguration (com.thoughtworks.go.plugin.access.packagematerial.PackageConfiguration)34 ConfigurationProperty (com.thoughtworks.go.domain.config.ConfigurationProperty)28 ConfigurationValue (com.thoughtworks.go.domain.config.ConfigurationValue)20 PluggableTask (com.thoughtworks.go.config.pluggabletask.PluggableTask)18 SCM (com.thoughtworks.go.domain.scm.SCM)17 SCMConfiguration (com.thoughtworks.go.plugin.access.scm.SCMConfiguration)17 ValidationResult (com.thoughtworks.go.plugin.api.response.validation.ValidationResult)17 TaskConfig (com.thoughtworks.go.plugin.api.task.TaskConfig)16 ConfigurationKey (com.thoughtworks.go.domain.config.ConfigurationKey)15 PackageConfigurations (com.thoughtworks.go.plugin.access.packagematerial.PackageConfigurations)14 ValidationError (com.thoughtworks.go.plugin.api.response.validation.ValidationError)13 PackageDefinition (com.thoughtworks.go.domain.packagerepository.PackageDefinition)12 TaskPreference (com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference)12 EncryptedConfigurationValue (com.thoughtworks.go.domain.config.EncryptedConfigurationValue)11 RepositoryConfiguration (com.thoughtworks.go.plugin.api.material.packagerepository.RepositoryConfiguration)11 SCMConfigurations (com.thoughtworks.go.plugin.access.scm.SCMConfigurations)10 PackageRepository (com.thoughtworks.go.domain.packagerepository.PackageRepository)9