use of com.thoughtworks.go.server.ui.plugins.PluginInfo in project gocd by gocd.
the class ElasticAgentViewViewModelBuilderTest method shouldBeAbleToFetchPluginInfoForSinglePlugin.
@Test
public void shouldBeAbleToFetchPluginInfoForSinglePlugin() throws Exception {
when(elasticPluginConfigMetadataStore.find(dockerPlugin.id())).thenReturn(dockerPlugin);
Image image = new Image("image/png", Base64.getEncoder().encodeToString("some-base64-encoded-data".getBytes(UTF_8)));
;
when(elasticPluginConfigMetadataStore.getIcon(dockerPlugin)).thenReturn(image);
when(elasticPluginConfigMetadataStore.getProfileView(dockerPlugin)).thenReturn("html");
PluginProfileMetadataKey pluginProfileMetadataKey = new PluginProfileMetadataKey("foo", new PluginProfileMetadata(true, true));
PluginProfileMetadataKeys pluginProfileMetadataKeys = new PluginProfileMetadataKeys(Collections.singletonList(pluginProfileMetadataKey));
when(elasticPluginConfigMetadataStore.getProfileMetadata(dockerPlugin)).thenReturn(pluginProfileMetadataKeys);
PluginInfo pluginInfo = builder.pluginInfoFor(dockerPlugin.id());
assertThat(pluginInfo.getImage(), is(image));
assertThat(pluginInfo.getPluggableInstanceSettings().getView(), is(new PluginView("html")));
Map<String, Object> metadata = new HashMap<>();
metadata.put(REQUIRED_OPTION, true);
metadata.put(SECURE_OPTION, true);
assertEquals(pluginInfo.getPluggableInstanceSettings().getConfigurations(), Arrays.asList(new PluginConfiguration("foo", metadata, null)));
}
use of com.thoughtworks.go.server.ui.plugins.PluginInfo in project gocd by gocd.
the class SCMViewModelBuilderTest method shouldBeAbleToFetchAPluginInfoForAGivenId.
@Test
public void shouldBeAbleToFetchAPluginInfoForAGivenId() {
when(manager.getPluginDescriptorFor("github.pr")).thenReturn(githubPR);
PluginInfo pluginInfo = builder.pluginInfoFor("github.pr");
assertThat(pluginInfo.getId(), is("github.pr"));
assertThat(pluginInfo.getType(), is("scm"));
assertThat(pluginInfo.getName(), is(githubPR.about().name()));
assertThat(pluginInfo.getDisplayName(), is(preference.getScmView().displayValue()));
assertThat(pluginInfo.getVersion(), is(githubPR.about().version()));
}
use of com.thoughtworks.go.server.ui.plugins.PluginInfo in project gocd by gocd.
the class SCMViewModelBuilderTest method shouldBeAbleToFetchAPluginInfoForAGivenIdWithViewTemplate.
@Test
public void shouldBeAbleToFetchAPluginInfoForAGivenIdWithViewTemplate() {
when(manager.getPluginDescriptorFor("github.pr")).thenReturn(githubPR);
PluginInfo pluginInfo = builder.pluginInfoFor("github.pr");
PluginView view = pluginInfo.getPluggableInstanceSettings().getView();
assertThat(view.getTemplate(), is("scm view template"));
}
use of com.thoughtworks.go.server.ui.plugins.PluginInfo in project gocd by gocd.
the class SCMViewModelBuilderTest method shouldBeAbleToFetchAllPluginInfos.
@Test
public void shouldBeAbleToFetchAllPluginInfos() {
when(manager.getPluginDescriptorFor("github.pr")).thenReturn(githubPR);
when(manager.getPluginDescriptorFor("stash.pr")).thenReturn(stashPR);
List<PluginInfo> pluginInfos = builder.allPluginInfos();
assertThat(pluginInfos.size(), is(2));
PluginInfo pluginInfo = pluginInfos.get(0).getId() == "github.pr" ? pluginInfos.get(0) : pluginInfos.get(1);
assertThat(pluginInfo.getId(), is("github.pr"));
assertThat(pluginInfo.getType(), is("scm"));
assertThat(pluginInfo.getName(), is(githubPR.about().name()));
assertThat(pluginInfo.getDisplayName(), is(preference.getScmView().displayValue()));
assertThat(pluginInfo.getVersion(), is(githubPR.about().version()));
assertNull(pluginInfo.getPluggableInstanceSettings());
}
use of com.thoughtworks.go.server.ui.plugins.PluginInfo in project gocd by gocd.
the class ElasticAgentViewViewModelBuilderTest method shouldBeAbleToFetchAllPluginInfos.
@Test
public void shouldBeAbleToFetchAllPluginInfos() throws Exception {
when(elasticPluginConfigMetadataStore.getPlugins()).thenReturn(new ArrayList<>(Arrays.asList(dockerPlugin, awsPlugin)));
List<PluginInfo> pluginInfos = builder.allPluginInfos();
assertThat(pluginInfos.size(), is(2));
PluginInfo dockerPluginInfo = pluginInfos.get(0);
PluginInfo awsPluginInfo = pluginInfos.get(1);
assertEquals(new PluginInfo(dockerPlugin, ElasticAgentPluginConstants.EXTENSION_NAME, null, null), dockerPluginInfo);
assertEquals(new PluginInfo(awsPlugin, ElasticAgentPluginConstants.EXTENSION_NAME, null, null), awsPluginInfo);
}
Aggregations