|
1 | 1 | /*
|
2 |
| - * Copyright 2015-216 the original author or authors. |
| 2 | + * Copyright 2015-2016 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.
|
|
55 | 55 |
|
56 | 56 | /**
|
57 | 57 | * @author Christoph Strobl
|
| 58 | + * @author Mark Paluch |
58 | 59 | */
|
59 | 60 | @RunWith(MockitoJUnitRunner.class)
|
60 | 61 | public class PathIndexResolverUnitTests {
|
@@ -490,6 +491,26 @@ IsCollectionContaining.<IndexedData> hasItems(
|
490 | 491 | new SimpleIndexedPropertyValue(IndexedOnListField.class.getName(), "values", "arya")));
|
491 | 492 | }
|
492 | 493 |
|
| 494 | + /** |
| 495 | + * @see DATAREDIS-509 |
| 496 | + */ |
| 497 | + @Test |
| 498 | + public void resolveIndexOnPrimitiveArrayField() { |
| 499 | + |
| 500 | + IndexedOnPrimitiveArrayField source = new IndexedOnPrimitiveArrayField(); |
| 501 | + source.values = new int[] { 1, 2, 3 }; |
| 502 | + |
| 503 | + Set<IndexedData> indexes = indexResolver |
| 504 | + .resolveIndexesFor(ClassTypeInformation.from(IndexedOnPrimitiveArrayField.class), source); |
| 505 | + |
| 506 | + assertThat(indexes.size(), is(3)); |
| 507 | + assertThat(indexes, |
| 508 | + IsCollectionContaining.<IndexedData> hasItems( |
| 509 | + new SimpleIndexedPropertyValue(IndexedOnPrimitiveArrayField.class.getName(), "values", 1), |
| 510 | + new SimpleIndexedPropertyValue(IndexedOnPrimitiveArrayField.class.getName(), "values", 2), |
| 511 | + new SimpleIndexedPropertyValue(IndexedOnPrimitiveArrayField.class.getName(), "values", 3))); |
| 512 | + } |
| 513 | + |
493 | 514 | private IndexedData resolve(String path, Object value) {
|
494 | 515 |
|
495 | 516 | Set<IndexedData> data = indexResolver.resolveIndex(KEYSPACE_PERSON, path, propertyMock, value);
|
@@ -519,6 +540,11 @@ static class IndexedOnListField {
|
519 | 540 | @Indexed List<String> values;
|
520 | 541 | }
|
521 | 542 |
|
| 543 | + static class IndexedOnPrimitiveArrayField { |
| 544 | + |
| 545 | + @Indexed int[] values; |
| 546 | + } |
| 547 | + |
522 | 548 | static class IndexedOnMapField {
|
523 | 549 |
|
524 | 550 | @Indexed Map<String, String> values;
|
|
0 commit comments