use of com.thoughtworks.go.plugin.access.common.settings.PluginSettingsConfiguration in project gocd by gocd.
the class NotificationExtensionTestBase method setUp.
@Before
public void setUp() throws Exception {
initMocks(this);
notificationExtension = new NotificationExtension(pluginManager);
notificationExtension.getPluginSettingsMessageHandlerMap().put(apiVersion(), pluginSettingsJSONMessageHandler());
notificationExtension.getMessageHandlerMap().put(apiVersion(), jsonMessageHandler());
pluginSettingsConfiguration = new PluginSettingsConfiguration();
requestArgumentCaptor = ArgumentCaptor.forClass(GoPluginApiRequest.class);
when(pluginManager.resolveExtensionVersion(PLUGIN_ID, NotificationExtension.goSupportedVersions)).thenReturn(apiVersion());
when(pluginManager.isPluginOfType(NotificationExtension.EXTENSION_NAME, PLUGIN_ID)).thenReturn(true);
when(pluginManager.submitTo(eq(PLUGIN_ID), requestArgumentCaptor.capture())).thenReturn(DefaultGoPluginApiResponse.success(RESPONSE_BODY));
}
use of com.thoughtworks.go.plugin.access.common.settings.PluginSettingsConfiguration in project gocd by gocd.
the class TaskExtensionTest method setup.
@Before
public void setup() {
initMocks(this);
extension = new TaskExtension(pluginManager);
pluginId = "plugin-id";
when(pluginManager.resolveExtensionVersion(eq(pluginId), any(ArrayList.class))).thenReturn("1.0");
pluginSettingsConfiguration = new PluginSettingsConfiguration();
requestArgumentCaptor = ArgumentCaptor.forClass(GoPluginApiRequest.class);
}
use of com.thoughtworks.go.plugin.access.common.settings.PluginSettingsConfiguration in project gocd by gocd.
the class PluginSettingsTest method shouldCreatePluginFromConfigurationCorrectly.
@Test
public void shouldCreatePluginFromConfigurationCorrectly() {
Map<String, String> parameterMap = new HashMap<>();
parameterMap.put("k1", "v1");
parameterMap.put("k2", "");
parameterMap.put("k3", null);
PluginSettings pluginSettings = new PluginSettings(PLUGIN_ID);
pluginSettings.populateSettingsMap(parameterMap);
PluginSettingsConfiguration configuration = pluginSettings.toPluginSettingsConfiguration();
assertThat(configuration.size(), is(3));
assertThat(configuration.get("k1").getValue(), is("v1"));
assertThat(configuration.get("k2").getValue(), is(""));
assertThat(configuration.get("k3").getValue(), is(nullValue()));
}
use of com.thoughtworks.go.plugin.access.common.settings.PluginSettingsConfiguration in project gocd by gocd.
the class PluginServiceTest method setUp.
@Before
public void setUp() {
initMocks(this);
PluginSettingsMetadataStore.getInstance().clear();
Map<String, String> configuration = new HashMap<>();
configuration.put("p1-k1", "v1");
configuration.put("p1-k2", "");
configuration.put("p1-k3", null);
Plugin plugin = new Plugin("plugin-id-1", toJSON(configuration));
plugin.setId(1L);
when(pluginDao.findPlugin("plugin-id-1")).thenReturn(plugin);
when(pluginDao.findPlugin("plugin-id-2")).thenReturn(new NullPlugin());
PluginSettingsConfiguration configuration1 = new PluginSettingsConfiguration();
configuration1.add(new PluginSettingsProperty("p1-k1"));
configuration1.add(new PluginSettingsProperty("p1-k2"));
configuration1.add(new PluginSettingsProperty("p1-k3"));
PluginSettingsMetadataStore.getInstance().addMetadataFor("plugin-id-1", configuration1, "template-1");
PluginSettingsConfiguration configuration2 = new PluginSettingsConfiguration();
configuration2.add(new PluginSettingsProperty("p2-k1"));
configuration2.add(new PluginSettingsProperty("p2-k2"));
configuration2.add(new PluginSettingsProperty("p2-k3"));
PluginSettingsMetadataStore.getInstance().addMetadataFor("plugin-id-2", configuration2, "template-2");
extensions = Arrays.asList(packageRepositoryExtension, scmExtension, taskExtension, notificationExtension, configRepoExtension, authenticationExtension);
pluginService = new PluginService(extensions, pluginDao, builder);
}
Aggregations