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


Java MongoDataAutoConfiguration类代码示例

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


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

示例1: assertVersionConfiguration

import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration; //导入依赖的package包/类
private void assertVersionConfiguration(String configuredVersion,
		String expectedVersion) {
	this.context = new AnnotationConfigApplicationContext();
	int mongoPort = SocketUtils.findAvailableTcpPort();
	EnvironmentTestUtils.addEnvironment(this.context,
			"spring.data.mongodb.port=" + mongoPort);
	if (configuredVersion != null) {
		EnvironmentTestUtils.addEnvironment(this.context,
				"spring.mongodb.embedded.version=" + configuredVersion);
	}
	this.context.register(MongoAutoConfiguration.class,
			MongoDataAutoConfiguration.class, EmbeddedMongoAutoConfiguration.class);
	this.context.refresh();
	MongoTemplate mongo = this.context.getBean(MongoTemplate.class);
	CommandResult buildInfo = mongo.executeCommand("{ buildInfo: 1 }");

	assertThat(buildInfo.getString("version")).isEqualTo(expectedVersion);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:19,代码来源:EmbeddedMongoAutoConfigurationTests.java

示例2: assertVersionConfiguration

import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration; //导入依赖的package包/类
private void assertVersionConfiguration(String configuredVersion,
		String expectedVersion) {
	this.context = new AnnotationConfigApplicationContext();
	int mongoPort = SocketUtils.findAvailableTcpPort();
	EnvironmentTestUtils.addEnvironment(this.context,
			"spring.data.mongodb.port=" + mongoPort);
	if (configuredVersion != null) {
		EnvironmentTestUtils.addEnvironment(this.context,
				"spring.mongodb.embedded.version=" + configuredVersion);
	}
	this.context.register(MongoAutoConfiguration.class,
			MongoDataAutoConfiguration.class, EmbeddedMongoAutoConfiguration.class);
	this.context.refresh();
	MongoTemplate mongo = this.context.getBean(MongoTemplate.class);
	CommandResult buildInfo = mongo.executeCommand("{ buildInfo: 1 }");

	assertThat(buildInfo.getString("version"), equalTo(expectedVersion));
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:19,代码来源:EmbeddedMongoAutoConfigurationTests.java

示例3: mongoHealthIndicator

import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration; //导入依赖的package包/类
@Test
public void mongoHealthIndicator() {
	this.context.register(MongoAutoConfiguration.class,
			ManagementServerProperties.class, MongoDataAutoConfiguration.class,
			HealthIndicatorAutoConfiguration.class);
	EnvironmentTestUtils.addEnvironment(this.context,
			"management.health.diskspace.enabled:false");
	this.context.refresh();
	Map<String, HealthIndicator> beans = this.context
			.getBeansOfType(HealthIndicator.class);
	assertThat(beans).hasSize(1);
	assertThat(beans.values().iterator().next().getClass())
			.isEqualTo(MongoHealthIndicator.class);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:HealthIndicatorAutoConfigurationTests.java

示例4: notMongoHealthIndicator

import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration; //导入依赖的package包/类
@Test
public void notMongoHealthIndicator() {
	this.context.register(MongoAutoConfiguration.class,
			ManagementServerProperties.class, MongoDataAutoConfiguration.class,
			HealthIndicatorAutoConfiguration.class);
	EnvironmentTestUtils.addEnvironment(this.context,
			"management.health.mongo.enabled:false",
			"management.health.diskspace.enabled:false");
	this.context.refresh();
	Map<String, HealthIndicator> beans = this.context
			.getBeansOfType(HealthIndicator.class);
	assertThat(beans).hasSize(1);
	assertThat(beans.values().iterator().next().getClass())
			.isEqualTo(ApplicationHealthIndicator.class);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:16,代码来源:HealthIndicatorAutoConfigurationTests.java

示例5: combinedHealthIndicator

import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration; //导入依赖的package包/类
@Test
public void combinedHealthIndicator() {
	this.context.register(MongoAutoConfiguration.class, RedisAutoConfiguration.class,
			MongoDataAutoConfiguration.class, SolrAutoConfiguration.class,
			HealthIndicatorAutoConfiguration.class);
	this.context.refresh();
	Map<String, HealthIndicator> beans = this.context
			.getBeansOfType(HealthIndicator.class);
	assertThat(beans).hasSize(4);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:HealthIndicatorAutoConfigurationTests.java

示例6: indicatorExists

import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration; //导入依赖的package包/类
@Test
public void indicatorExists() {
	this.context = new AnnotationConfigApplicationContext(
			PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class,
			MongoDataAutoConfiguration.class, EndpointAutoConfiguration.class,
			HealthIndicatorAutoConfiguration.class);
	assertThat(this.context.getBeanNamesForType(MongoTemplate.class).length)
			.isEqualTo(1);
	MongoHealthIndicator healthIndicator = this.context
			.getBean(MongoHealthIndicator.class);
	assertThat(healthIndicator).isNotNull();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:MongoHealthIndicatorTests.java

示例7: mongoSessionStore

import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration; //导入依赖的package包/类
@Test
public void mongoSessionStore() {
	load(Arrays.asList(EmbeddedMongoAutoConfiguration.class,
			MongoAutoConfiguration.class, MongoDataAutoConfiguration.class),
			"spring.session.store-type=mongo", "spring.data.mongodb.port=0");
	validateSessionRepository(MongoOperationsSessionRepository.class);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:8,代码来源:SessionAutoConfigurationTests.java

示例8: mongoSessionStoreWithCustomizations

import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration; //导入依赖的package包/类
@Test
public void mongoSessionStoreWithCustomizations() {
	load(Arrays.asList(EmbeddedMongoAutoConfiguration.class,
			MongoAutoConfiguration.class, MongoDataAutoConfiguration.class),
			"spring.session.store-type=mongo", "spring.data.mongodb.port=0",
			"spring.session.mongo.collection-name=foobar");
	MongoOperationsSessionRepository repository = validateSessionRepository(
			MongoOperationsSessionRepository.class);
	assertThat(new DirectFieldAccessor(repository).getPropertyValue("collectionName"))
			.isEqualTo("foobar");
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:SessionAutoConfigurationTests.java

示例9: mongoHealthIndicator

import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration; //导入依赖的package包/类
@Test
public void mongoHealthIndicator() {
	this.context.register(MongoAutoConfiguration.class,
			ManagementServerProperties.class, MongoDataAutoConfiguration.class,
			HealthIndicatorAutoConfiguration.class);
	EnvironmentTestUtils.addEnvironment(this.context,
			"management.health.diskspace.enabled:false");
	this.context.refresh();
	Map<String, HealthIndicator> beans = this.context
			.getBeansOfType(HealthIndicator.class);
	assertEquals(1, beans.size());
	assertEquals(MongoHealthIndicator.class,
			beans.values().iterator().next().getClass());
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:15,代码来源:HealthIndicatorAutoConfigurationTests.java

示例10: notMongoHealthIndicator

import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration; //导入依赖的package包/类
@Test
public void notMongoHealthIndicator() {
	this.context.register(MongoAutoConfiguration.class,
			ManagementServerProperties.class, MongoDataAutoConfiguration.class,
			HealthIndicatorAutoConfiguration.class);
	EnvironmentTestUtils.addEnvironment(this.context,
			"management.health.mongo.enabled:false",
			"management.health.diskspace.enabled:false");
	this.context.refresh();
	Map<String, HealthIndicator> beans = this.context
			.getBeansOfType(HealthIndicator.class);
	assertEquals(1, beans.size());
	assertEquals(ApplicationHealthIndicator.class,
			beans.values().iterator().next().getClass());
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:16,代码来源:HealthIndicatorAutoConfigurationTests.java

示例11: combinedHealthIndicator

import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration; //导入依赖的package包/类
@Test
public void combinedHealthIndicator() {
	this.context.register(MongoAutoConfiguration.class, RedisAutoConfiguration.class,
			MongoDataAutoConfiguration.class, SolrAutoConfiguration.class,
			HealthIndicatorAutoConfiguration.class);
	this.context.refresh();
	Map<String, HealthIndicator> beans = this.context
			.getBeansOfType(HealthIndicator.class);
	assertEquals(4, beans.size());
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:11,代码来源:HealthIndicatorAutoConfigurationTests.java

示例12: indicatorExists

import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration; //导入依赖的package包/类
@Test
public void indicatorExists() {
	this.context = new AnnotationConfigApplicationContext(
			PropertyPlaceholderAutoConfiguration.class, MongoAutoConfiguration.class,
			MongoDataAutoConfiguration.class, EndpointAutoConfiguration.class,
			HealthIndicatorAutoConfiguration.class);
	assertEquals(1, this.context.getBeanNamesForType(MongoTemplate.class).length);
	MongoHealthIndicator healthIndicator = this.context
			.getBean(MongoHealthIndicator.class);
	assertNotNull(healthIndicator);
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:12,代码来源:MongoHealthIndicatorTests.java


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