Skip to content

Commit 04bde5e

Browse files
authored
[DE-541] forceOneShardAttributeValue test (#274)
1 parent 66e0e2b commit 04bde5e

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

ChangeLog.md

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
66

77
## [Unreleased]
88

9+
## [3.9.0] - 2023-04-18
10+
11+
- upgraded dependency `com.arangodb:arangodb-java-driver:6.22.0` (DE-541)
12+
913
## [3.8.0] - 2023-02-08
1014

1115
- improved resolution of already fetched embedded entities (#270)

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@
299299
<dependency>
300300
<groupId>com.arangodb</groupId>
301301
<artifactId>arangodb-java-driver</artifactId>
302-
<version>6.20.0</version>
302+
<version>6.22.0</version>
303303
</dependency>
304304
<dependency>
305305
<groupId>org.mockito</groupId>

src/test/java/com/arangodb/springframework/repository/ShardedCollectionRepositoryTest.java

+18
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@
2020

2121
package com.arangodb.springframework.repository;
2222

23+
import com.arangodb.model.AqlQueryOptions;
2324
import com.arangodb.springframework.AbstractArangoTest;
2425
import com.arangodb.springframework.annotation.Document;
2526
import org.junit.Test;
2627
import org.springframework.beans.factory.annotation.Autowired;
2728
import org.springframework.data.annotation.Id;
2829

30+
import java.util.List;
31+
import java.util.Optional;
32+
2933
import static org.assertj.core.api.Assertions.assertThat;
3034

3135
/**
@@ -50,6 +54,19 @@ public void save() {
5054
assertThat(d3.country).isEqualTo("country1");
5155
assertThat(d3.name).isEqualTo("name3");
5256
}
57+
58+
@Test
59+
public void forceOneShardAttributeValue() {
60+
ShardedUser d = shardedRepository.save(new ShardedUser(null, "foo", "bar"));
61+
Optional<ShardedUser> res = shardedRepository.findByName("foo", new AqlQueryOptions()
62+
.forceOneShardAttributeValue("bar")
63+
).stream().findFirst();
64+
assertThat(res).isPresent();
65+
assertThat(res.get().key).isEqualTo(d.key);
66+
assertThat(res.get().name).isEqualTo(d.name);
67+
assertThat(res.get().country).isEqualTo(d.country);
68+
}
69+
5370
}
5471

5572
@Document(shardKeys = "country", numberOfShards = 10)
@@ -68,4 +85,5 @@ public ShardedUser(String key, String name, String country) {
6885
}
6986

7087
interface ShardedRepository extends ArangoRepository<ShardedUser, String> {
88+
List<ShardedUser> findByName(String name, AqlQueryOptions options);
7189
}

0 commit comments

Comments
 (0)