• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PluginLifeCycle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: testSshConfiguration

import org.crsh.plugin.PluginLifeCycle; //导入依赖的package包/类
@Test
public void testSshConfiguration() {
	load("management.shell.ssh.enabled=true", "management.shell.ssh.port=3333");
	PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
	assertThat(lifeCycle.getConfig().getProperty("crash.ssh.port")).isEqualTo("3333");
	assertThat(lifeCycle.getConfig().getProperty("crash.ssh.auth_timeout"))
			.isEqualTo("600000");
	assertThat(lifeCycle.getConfig().getProperty("crash.ssh.idle_timeout"))
			.isEqualTo("600000");
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:CrshAutoConfigurationTests.java


示例17: testSshConfigurationWithKeyPath

import org.crsh.plugin.PluginLifeCycle; //导入依赖的package包/类
@Test
public void testSshConfigurationWithKeyPath() {
	load("management.shell.ssh.enabled=true",
			"management.shell.ssh.key_path=~/.ssh/id.pem");
	PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
	assertThat(lifeCycle.getConfig().getProperty("crash.ssh.keypath"))
			.isEqualTo("~/.ssh/id.pem");
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:9,代码来源:CrshAutoConfigurationTests.java


示例18: testSshConfigurationCustomTimeouts

import org.crsh.plugin.PluginLifeCycle; //导入依赖的package包/类
@Test
public void testSshConfigurationCustomTimeouts() {
	load("management.shell.ssh.enabled=true",
			"management.shell.ssh.auth-timeout=300000",
			"management.shell.ssh.idle-timeout=400000");
	PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
	assertThat(lifeCycle.getConfig().getProperty("crash.ssh.auth_timeout"))
			.isEqualTo("300000");
	assertThat(lifeCycle.getConfig().getProperty("crash.ssh.idle_timeout"))
			.isEqualTo("400000");
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:CrshAutoConfigurationTests.java


示例19: testDisabledCommandResolution

import org.crsh.plugin.PluginLifeCycle; //导入依赖的package包/类
@Test
public void testDisabledCommandResolution() {
	load();
	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();
	}
	assertThat(count).isEqualTo(0);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:CrshAutoConfigurationTests.java


示例20: testDefaultAuthenticationProvider

import org.crsh.plugin.PluginLifeCycle; //导入依赖的package包/类
@Test
public void testDefaultAuthenticationProvider() {
	MockEnvironment env = new MockEnvironment();
	this.context = new AnnotationConfigWebApplicationContext();
	this.context.setEnvironment(env);
	this.context.setServletContext(new MockServletContext());
	this.context.register(CrshAutoConfiguration.class);
	this.context.refresh();
	PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
	assertThat(lifeCycle.getConfig().get("crash.auth")).isEqualTo("simple");
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:CrshAutoConfigurationTests.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ExpandableRecyclerAdapter类代码示例发布时间:2022-05-22
下一篇:
Java StaxReader类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap