Search in sources :

Example 1 with AuthenticationPluginRegistry

use of com.thoughtworks.go.plugin.access.authentication.AuthenticationPluginRegistry in project gocd by gocd.

the class AuthenticationPluginInfoBuilderTest method pluginInfoFor_ShouldProvidePluginInfoForAPlugin.

@Test
public void pluginInfoFor_ShouldProvidePluginInfoForAPlugin() throws Exception {
    GoPluginDescriptor.About about = new GoPluginDescriptor.About("Plugin Descriptor Validator", "1.0.1", "12.4", "Validates its own plugin descriptor", new GoPluginDescriptor.Vendor("ThoughtWorks Go Team", "www.thoughtworks.com"), Arrays.asList("Linux", "Windows", "Mac OS X"));
    GoPluginDescriptor plugin = new GoPluginDescriptor("docker-plugin", "1.0", about, null, null, false);
    PluginManager pluginManager = mock(PluginManager.class);
    AuthenticationPluginRegistry registry = mock(AuthenticationPluginRegistry.class);
    when(registry.getAuthenticationPlugins()).thenReturn(Collections.singleton(plugin.id()));
    when(pluginManager.getPluginDescriptorFor(plugin.id())).thenReturn(plugin);
    AuthenticationPluginInfoBuilder builder = new AuthenticationPluginInfoBuilder(pluginManager, registry);
    AuthenticationPluginInfo pluginInfo = builder.pluginInfoFor(plugin.id());
    assertEquals(new AuthenticationPluginInfo(plugin), pluginInfo);
}
Also used : PluginManager(com.thoughtworks.go.plugin.infra.PluginManager) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) AuthenticationPluginInfo(com.thoughtworks.go.server.ui.plugins.AuthenticationPluginInfo) AuthenticationPluginRegistry(com.thoughtworks.go.plugin.access.authentication.AuthenticationPluginRegistry) Test(org.junit.Test)

Example 2 with AuthenticationPluginRegistry

use of com.thoughtworks.go.plugin.access.authentication.AuthenticationPluginRegistry in project gocd by gocd.

the class AuthenticationPluginInfoBuilderTest method allPluginInfos_ShouldReturnAListOfAllPluginInfos.

@Test
public void allPluginInfos_ShouldReturnAListOfAllPluginInfos() throws Exception {
    GoPluginDescriptor.About about = new GoPluginDescriptor.About("Plugin Descriptor Validator", "1.0.1", "12.4", "Validates its own plugin descriptor", new GoPluginDescriptor.Vendor("ThoughtWorks Go Team", "www.thoughtworks.com"), Arrays.asList("Linux", "Windows", "Mac OS X"));
    GoPluginDescriptor plugin = new GoPluginDescriptor("docker-plugin", "1.0", about, null, null, false);
    PluginManager pluginManager = mock(PluginManager.class);
    AuthenticationPluginRegistry registry = mock(AuthenticationPluginRegistry.class);
    when(registry.getAuthenticationPlugins()).thenReturn(Collections.singleton(plugin.id()));
    when(pluginManager.getPluginDescriptorFor(plugin.id())).thenReturn(plugin);
    AuthenticationPluginInfoBuilder builder = new AuthenticationPluginInfoBuilder(pluginManager, registry);
    Collection<AuthenticationPluginInfo> pluginInfos = builder.allPluginInfos();
    assertEquals(Arrays.asList(new AuthenticationPluginInfo(plugin)), pluginInfos);
}
Also used : PluginManager(com.thoughtworks.go.plugin.infra.PluginManager) GoPluginDescriptor(com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor) AuthenticationPluginInfo(com.thoughtworks.go.server.ui.plugins.AuthenticationPluginInfo) AuthenticationPluginRegistry(com.thoughtworks.go.plugin.access.authentication.AuthenticationPluginRegistry) Test(org.junit.Test)

Example 3 with AuthenticationPluginRegistry

use of com.thoughtworks.go.plugin.access.authentication.AuthenticationPluginRegistry in project gocd by gocd.

the class AuthorizationControllerTest method setUp.

@Before
public void setUp() throws Exception {
    authenticationPluginRegistry = mock(AuthenticationPluginRegistry.class);
    localizer = mock(Localizer.class);
    authorizationController = new AuthorizationController(localizer, authenticationPluginRegistry);
    response = new MockHttpServletResponse();
}
Also used : Localizer(com.thoughtworks.go.i18n.Localizer) AuthenticationPluginRegistry(com.thoughtworks.go.plugin.access.authentication.AuthenticationPluginRegistry) MockHttpServletResponse(org.springframework.mock.web.MockHttpServletResponse) Before(org.junit.Before)

Example 4 with AuthenticationPluginRegistry

use of com.thoughtworks.go.plugin.access.authentication.AuthenticationPluginRegistry in project gocd by gocd.

the class AuthenticationPluginInfoBuilderTest method pluginInfoFor_ShouldReturnNullWhenPluginIsNotFound.

@Test
public void pluginInfoFor_ShouldReturnNullWhenPluginIsNotFound() throws Exception {
    PluginManager pluginManager = mock(PluginManager.class);
    AuthenticationPluginRegistry registry = mock(AuthenticationPluginRegistry.class);
    AuthenticationPluginInfoBuilder builder = new AuthenticationPluginInfoBuilder(pluginManager, registry);
    AuthenticationPluginInfo pluginInfo = builder.pluginInfoFor("docker-plugin");
    assertEquals(null, pluginInfo);
}
Also used : PluginManager(com.thoughtworks.go.plugin.infra.PluginManager) AuthenticationPluginInfo(com.thoughtworks.go.server.ui.plugins.AuthenticationPluginInfo) AuthenticationPluginRegistry(com.thoughtworks.go.plugin.access.authentication.AuthenticationPluginRegistry) Test(org.junit.Test)

Aggregations

AuthenticationPluginRegistry (com.thoughtworks.go.plugin.access.authentication.AuthenticationPluginRegistry)4 PluginManager (com.thoughtworks.go.plugin.infra.PluginManager)3 AuthenticationPluginInfo (com.thoughtworks.go.server.ui.plugins.AuthenticationPluginInfo)3 Test (org.junit.Test)3 GoPluginDescriptor (com.thoughtworks.go.plugin.infra.plugininfo.GoPluginDescriptor)2 Localizer (com.thoughtworks.go.i18n.Localizer)1 Before (org.junit.Before)1 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)1