Search in sources :

Example 6 with PluginInfo

use of com.thoughtworks.go.server.ui.plugins.PluginInfo in project gocd by gocd.

the class PluggableTaskViewModelBuilder method allPluginInfos.

public List<PluginInfo> allPluginInfos() {
    List<PluginInfo> pluginInfos = new ArrayList<>();
    for (String pluginId : PluggableTaskConfigStore.store().pluginIds()) {
        GoPluginDescriptor descriptor = pluginManager.getPluginDescriptorFor(pluginId);
        TaskPreference taskPreference = PluggableTaskConfigStore.store().preferenceFor(pluginId);
        pluginInfos.add(new PluginInfo(descriptor, TaskExtension.TASK_EXTENSION, taskPreference.getView().displayValue(), null, null));
    }
    return pluginInfos;
}
Also used : ArrayList(java.util.ArrayList) PluginInfo(com.thoughtworks.go.server.ui.plugins.PluginInfo) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) TaskPreference(com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference)

Example 7 with PluginInfo

use of com.thoughtworks.go.server.ui.plugins.PluginInfo in project gocd by gocd.

the class SCMViewModelBuilder method allPluginInfos.

public List<PluginInfo> allPluginInfos() {
    List<PluginInfo> pluginInfos = new ArrayList<>();
    for (String pluginId : SCMMetadataStore.getInstance().pluginIds()) {
        GoPluginDescriptor descriptor = pluginManager.getPluginDescriptorFor(pluginId);
        SCMPreference scmPreference = SCMMetadataStore.getInstance().preferenceFor(pluginId);
        pluginInfos.add(new PluginInfo(descriptor, SCMExtension.EXTENSION_NAME, scmPreference.getScmView().displayValue(), null, null));
    }
    return pluginInfos;
}
Also used : ArrayList(java.util.ArrayList) SCMPreference(com.thoughtworks.go.plugin.access.scm.SCMPreference) PluginInfo(com.thoughtworks.go.server.ui.plugins.PluginInfo) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)

Example 8 with PluginInfo

use of com.thoughtworks.go.server.ui.plugins.PluginInfo in project gocd by gocd.

the class PluginServiceTest method shouldFetchPluginInfoForTheSpecifiedId.

@Test
public void shouldFetchPluginInfoForTheSpecifiedId() {
    GoPluginDescriptor.About about = new GoPluginDescriptor.About("asdfasdf", "1.0", null, null, null, null);
    PluginInfo pluginInfo = new PluginInfo(new GoPluginDescriptor("github.pr", "1.0", about, null, null, false), null, null, null, null);
    when(builder.pluginInfoFor("github.pr")).thenReturn(pluginInfo);
    assertThat(pluginService.pluginInfo("github.pr"), is(pluginInfo));
}
Also used : GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) PluginInfo(com.thoughtworks.go.server.ui.plugins.PluginInfo) Test(org.junit.Test)

Example 9 with PluginInfo

use of com.thoughtworks.go.server.ui.plugins.PluginInfo in project gocd by gocd.

the class SCMViewModelBuilderTest method shouldBeAbleToFetchAPluginInfoForAGivenIdWithConfigurations.

@Test
public void shouldBeAbleToFetchAPluginInfoForAGivenIdWithConfigurations() {
    when(manager.getPluginDescriptorFor("github.pr")).thenReturn(githubPR);
    PluginInfo pluginInfo = builder.pluginInfoFor("github.pr");
    HashMap expectedMetadata = new HashMap<String, Object>() {

        {
            put("required", true);
            put("secure", false);
            put("part_of_identity", true);
        }
    };
    List<PluginConfiguration> configurations = pluginInfo.getPluggableInstanceSettings().getConfigurations();
    assertThat(configurations.size(), is(2));
    PluginConfiguration configuration1 = configurations.get(0);
    assertThat(configuration1.getKey(), is("key1"));
    assertNull(configuration1.getType());
    assertThat(configuration1.getMetadata(), Is.<Map<String, Object>>is(expectedMetadata));
    PluginConfiguration configuration2 = configurations.get(1);
    assertThat(configuration2.getKey(), is("key2"));
    assertNull(configuration2.getType());
    assertThat(configuration1.getMetadata(), Is.<Map<String, Object>>is(expectedMetadata));
}
Also used : HashMap(java.util.HashMap) PluginConfiguration(com.thoughtworks.go.server.ui.plugins.PluginConfiguration) PluginInfo(com.thoughtworks.go.server.ui.plugins.PluginInfo) Test(org.junit.Test)

Example 10 with PluginInfo

use of com.thoughtworks.go.server.ui.plugins.PluginInfo in project gocd by gocd.

the class PluggableTaskViewModelBuilderTest method shouldBeAbleToFetchAPluginInfoForAGivenId.

@Test
public void shouldBeAbleToFetchAPluginInfoForAGivenId() {
    when(manager.getPluginDescriptorFor("xunit.convertor")).thenReturn(xunitConvertor);
    PluginInfo pluginInfo = builder.pluginInfoFor("xunit.convertor");
    assertThat(pluginInfo.getId(), is("xunit.convertor"));
    assertThat(pluginInfo.getType(), is("task"));
    assertThat(pluginInfo.getName(), is(xunitConvertor.about().name()));
    assertThat(pluginInfo.getDisplayName(), is("task display value"));
    assertThat(pluginInfo.getVersion(), is(xunitConvertor.about().version()));
}
Also used : PluginInfo(com.thoughtworks.go.server.ui.plugins.PluginInfo) Test(org.junit.Test)

Aggregations

PluginInfo (com.thoughtworks.go.server.ui.plugins.PluginInfo)32 Test (org.junit.Test)20 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)9 PluginConfiguration (com.thoughtworks.go.server.ui.plugins.PluginConfiguration)9 ArrayList (java.util.ArrayList)9 PluginView (com.thoughtworks.go.server.ui.plugins.PluginView)7 Image (com.thoughtworks.go.plugin.access.common.models.Image)5 PluggableInstanceSettings (com.thoughtworks.go.server.ui.plugins.PluggableInstanceSettings)5 PluginDescriptor (com.thoughtworks.go.plugin.api.info.PluginDescriptor)4 HashSet (java.util.HashSet)4 HashMap (java.util.HashMap)3 TaskPreference (com.thoughtworks.go.plugin.access.pluggabletask.TaskPreference)2 SCMPreference (com.thoughtworks.go.plugin.access.scm.SCMPreference)2 PluginProfileMetadata (com.thoughtworks.go.plugin.access.common.models.PluginProfileMetadata)1 PluginProfileMetadataKey (com.thoughtworks.go.plugin.access.common.models.PluginProfileMetadataKey)1 PluginProfileMetadataKeys (com.thoughtworks.go.plugin.access.common.models.PluginProfileMetadataKeys)1