Search in sources :

Example 6 with NullPlugin

use of com.thoughtworks.go.domain.NullPlugin in project gocd by gocd.

the class PluginSettingsRequestProcessorTest method setUp.

@Before
public void setUp() {
    initMocks(this);
    Map<String, String> configuration = new HashMap<>();
    configuration.put("k1", "v1");
    configuration.put("k2", "v2");
    when(pluginSqlMapDao.findPlugin("plugin-id-1")).thenReturn(new Plugin("plugin-id-1", JsonHelper.toJsonString(configuration)));
    when(pluginSqlMapDao.findPlugin("plugin-id-2")).thenReturn(new NullPlugin());
    requestArgumentCaptor = ArgumentCaptor.forClass(PluginSettings.class);
    processor = new PluginSettingsRequestProcessor(applicationAccessor, pluginSqlMapDao);
    processor.getMessageHandlerMap().put("1.0", jsonMessageHandler);
}
Also used : HashMap(java.util.HashMap) PluginSettings(com.thoughtworks.go.server.domain.PluginSettings) NullPlugin(com.thoughtworks.go.domain.NullPlugin) Plugin(com.thoughtworks.go.domain.Plugin) NullPlugin(com.thoughtworks.go.domain.NullPlugin) Before(org.junit.Before)

Example 7 with NullPlugin

use of com.thoughtworks.go.domain.NullPlugin 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);
}
Also used : NullPlugin(com.thoughtworks.go.domain.NullPlugin) PluginSettingsConfiguration(com.thoughtworks.go.plugin.access.common.settings.PluginSettingsConfiguration) PluginSettingsProperty(com.thoughtworks.go.plugin.access.common.settings.PluginSettingsProperty) NullPlugin(com.thoughtworks.go.domain.NullPlugin) Plugin(com.thoughtworks.go.domain.Plugin) Before(org.junit.Before)

Aggregations

NullPlugin (com.thoughtworks.go.domain.NullPlugin)7 Plugin (com.thoughtworks.go.domain.Plugin)6 PluginSettings (com.thoughtworks.go.server.domain.PluginSettings)4 Before (org.junit.Before)2 Test (org.junit.Test)2 PluginSettingsConfiguration (com.thoughtworks.go.plugin.access.common.settings.PluginSettingsConfiguration)1 PluginSettingsProperty (com.thoughtworks.go.plugin.access.common.settings.PluginSettingsProperty)1 DefaultGoApiRequest (com.thoughtworks.go.plugin.api.request.DefaultGoApiRequest)1 DefaultGoApiResponse (com.thoughtworks.go.plugin.api.response.DefaultGoApiResponse)1 GoApiResponse (com.thoughtworks.go.plugin.api.response.GoApiResponse)1 HashMap (java.util.HashMap)1