|
1 | 1 | /*
|
2 |
| - * Copyright 2014 the original author or authors. |
| 2 | + * Copyright 2014-2015 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -656,6 +656,21 @@ public void shouldAllowMultiplePropertiesOfSameTypeWithMatchingStartLettersOnNes
|
656 | 656 | assertThat((String) indexDefinitions.get(1).getIndexOptions().get("name"), equalTo("component.name"));
|
657 | 657 | }
|
658 | 658 |
|
| 659 | + /** |
| 660 | + * @see DATAMONGO-1121 |
| 661 | + */ |
| 662 | + @Test |
| 663 | + public void shouldOnlyConsiderEntitiesAsPotentialCycleCandidates() { |
| 664 | + |
| 665 | + List<IndexDefinitionHolder> indexDefinitions = prepareMappingContextAndResolveIndexForType(OuterDocumentReferingToIndexedPropertyViaDifferentNonCyclingPaths.class); |
| 666 | + |
| 667 | + assertThat(indexDefinitions, hasSize(2)); |
| 668 | + assertThat((String) indexDefinitions.get(0).getIndexOptions().get("name"), equalTo("path1.foo")); |
| 669 | + assertThat((String) indexDefinitions.get(1).getIndexOptions().get("name"), |
| 670 | + equalTo("path2.propertyWithIndexedStructure.foo")); |
| 671 | + |
| 672 | + } |
| 673 | + |
659 | 674 | @Document
|
660 | 675 | static class MixedIndexRoot {
|
661 | 676 |
|
@@ -820,6 +835,17 @@ public class NameComponent {
|
820 | 835 | NameComponent component;
|
821 | 836 | }
|
822 | 837 |
|
| 838 | + @Document |
| 839 | + public static class OuterDocumentReferingToIndexedPropertyViaDifferentNonCyclingPaths { |
| 840 | + |
| 841 | + NoCycleButIndenticallNamedPropertiesDeeplyNested path1; |
| 842 | + AlternatePathToNoCycleButIndenticallNamedPropertiesDeeplyNestedDocument path2; |
| 843 | + } |
| 844 | + |
| 845 | + public static class AlternatePathToNoCycleButIndenticallNamedPropertiesDeeplyNestedDocument { |
| 846 | + NoCycleButIndenticallNamedPropertiesDeeplyNested propertyWithIndexedStructure; |
| 847 | + } |
| 848 | + |
823 | 849 | }
|
824 | 850 |
|
825 | 851 | private static List<IndexDefinitionHolder> prepareMappingContextAndResolveIndexForType(Class<?> type) {
|
|
0 commit comments