当前位置: 首页>>代码示例>>Java>>正文


Java PluginLifeCycle类代码示例

本文整理汇总了Java中org.crsh.plugin.PluginLifeCycle的典型用法代码示例。如果您正苦于以下问题:Java PluginLifeCycle类的具体用法?Java PluginLifeCycle怎么用?Java PluginLifeCycle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PluginLifeCycle类属于org.crsh.plugin包,在下文中一共展示了PluginLifeCycle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testCustomShellProperties

import org.crsh.plugin.PluginLifeCycle; //导入依赖的package包/类
@Test
public void testCustomShellProperties() throws Exception {
	MockEnvironment env = new MockEnvironment();
	env.setProperty("management.shell.auth.type", "simple");
	AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
	ctx.setEnvironment(env);
	ctx.setServletContext(new MockServletContext());
	ctx.register(TestShellConfiguration.class);
	ctx.register(CrshAutoConfiguration.class);
	ctx.refresh();

	PluginLifeCycle lifeCycle = ctx.getBean(PluginLifeCycle.class);
	String uuid = lifeCycle.getConfig().getProperty("test.uuid");
	assertThat(uuid).isEqualTo(TestShellConfiguration.uuid);
	ctx.close();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:17,代码来源:ShellPropertiesTests.java

示例2: testDisabledPlugins

import org.crsh.plugin.PluginLifeCycle; //导入依赖的package包/类
@Test
public void testDisabledPlugins() throws Exception {
	load("management.shell.disabled_plugins="
			+ "termIOHandler, org.crsh.auth.AuthenticationPlugin, javaLanguage");
	PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
	assertThat(lifeCycle).isNotNull();
	assertThat(lifeCycle.getContext().getPlugins(TermIOHandler.class))
			.filteredOn(Matched.<TermIOHandler>when(isA(ProcessorIOHandler.class)))
			.isEmpty();
	assertThat(lifeCycle.getContext().getPlugins(AuthenticationPlugin.class))
			.filteredOn(Matched
					.<AuthenticationPlugin>when(isA(JaasAuthenticationPlugin.class)))
			.isEmpty();
	assertThat(lifeCycle.getContext().getPlugins(Language.class))
			.filteredOn(Matched.<Language>when(isA(JavaLanguage.class))).isEmpty();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:17,代码来源:CrshAutoConfigurationTests.java

示例3: testCommandResolution

import org.crsh.plugin.PluginLifeCycle; //导入依赖的package包/类
@Test
public void testCommandResolution() {
	load();
	PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
	int count = 0;
	Iterator<Resource> resources = lifeCycle.getContext()
			.loadResources("login", ResourceKind.LIFECYCLE).iterator();
	while (resources.hasNext()) {
		count++;
		resources.next();
	}
	assertThat(count).isEqualTo(1);
	count = 0;
	resources = lifeCycle.getContext()
			.loadResources("sleep.groovy", ResourceKind.COMMAND).iterator();
	while (resources.hasNext()) {
		count++;
		resources.next();
	}
	assertThat(count).isEqualTo(1);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:22,代码来源:CrshAutoConfigurationTests.java

示例4: testAuthenticationProvidersAreInstalled

import org.crsh.plugin.PluginLifeCycle; //导入依赖的package包/类
@Test
public void testAuthenticationProvidersAreInstalled() {
	this.context = new AnnotationConfigWebApplicationContext();
	this.context.setServletContext(new MockServletContext());
	this.context.register(SecurityConfiguration.class);
	this.context.register(CrshAutoConfiguration.class);
	this.context.refresh();
	PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
	PluginContext pluginContext = lifeCycle.getContext();
	int count = 0;
	Iterator<AuthenticationPlugin> plugins = pluginContext
			.getPlugins(AuthenticationPlugin.class).iterator();
	while (plugins.hasNext()) {
		count++;
		plugins.next();
	}
	assertThat(count).isEqualTo(3);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:19,代码来源:CrshAutoConfigurationTests.java

示例5: testSpringAuthenticationProvider

import org.crsh.plugin.PluginLifeCycle; //导入依赖的package包/类
@Test
public void testSpringAuthenticationProvider() throws Exception {
	this.context = new AnnotationConfigWebApplicationContext();
	EnvironmentTestUtils.addEnvironment(this.context,
			"management.shell.auth.type=spring");
	this.context.setServletContext(new MockServletContext());
	this.context.register(SecurityConfiguration.class);
	this.context.register(CrshAutoConfiguration.class);
	this.context.refresh();
	PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
	AuthenticationPlugin<String> authenticationPlugin = null;
	String authentication = lifeCycle.getConfig().getProperty("crash.auth");
	assertThat(authentication).isNotNull();
	for (AuthenticationPlugin plugin : lifeCycle.getContext()
			.getPlugins(AuthenticationPlugin.class)) {
		if (authentication.equals(plugin.getName())) {
			authenticationPlugin = plugin;
			break;
		}
	}
	assertThat(authenticationPlugin.authenticate(SecurityConfiguration.USERNAME,
			SecurityConfiguration.PASSWORD)).isTrue();
	assertThat(authenticationPlugin.authenticate(UUID.randomUUID().toString(),
			SecurityConfiguration.PASSWORD)).isFalse();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:26,代码来源:CrshAutoConfigurationTests.java

示例6: testSpringAuthenticationProviderAsDefaultConfiguration

import org.crsh.plugin.PluginLifeCycle; //导入依赖的package包/类
@Test
public void testSpringAuthenticationProviderAsDefaultConfiguration()
		throws Exception {
	this.context = new AnnotationConfigWebApplicationContext();
	this.context.setServletContext(new MockServletContext());
	this.context.register(ManagementServerPropertiesAutoConfiguration.class);
	this.context.register(SecurityAutoConfiguration.class);
	this.context.register(SecurityConfiguration.class);
	this.context.register(CrshAutoConfiguration.class);
	this.context.refresh();
	PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
	AuthenticationPlugin<String> authenticationPlugin = null;
	String authentication = lifeCycle.getConfig().getProperty("crash.auth");
	assertThat(authentication).isNotNull();
	for (AuthenticationPlugin plugin : lifeCycle.getContext()
			.getPlugins(AuthenticationPlugin.class)) {
		if (authentication.equals(plugin.getName())) {
			authenticationPlugin = plugin;
			break;
		}
	}
	assertThat(authenticationPlugin.authenticate(SecurityConfiguration.USERNAME,
			SecurityConfiguration.PASSWORD)).isTrue();
	assertThat(authenticationPlugin.authenticate(UUID.randomUUID().toString(),
			SecurityConfiguration.PASSWORD)).isFalse();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:27,代码来源:CrshAutoConfigurationTests.java

示例7: testCustomShellProperties

import org.crsh.plugin.PluginLifeCycle; //导入依赖的package包/类
@Test
public void testCustomShellProperties() throws Exception {
	MockEnvironment env = new MockEnvironment();
	env.setProperty("shell.auth", "simple");
	AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
	context.setEnvironment(env);
	context.setServletContext(new MockServletContext());
	context.register(TestShellConfiguration.class);
	context.register(CrshAutoConfiguration.class);
	context.refresh();

	PluginLifeCycle lifeCycle = context.getBean(PluginLifeCycle.class);
	String uuid = lifeCycle.getConfig().getProperty("test.uuid");
	assertEquals(TestShellConfiguration.uuid, uuid);
	context.close();
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:17,代码来源:ShellPropertiesTests.java

示例8: testDisabledPlugins

import org.crsh.plugin.PluginLifeCycle; //导入依赖的package包/类
@Test
public void testDisabledPlugins() throws Exception {
	MockEnvironment env = new MockEnvironment();
	env.setProperty("shell.disabled_plugins",
			"GroovyREPL, termIOHandler, org.crsh.auth.AuthenticationPlugin");
	this.context = new AnnotationConfigWebApplicationContext();
	this.context.setEnvironment(env);
	this.context.register(CrshAutoConfiguration.class);
	this.context.refresh();

	PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
	assertNotNull(lifeCycle);

	assertNull(lifeCycle.getContext().getPlugin(GroovyRepl.class));
	assertNull(lifeCycle.getContext().getPlugin(ProcessorIOHandler.class));
	assertNull(lifeCycle.getContext().getPlugin(JaasAuthenticationPlugin.class));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:18,代码来源:CrshAutoConfigurationTests.java

示例9: testCommandResolution

import org.crsh.plugin.PluginLifeCycle; //导入依赖的package包/类
@Test
public void testCommandResolution() {
	this.context = new AnnotationConfigWebApplicationContext();
	this.context.register(CrshAutoConfiguration.class);
	this.context.refresh();

	PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);

	int count = 0;
	Iterator<Resource> resources = lifeCycle.getContext()
			.loadResources("login", ResourceKind.LIFECYCLE).iterator();
	while (resources.hasNext()) {
		count++;
		resources.next();
	}
	assertEquals(1, count);

	count = 0;
	resources = lifeCycle.getContext()
			.loadResources("sleep.groovy", ResourceKind.COMMAND).iterator();
	while (resources.hasNext()) {
		count++;
		resources.next();
	}
	assertEquals(1, count);
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:27,代码来源:CrshAutoConfigurationTests.java

示例10: testDisabledCommandResolution

import org.crsh.plugin.PluginLifeCycle; //导入依赖的package包/类
@Test
public void testDisabledCommandResolution() {
	this.context = new AnnotationConfigWebApplicationContext();
	this.context.register(CrshAutoConfiguration.class);
	this.context.refresh();

	PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);

	int count = 0;
	Iterator<Resource> resources = lifeCycle.getContext()
			.loadResources("jdbc.groovy", ResourceKind.COMMAND).iterator();
	while (resources.hasNext()) {
		count++;
		resources.next();
	}
	assertEquals(0, count);
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:18,代码来源:CrshAutoConfigurationTests.java

示例11: testAuthenticationProvidersAreInstalled

import org.crsh.plugin.PluginLifeCycle; //导入依赖的package包/类
@Test
public void testAuthenticationProvidersAreInstalled() {
	this.context = new AnnotationConfigWebApplicationContext();
	this.context.setServletContext(new MockServletContext());
	this.context.register(SecurityConfiguration.class);
	this.context.register(CrshAutoConfiguration.class);
	this.context.refresh();

	PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
	PluginContext pluginContext = lifeCycle.getContext();

	int count = 0;
	Iterator<AuthenticationPlugin> plugins = pluginContext
			.getPlugins(AuthenticationPlugin.class).iterator();
	while (plugins.hasNext()) {
		count++;
		plugins.next();
	}
	assertEquals(3, count);
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:21,代码来源:CrshAutoConfigurationTests.java

示例12: testJaasAuthenticationProvider

import org.crsh.plugin.PluginLifeCycle; //导入依赖的package包/类
@Test
public void testJaasAuthenticationProvider() {
	MockEnvironment env = new MockEnvironment();
	env.setProperty("shell.auth", "jaas");
	env.setProperty("shell.auth.jaas.domain", "my-test-domain");
	this.context = new AnnotationConfigWebApplicationContext();
	this.context.setEnvironment(env);
	this.context.setServletContext(new MockServletContext());
	this.context.register(SecurityConfiguration.class);
	this.context.register(CrshAutoConfiguration.class);
	this.context.refresh();

	PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
	assertEquals("jaas", lifeCycle.getConfig().get("crash.auth"));
	assertEquals("my-test-domain",
			lifeCycle.getConfig().get("crash.auth.jaas.domain"));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:18,代码来源:CrshAutoConfigurationTests.java

示例13: testKeyAuthenticationProvider

import org.crsh.plugin.PluginLifeCycle; //导入依赖的package包/类
@Test
public void testKeyAuthenticationProvider() {
	MockEnvironment env = new MockEnvironment();
	env.setProperty("shell.auth", "key");
	env.setProperty("shell.auth.key.path", "~/test.pem");
	this.context = new AnnotationConfigWebApplicationContext();
	this.context.setEnvironment(env);
	this.context.setServletContext(new MockServletContext());
	this.context.register(SecurityConfiguration.class);
	this.context.register(CrshAutoConfiguration.class);
	this.context.refresh();

	PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
	assertEquals("key", lifeCycle.getConfig().get("crash.auth"));
	assertEquals("~/test.pem", lifeCycle.getConfig().get("crash.auth.key.path"));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:17,代码来源:CrshAutoConfigurationTests.java

示例14: shellBootstrap

import org.crsh.plugin.PluginLifeCycle; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean(PluginLifeCycle.class)
public CrshBootstrapBean shellBootstrap() {
	CrshBootstrapBean bootstrapBean = new CrshBootstrapBean();
	bootstrapBean.setConfig(this.properties.asCrshShellConfig());
	return bootstrapBean;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:CrshAutoConfiguration.java

示例15: testAttributes

import org.crsh.plugin.PluginLifeCycle; //导入依赖的package包/类
@Test
public void testAttributes() throws Exception {
	load();
	PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
	Map<String, Object> attributes = lifeCycle.getContext().getAttributes();
	assertThat(attributes.containsKey("spring.version")).isTrue();
	assertThat(attributes.containsKey("spring.beanfactory")).isTrue();
	assertThat(attributes.get("spring.beanfactory"))
			.isEqualTo(this.context.getBeanFactory());
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:CrshAutoConfigurationTests.java


注:本文中的org.crsh.plugin.PluginLifeCycle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。