use of com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo in project gocd by gocd.
the class ElasticAgentPluginServiceTest method shouldErrorOutWhenPluginDoesNotSupportStatusReport.
@Test
public void shouldErrorOutWhenPluginDoesNotSupportStatusReport() {
final Capabilities capabilities = new Capabilities(false);
final GoPluginDescriptor descriptor = new GoPluginDescriptor("cd.go.example.plugin", null, null, null, null, false);
elasticAgentMetadataStore.setPluginInfo(new ElasticAgentPluginInfo(descriptor, null, null, null, capabilities));
thrown.expect(UnsupportedOperationException.class);
thrown.expectMessage("Plugin does not plugin support status report.");
service.getPluginStatusReport("cd.go.example.plugin");
}
use of com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo in project gocd by gocd.
the class ElasticAgentPluginServiceTest method shouldGetAPluginAgentReportWhenPluginSupportsStatusReport.
@Test
public void shouldGetAPluginAgentReportWhenPluginSupportsStatusReport() {
final Capabilities capabilities = new Capabilities(false, true);
final GoPluginDescriptor descriptor = new GoPluginDescriptor("cd.go.example.plugin", null, null, null, null, false);
elasticAgentMetadataStore.setPluginInfo(new ElasticAgentPluginInfo(descriptor, null, null, null, capabilities));
when(registry.getAgentStatusReport("cd.go.example.plugin", null, "some-id")).thenReturn("<div>This is a agent status report snippet.</div>");
final String agentStatusReport = service.getAgentStatusReport("cd.go.example.plugin", null, "some-id");
assertThat(agentStatusReport, is("<div>This is a agent status report snippet.</div>"));
}
use of com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo in project gocd by gocd.
the class ElasticProfileTest method postConstruct_shouldEncryptSecureConfigurations.
@Test
public void postConstruct_shouldEncryptSecureConfigurations() {
PluggableInstanceSettings profileSettings = new PluggableInstanceSettings(Arrays.asList(new PluginConfiguration("password", new Metadata(true, true))));
ElasticAgentPluginInfo pluginInfo = new ElasticAgentPluginInfo(pluginDescriptor("plugin_id"), profileSettings, null, null, null);
store.setPluginInfo(pluginInfo);
ElasticProfile profile = new ElasticProfile("id", "plugin_id", new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass")));
profile.encryptSecureConfigurations();
assertThat(profile.size(), is(1));
assertTrue(profile.first().isSecure());
}
use of com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo in project gocd by gocd.
the class ElasticProfileTest method addConfiguration_shouldEncryptASecureVariable.
@Test
public void addConfiguration_shouldEncryptASecureVariable() throws Exception {
PluggableInstanceSettings profileSettings = new PluggableInstanceSettings(Arrays.asList(new PluginConfiguration("password", new Metadata(true, true))));
ElasticAgentPluginInfo pluginInfo = new ElasticAgentPluginInfo(pluginDescriptor("plugin_id"), profileSettings, null, null, null);
store.setPluginInfo(pluginInfo);
ElasticProfile profile = new ElasticProfile("id", "plugin_id");
profile.addConfigurations(Arrays.asList(new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass"))));
assertThat(profile.size(), is(1));
assertTrue(profile.first().isSecure());
}
use of com.thoughtworks.go.plugin.domain.elastic.ElasticAgentPluginInfo in project gocd by gocd.
the class ElasticProfileTest method addConfiguration_shouldIgnoreEncryptionInAbsenceOfCorrespondingConfigurationInStore.
@Test
public void addConfiguration_shouldIgnoreEncryptionInAbsenceOfCorrespondingConfigurationInStore() throws Exception {
ElasticAgentPluginInfo pluginInfo = new ElasticAgentPluginInfo(pluginDescriptor("plugin_id"), new PluggableInstanceSettings(new ArrayList<>()), null, null, null);
store.setPluginInfo(pluginInfo);
ElasticProfile profile = new ElasticProfile("id", "plugin_id");
profile.addConfigurations(Arrays.asList(new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass"))));
assertThat(profile.size(), is(1));
assertFalse(profile.first().isSecure());
assertThat(profile, contains(new ConfigurationProperty(new ConfigurationKey("password"), new ConfigurationValue("pass"))));
}
Aggregations