Skip to content

Commit

Permalink
chore(deps) : Upgrade to 8.11.3 version of elasticsearch (#1271)
Browse files Browse the repository at this point in the history
* chore(deps) : Upgrade to 8.11.3 version of elasticsearch

* polish sample
  • Loading branch information
rajadilipkolli authored Dec 20, 2023
1 parent 4e1d939 commit 94f5d5d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 63 deletions.
Empty file modified boot-data-elasticsearch/mvnw
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ public Mono<Post> create(@RequestBody Post post) {
}

@GetMapping("/{id}")
public Mono<Post> get(@PathVariable("id") String id) {
public Mono<Post> get(@PathVariable String id) {
return this.posts.findById(id);
}

@PutMapping("/{id}")
public Mono<Post> update(@PathVariable("id") String id, @RequestBody Post post) {
public Mono<Post> update(@PathVariable String id, @RequestBody Post post) {
return this.posts.findById(id)
.map(p -> {
p.setTitle(post.getTitle());
Expand All @@ -99,7 +99,7 @@ public Mono<Post> update(@PathVariable("id") String id, @RequestBody Post post)
}

@DeleteMapping("/{id}")
public Mono<Void> delete(@PathVariable("id") String id) {
public Mono<Void> delete(@PathVariable String id) {
return this.posts.deleteById(id);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
spring.elasticsearch.uris=localhost:9200
spring.elasticsearch.socket-timeout=10
logging.level.com.example=DEBUG
logging.level.sql=trace
logging.level.org.springframework.data.elasticsearch.core.ReactiveElasticsearchTemplate=trace
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import java.time.Duration;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;

import static java.util.concurrent.TimeUnit.MILLISECONDS;
Expand All @@ -36,11 +37,11 @@
// Testcontainers does not work well with per_class testinstance.
// see: https://stackoverflow.com/questions/61357116/exception-mapped-port-can-only-be-obtained-after-the-container-is-started-when/61358336#61358336
@TestInstance(TestInstance.Lifecycle.PER_METHOD)
public class PostRepositoryWithTestContainersTest {
class PostRepositoryWithTestContainersTest {

@Container
static ElasticsearchContainer esContainer = new ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch:7.17.9")
.withEnv("discovery.type", "single-node");
static ElasticsearchContainer esContainer = new ElasticsearchContainer("docker.elastic.co/elasticsearch/elasticsearch:8.11.3")
.withEnv(Map.of("xpack.security.enabled", "false"));

@DynamicPropertySource
static void esProperties(DynamicPropertyRegistry registry) {
Expand All @@ -55,7 +56,7 @@ static void esProperties(DynamicPropertyRegistry registry) {

@SneakyThrows
@BeforeEach
public void setup() {
void setup() {
var countDownLatch = new CountDownLatch(1);
this.posts.deleteAll().block(Duration.ofMillis(1000));

Expand Down Expand Up @@ -87,15 +88,15 @@ void testDatabaseIsRunning() {
assertThat(esContainer.isRunning()).isTrue();
}

// @Test
// void testLoadData() {
// this.posts.findAll(Sort.by(Sort.Direction.ASC, "title"))
// .log()
// .as(StepVerifier::create)
// .consumeNextWith(user -> assertThat(user.getTitle()).isEqualTo("Post one"))
// .consumeNextWith(user -> assertThat(user.getTitle()).isEqualTo("Post two"))
// .verifyComplete();
// }
@Test
void testLoadData() {
this.posts.findAll(Sort.by(Sort.Direction.ASC, "title"))
.log()
.as(StepVerifier::create)
.consumeNextWith(user -> assertThat(user.getTitle()).isEqualTo("Post one"))
.consumeNextWith(user -> assertThat(user.getTitle()).isEqualTo("Post two"))
.verifyComplete();
}

@Test
void testSavedPostTitles() {
Expand Down
46 changes: 0 additions & 46 deletions data-mongo/nbactions.xml

This file was deleted.

0 comments on commit 94f5d5d

Please sign in to comment.