Polish contribution
Closes gh-7600
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,11 +26,12 @@ import java.lang.annotation.Target;
|
||||
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
|
||||
|
||||
/**
|
||||
* {@link ImportAutoConfiguration Auto-configuration imports} for typical Data Mongo tests.
|
||||
* Most tests should consider using {@link DataMongoTest @DataMongoTest} rather than using
|
||||
* this annotation directly.
|
||||
* {@link ImportAutoConfiguration Auto-configuration imports} for typical Data MongoDB
|
||||
* tests. Most tests should consider using {@link DataMongoTest @DataMongoTest} rather
|
||||
* than using this annotation directly.
|
||||
*
|
||||
* @author Michael J. Simons
|
||||
* @since 1.5.0
|
||||
* @see DataMongoTest
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -35,17 +35,17 @@ import org.springframework.test.context.BootstrapWith;
|
||||
|
||||
/**
|
||||
* Annotation that can be used in combination with {@code @RunWith(SpringRunner.class)}
|
||||
* for a typical Spring Data MongoDB test. Can be used when a test focuses
|
||||
* <strong>only</strong> on Data MongoDB components, i.e. the MongoTemplate and MongoRepositories.
|
||||
* for a typical MongoDB test. Can be used when a test focuses
|
||||
* <strong>only</strong> on MongoDB components.
|
||||
* <p>
|
||||
* Using this annotation will disable full auto-configuration and instead apply only
|
||||
* configuration relevant to Spring Data MongoDB tests.
|
||||
* configuration relevant to MongoDB tests.
|
||||
* <p>
|
||||
* By default, tests annotated with {@code @DataMongoTest} will use an embedded in-memory
|
||||
* Mongod process if "de.flapdoodle.embed:de.flapdoodle.embed.mongo" is on the
|
||||
* classpath and thus replacing the default connection to a MongoDB.
|
||||
* MongoDB process (if available).
|
||||
*
|
||||
* @author Michael J. Simons
|
||||
* @author Stephane Nicoll
|
||||
* @since 1.5.0
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
|
||||
@@ -13,6 +13,13 @@ org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration
|
||||
|
||||
# AutoConfigureDataMongo auto-configuration imports
|
||||
org.springframework.boot.test.autoconfigure.data.mongo.AutoConfigureDataMongo=\
|
||||
org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.data.mongo.MongoRepositoriesAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration
|
||||
|
||||
# AutoConfigureJdbc auto-configuration imports
|
||||
org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureJdbc=\
|
||||
org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration,\
|
||||
@@ -101,10 +108,3 @@ org.springframework.boot.test.autoconfigure.restdocs.RestDocsTestExecutionListen
|
||||
org.springframework.boot.test.autoconfigure.web.client.MockRestServiceServerResetTestExecutionListener,\
|
||||
org.springframework.boot.test.autoconfigure.web.servlet.MockMvcPrintOnlyOnFailureTestExecutionListener,\
|
||||
org.springframework.boot.test.autoconfigure.web.servlet.WebDriverTestExecutionListener
|
||||
|
||||
# AutoConfigureDataMongo auto-configuration imports
|
||||
org.springframework.boot.test.autoconfigure.data.mongo.AutoConfigureDataMongo=\
|
||||
org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.data.mongo.MongoRepositoriesAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.test.autoconfigure.data.mongo;
|
||||
|
||||
import de.flapdoodle.embed.mongo.MongodExecutable;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
/**
|
||||
* @author Michael J. Simons
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@DataMongoTest(excludeAutoConfiguration = EmbeddedMongoAutoConfiguration.class)
|
||||
public class DataMongoTestDisableEmbeddedMongoTest {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
|
||||
@Test
|
||||
public void testContextLoads() throws Exception {
|
||||
|
||||
assertThat(this.context).isNotNull();
|
||||
assertThat(this.context.getBeanNamesForType(MongodExecutable.class)).isEmpty();
|
||||
}
|
||||
}
|
||||
@@ -66,4 +66,5 @@ public class DataMongoTestIntegrationTests {
|
||||
this.thrown.expect(NoSuchBeanDefinitionException.class);
|
||||
this.applicationContext.getBean(ExampleService.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,4 +45,5 @@ public class ExampleDocument {
|
||||
public void setText(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -35,4 +35,5 @@ public class ExampleService {
|
||||
public boolean hasCollection(final String collectionName) {
|
||||
return this.mongoTemplate.collectionExists(collectionName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# Use random port for embedded Mongod.
|
||||
spring.data.mongodb.port = 0
|
||||
Reference in New Issue
Block a user