DATACMNS-1172 - Removed ability to use scanning all packages for repository implementations again.

Kept in a separate commit, so that it's easy to add again by reverting this commit. Removed, as the new behavior is effectively what had been documented as intended behavior all the time.

Original pull request: #248.
This commit is contained in:
Oliver Gierke
2017-09-27 16:05:41 +02:00
parent da88163141
commit 8da9679fc1
8 changed files with 3 additions and 98 deletions

View File

@@ -103,14 +103,6 @@ public class AnnotationRepositoryConfigurationSourceUnitTests {
assertThat(source.shouldConsiderNestedRepositories()).isTrue();
}
@Test // DATACMNS-1172
public void returnsLimitImplementationBasePackages() {
assertThat(getConfigSource(DefaultConfiguration.class).shouldLimitRepositoryImplementationBasePackages()).isTrue();
assertThat(getConfigSource(DefaultConfigurationWithoutBasePackageLimit.class)
.shouldLimitRepositoryImplementationBasePackages()).isFalse();
}
@Test // DATACMNS-456
public void findsStringAttributeByName() {
@@ -164,9 +156,6 @@ public class AnnotationRepositoryConfigurationSourceUnitTests {
@EnableRepositories(considerNestedRepositories = true)
static class DefaultConfigurationWithNestedRepositories {}
@EnableRepositories(limitImplementationBasePackages = false)
static class DefaultConfigurationWithoutBasePackageLimit {}
@EnableRepositories(excludeFilters = { @Filter(Primary.class) })
static class ConfigurationWithExplicitFilter {}

View File

@@ -34,7 +34,6 @@ import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConstructorArgumentValues;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.data.repository.query.QueryLookupStrategy.Key;
import org.springframework.data.util.Streamable;
/**
* Unit tests for {@link DefaultRepositoryConfiguration}.
@@ -84,33 +83,6 @@ public class DefaultRepositoryConfigurationUnitTests {
assertThat(getConfiguration(source).getRepositoryFactoryBeanClassName()).isEqualTo("custom");
}
@Test // DATACMNS-1172
public void limitsImplementationBasePackages() {
when(source.shouldLimitRepositoryImplementationBasePackages()).thenReturn(true);
assertThat(getConfiguration(source, "com.acme.MyRepository").getImplementationBasePackages())
.containsOnly("com.acme");
}
@Test // DATACMNS-1172
public void limitsImplementationBasePackagesOfNestedClass() {
when(source.shouldLimitRepositoryImplementationBasePackages()).thenReturn(true);
assertThat(getConfiguration(source, NestedInterface.class.getName()).getImplementationBasePackages())
.containsOnly("org.springframework.data.repository.config");
}
@Test // DATACMNS-1172
public void shouldNotLimitImplementationBasePackages() {
when(source.getBasePackages()).thenReturn(Streamable.of("com", "org.coyote"));
assertThat(getConfiguration(source, "com.acme.MyRepository").getImplementationBasePackages()).contains("com",
"org.coyote");
}
private DefaultRepositoryConfiguration<RepositoryConfigurationSource> getConfiguration(
RepositoryConfigurationSource source) {
return getConfiguration(source, "com.acme.MyRepository");

View File

@@ -15,8 +15,7 @@
*/
package org.springframework.data.repository.config;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import java.lang.annotation.Annotation;
@@ -96,17 +95,6 @@ public class RepositoryBeanDefinitionRegistrarSupportUnitTests {
assertNoBeanDefinitionRegisteredFor("fragmentImpl");
}
@Test // DATACMNS-1172
public void shouldNotLimitImplementationBasePackages() {
AnnotationMetadata metadata = new StandardAnnotationMetadata(UnlimitedImplementationBasePackages.class, true);
registrar.registerBeanDefinitions(metadata, registry);
assertBeanDefinitionRegisteredFor("personRepository");
assertBeanDefinitionRegisteredFor("fragmentImpl");
}
@Test // DATACMNS-360
public void registeredProfileRepositoriesIfProfileActivated() {
@@ -179,7 +167,4 @@ public class RepositoryBeanDefinitionRegistrarSupportUnitTests {
@EnableRepositories(basePackageClasses = FragmentImpl.class)
static class LimitsImplementationBasePackages {}
@EnableRepositories(basePackageClasses = FragmentImpl.class, limitImplementationBasePackages = false)
static class UnlimitedImplementationBasePackages {}
}