diff --git a/persistence-modules/spring-data-mongodb-reactive/pom.xml b/persistence-modules/spring-data-mongodb-reactive/pom.xml
index 9fb22b6033..c1398ca80d 100644
--- a/persistence-modules/spring-data-mongodb-reactive/pom.xml
+++ b/persistence-modules/spring-data-mongodb-reactive/pom.xml
@@ -22,11 +22,11 @@
org.springframework.boot
- spring-boot-starter-data-couchbase-reactive
+ spring-boot-starter-data-mongodb-reactive
org.springframework.boot
- spring-boot-starter-data-mongodb-reactive
+ spring-boot-starter-data-mongodb
org.springframework.boot
@@ -68,16 +68,6 @@
spring-tx
${spring-tx.version}
-
- org.springframework.data
- spring-data-r2dbc
- ${spring-data-r2dbc.version}
-
-
- io.r2dbc
- r2dbc-h2
- ${r2dbc-h2.version}
-
com.h2database
h2
@@ -88,12 +78,6 @@
httpclient
${httpclient.version}
-
- com.couchbase.mock
- CouchbaseMock
- ${couchbaseMock.version}
- test
-
@@ -141,17 +125,9 @@
5.2.2.RELEASE
- 1.0.0.RELEASE
- 0.8.1.RELEASE
4.5.2
1.4.200
- 1.5.23
3.3.1.RELEASE
-
- 2.2.6.RELEASE
\ No newline at end of file
diff --git a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/ReactiveCouchbaseApplication.java b/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/ReactiveCouchbaseApplication.java
deleted file mode 100644
index 4e5bf9d5dc..0000000000
--- a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/ReactiveCouchbaseApplication.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.baeldung.couchbase;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
-
-@SpringBootApplication(exclude = MongoAutoConfiguration.class)
-public class ReactiveCouchbaseApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(ReactiveCouchbaseApplication.class, args);
- }
-}
diff --git a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/configuration/CouchbaseProperties.java b/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/configuration/CouchbaseProperties.java
deleted file mode 100644
index 81f19eebd6..0000000000
--- a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/configuration/CouchbaseProperties.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.baeldung.couchbase.configuration;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.PropertySource;
-
-import java.util.Collections;
-import java.util.List;
-
-@Configuration
-@PropertySource("classpath:couchbase.properties")
-public class CouchbaseProperties {
-
- private final List bootstrapHosts;
- private final String bucketName;
- private final String bucketPassword;
- private final int port;
-
- public CouchbaseProperties(@Value("${spring.couchbase.bootstrap-hosts}") final List bootstrapHosts, @Value("${spring.couchbase.bucket.name}") final String bucketName, @Value("${spring.couchbase.bucket.password}") final String bucketPassword,
- @Value("${spring.couchbase.port}") final int port) {
- this.bootstrapHosts = Collections.unmodifiableList(bootstrapHosts);
- this.bucketName = bucketName;
- this.bucketPassword = bucketPassword;
- this.port = port;
- }
-
- public List getBootstrapHosts() {
- return bootstrapHosts;
- }
-
- public String getBucketName() {
- return bucketName;
- }
-
- public String getBucketPassword() {
- return bucketPassword;
- }
-
- public int getPort() {
- return port;
- }
-}
diff --git a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/configuration/N1QLReactiveCouchbaseConfiguration.java b/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/configuration/N1QLReactiveCouchbaseConfiguration.java
deleted file mode 100644
index 059bd36cae..0000000000
--- a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/configuration/N1QLReactiveCouchbaseConfiguration.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.baeldung.couchbase.configuration;
-
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Primary;
-import org.springframework.data.couchbase.repository.config.EnableReactiveCouchbaseRepositories;
-
-@Configuration
-@EnableReactiveCouchbaseRepositories("com.baeldung.couchbase.domain.repository.n1ql")
-@Primary
-public class N1QLReactiveCouchbaseConfiguration extends ReactiveCouchbaseConfiguration {
-
- public N1QLReactiveCouchbaseConfiguration(CouchbaseProperties couchbaseProperties) {
- super(couchbaseProperties);
- }
-}
diff --git a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/configuration/ReactiveCouchbaseConfiguration.java b/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/configuration/ReactiveCouchbaseConfiguration.java
deleted file mode 100644
index a51b19ee22..0000000000
--- a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/configuration/ReactiveCouchbaseConfiguration.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.baeldung.couchbase.configuration;
-
-import com.couchbase.client.java.env.CouchbaseEnvironment;
-import com.couchbase.client.java.env.DefaultCouchbaseEnvironment;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.data.couchbase.config.AbstractReactiveCouchbaseConfiguration;
-import org.springframework.data.couchbase.config.BeanNames;
-import org.springframework.data.couchbase.repository.support.IndexManager;
-
-import java.util.List;
-
-public abstract class ReactiveCouchbaseConfiguration extends AbstractReactiveCouchbaseConfiguration {
-
- private CouchbaseProperties couchbaseProperties;
-
- public ReactiveCouchbaseConfiguration(final CouchbaseProperties couchbaseProperties) {
- this.couchbaseProperties = couchbaseProperties;
- }
-
- @Override
- protected List getBootstrapHosts() {
- return couchbaseProperties.getBootstrapHosts();
- }
-
- @Override
- protected String getBucketName() {
- return couchbaseProperties.getBucketName();
- }
-
- @Override
- protected String getBucketPassword() {
- return couchbaseProperties.getBucketPassword();
- }
-
- @Override
- public CouchbaseEnvironment couchbaseEnvironment() {
- return DefaultCouchbaseEnvironment
- .builder()
- .bootstrapHttpDirectPort(couchbaseProperties.getPort())
- .build();
- }
-
- @Bean(name = BeanNames.COUCHBASE_INDEX_MANAGER)
- public IndexManager couchbaseIndexManager() {
- return new IndexManager(true, true, false);
- }
-}
diff --git a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/configuration/ViewReactiveCouchbaseConfiguration.java b/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/configuration/ViewReactiveCouchbaseConfiguration.java
deleted file mode 100644
index 9b4d9b0319..0000000000
--- a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/configuration/ViewReactiveCouchbaseConfiguration.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.baeldung.couchbase.configuration;
-
-import org.springframework.context.annotation.Configuration;
-import org.springframework.data.couchbase.repository.config.EnableReactiveCouchbaseRepositories;
-
-@Configuration
-@EnableReactiveCouchbaseRepositories("com.baeldung.couchbase.domain.repository.view")
-public class ViewReactiveCouchbaseConfiguration extends ReactiveCouchbaseConfiguration {
-
- public ViewReactiveCouchbaseConfiguration(CouchbaseProperties couchbaseProperties) {
- super(couchbaseProperties);
- }
-}
diff --git a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/domain/Person.java b/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/domain/Person.java
deleted file mode 100644
index 285de34df8..0000000000
--- a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/domain/Person.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.baeldung.couchbase.domain;
-
-import org.springframework.data.annotation.Id;
-import org.springframework.data.couchbase.core.mapping.Document;
-
-import java.util.Objects;
-import java.util.UUID;
-
-@Document
-public class Person {
-
- @Id private UUID id;
- private String firstName;
-
- public Person(final UUID id, final String firstName) {
- this.id = id;
- this.firstName = firstName;
- }
-
- private Person() {
- }
-
- public UUID getId() {
- return id;
- }
-
- public String getFirstName() {
- return firstName;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- Person person = (Person) o;
- return Objects.equals(id, person.id) && Objects.equals(firstName, person.firstName);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, firstName);
- }
-}
diff --git a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/domain/repository/n1ql/N1QLPersonRepository.java b/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/domain/repository/n1ql/N1QLPersonRepository.java
deleted file mode 100644
index 6f73a77ceb..0000000000
--- a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/domain/repository/n1ql/N1QLPersonRepository.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.baeldung.couchbase.domain.repository.n1ql;
-
-import com.baeldung.couchbase.domain.Person;
-import org.springframework.data.couchbase.core.query.N1qlPrimaryIndexed;
-import org.springframework.data.repository.reactive.ReactiveCrudRepository;
-import org.springframework.stereotype.Repository;
-import reactor.core.publisher.Flux;
-
-import java.util.UUID;
-
-@Repository
-@N1qlPrimaryIndexed
-public interface N1QLPersonRepository extends ReactiveCrudRepository {
-
- Flux findAllByFirstName(final String firstName);
-}
diff --git a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/domain/repository/n1ql/N1QLSortingPersonRepository.java b/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/domain/repository/n1ql/N1QLSortingPersonRepository.java
deleted file mode 100644
index 57dd149425..0000000000
--- a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/domain/repository/n1ql/N1QLSortingPersonRepository.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.baeldung.couchbase.domain.repository.n1ql;
-
-import com.baeldung.couchbase.domain.Person;
-import org.springframework.data.couchbase.core.query.N1qlPrimaryIndexed;
-import org.springframework.data.repository.reactive.ReactiveSortingRepository;
-import org.springframework.stereotype.Repository;
-
-import java.util.UUID;
-
-@Repository
-@N1qlPrimaryIndexed
-public interface N1QLSortingPersonRepository extends ReactiveSortingRepository {
-}
diff --git a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/domain/repository/view/ViewPersonRepository.java b/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/domain/repository/view/ViewPersonRepository.java
deleted file mode 100644
index 06c47c2393..0000000000
--- a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/couchbase/domain/repository/view/ViewPersonRepository.java
+++ /dev/null
@@ -1,20 +0,0 @@
-package com.baeldung.couchbase.domain.repository.view;
-
-import com.baeldung.couchbase.domain.Person;
-import org.springframework.data.couchbase.core.query.View;
-import org.springframework.data.couchbase.core.query.ViewIndexed;
-import org.springframework.data.repository.reactive.ReactiveCrudRepository;
-import org.springframework.stereotype.Repository;
-import reactor.core.publisher.Flux;
-
-import java.util.UUID;
-
-@Repository
-@ViewIndexed(designDoc = ViewPersonRepository.DESIGN_DOCUMENT)
-public interface ViewPersonRepository extends ReactiveCrudRepository {
-
- String DESIGN_DOCUMENT = "person";
-
- @View(designDocument = ViewPersonRepository.DESIGN_DOCUMENT)
- Flux findByFirstName(String firstName);
-}
diff --git a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/r2dbc/R2dbcApplication.java b/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/r2dbc/R2dbcApplication.java
deleted file mode 100644
index 557b6ff42a..0000000000
--- a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/r2dbc/R2dbcApplication.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.baeldung.r2dbc;
-
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.context.annotation.ComponentScan;
-
-@SpringBootApplication
-@ComponentScan(basePackages = "com.baeldung.r2dbc")
-public class R2dbcApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(R2dbcApplication.class, args);
- }
-
-}
\ No newline at end of file
diff --git a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/r2dbc/configuration/R2DBCConfiguration.java b/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/r2dbc/configuration/R2DBCConfiguration.java
deleted file mode 100644
index 54f06d9c6c..0000000000
--- a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/r2dbc/configuration/R2DBCConfiguration.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.baeldung.r2dbc.configuration;
-
-import io.r2dbc.h2.H2ConnectionConfiguration;
-import io.r2dbc.h2.H2ConnectionFactory;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.data.r2dbc.config.AbstractR2dbcConfiguration;
-import org.springframework.data.r2dbc.repository.config.EnableR2dbcRepositories;
-
-@Configuration
-@EnableR2dbcRepositories(basePackages = "com.baeldung.r2dbc.repository")
-public class R2DBCConfiguration extends AbstractR2dbcConfiguration {
- @Bean
- public H2ConnectionFactory connectionFactory() {
- return new H2ConnectionFactory(
- H2ConnectionConfiguration.builder()
- .url("mem:testdb;DB_CLOSE_DELAY=-1;TRACE_LEVEL_FILE=4")
- .username("sa")
- .build());
- }
-}
\ No newline at end of file
diff --git a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/r2dbc/model/Player.java b/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/r2dbc/model/Player.java
deleted file mode 100644
index 1e28cb3d07..0000000000
--- a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/r2dbc/model/Player.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.baeldung.r2dbc.model;
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import org.springframework.data.annotation.Id;
-import org.springframework.data.relational.core.mapping.Table;
-
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@Table
-public class Player {
- @Id
- Integer id;
- String name;
- Integer age;
-}
\ No newline at end of file
diff --git a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/r2dbc/repository/PlayerRepository.java b/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/r2dbc/repository/PlayerRepository.java
deleted file mode 100644
index 20f7642a7c..0000000000
--- a/persistence-modules/spring-data-mongodb-reactive/src/main/java/com/baeldung/r2dbc/repository/PlayerRepository.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.baeldung.r2dbc.repository;
-
-import org.springframework.data.r2dbc.repository.Query;
-import org.springframework.data.repository.reactive.ReactiveCrudRepository;
-
-import com.baeldung.r2dbc.model.Player;
-
-import reactor.core.publisher.Flux;
-
-public interface PlayerRepository extends ReactiveCrudRepository {
-
- @Query("select id, name, age from player where name = $1")
- Flux findAllByName(String name);
-
- @Query("select * from player where age = $1")
- Flux findByAge(int age);
-}
\ No newline at end of file
diff --git a/persistence-modules/spring-data-mongodb-reactive/src/main/resources/couchbase.properties b/persistence-modules/spring-data-mongodb-reactive/src/main/resources/couchbase.properties
deleted file mode 100644
index 53fad807fe..0000000000
--- a/persistence-modules/spring-data-mongodb-reactive/src/main/resources/couchbase.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-spring.couchbase.bucket.name=default
-spring.couchbase.bootstrap-hosts=localhost
-spring.couchbase.port=8091
-spring.couchbase.bucket.password=123456
\ No newline at end of file
diff --git a/persistence-modules/spring-data-mongodb-reactive/src/test/java/com/baeldung/couchbase/domain/repository/CouchbaseMockConfiguration.java b/persistence-modules/spring-data-mongodb-reactive/src/test/java/com/baeldung/couchbase/domain/repository/CouchbaseMockConfiguration.java
deleted file mode 100644
index 2a09fce4b0..0000000000
--- a/persistence-modules/spring-data-mongodb-reactive/src/test/java/com/baeldung/couchbase/domain/repository/CouchbaseMockConfiguration.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.baeldung.couchbase.domain.repository;
-
-import com.baeldung.couchbase.configuration.CouchbaseProperties;
-import com.couchbase.mock.Bucket;
-import com.couchbase.mock.BucketConfiguration;
-import com.couchbase.mock.CouchbaseMock;
-import org.springframework.boot.test.context.TestConfiguration;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.PreDestroy;
-import java.io.IOException;
-import java.io.UncheckedIOException;
-import java.util.Collections;
-
-@TestConfiguration
-public class CouchbaseMockConfiguration {
-
- private CouchbaseMock couchbaseMock;
-
- public CouchbaseMockConfiguration(final CouchbaseProperties couchbaseProperties) {
- final BucketConfiguration bucketConfiguration = new BucketConfiguration();
- bucketConfiguration.numNodes = 1;
- bucketConfiguration.numReplicas = 1;
- bucketConfiguration.numVBuckets = 1024;
- bucketConfiguration.name = couchbaseProperties.getBucketName();
- bucketConfiguration.type = Bucket.BucketType.COUCHBASE;
- bucketConfiguration.password = couchbaseProperties.getBucketPassword();
-
- try {
- couchbaseMock = new CouchbaseMock(couchbaseProperties.getPort(), Collections.singletonList(bucketConfiguration));
- } catch (final IOException ex) {
- throw new UncheckedIOException(ex);
- }
- }
-
- @PostConstruct
- public void postConstruct() {
- try {
- couchbaseMock.start();
- } catch (final IOException ex) {
- throw new UncheckedIOException(ex);
- }
- try {
- couchbaseMock.waitForStartup();
- } catch (final InterruptedException ex) {
- throw new RuntimeException(ex);
- }
- }
-
- @PreDestroy
- public void preDestroy() {
- couchbaseMock.stop();
- }
-}
diff --git a/persistence-modules/spring-data-mongodb-reactive/src/test/java/com/baeldung/couchbase/domain/repository/n1ql/N1QLPersonRepositoryLiveTest.java b/persistence-modules/spring-data-mongodb-reactive/src/test/java/com/baeldung/couchbase/domain/repository/n1ql/N1QLPersonRepositoryLiveTest.java
deleted file mode 100644
index c8dbbf429e..0000000000
--- a/persistence-modules/spring-data-mongodb-reactive/src/test/java/com/baeldung/couchbase/domain/repository/n1ql/N1QLPersonRepositoryLiveTest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package com.baeldung.couchbase.domain.repository.n1ql;
-
-import com.baeldung.couchbase.domain.Person;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-import reactor.core.publisher.Flux;
-import reactor.test.StepVerifier;
-
-import java.util.UUID;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(properties = {"spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration"})
-public class N1QLPersonRepositoryLiveTest {
-
- @Autowired private N1QLPersonRepository personRepository;
-
- @Test
- public void shouldFindAll_byLastName() {
- //Given
- final String firstName = "John";
- final Person matchingPerson = new Person(UUID.randomUUID(), firstName);
- final Person nonMatchingPerson = new Person(UUID.randomUUID(), "NotJohn");
- wrap(() -> {
- personRepository
- .save(matchingPerson)
- .subscribe();
- personRepository
- .save(nonMatchingPerson)
- .subscribe();
- //When
- final Flux allByFirstName = personRepository.findAllByFirstName(firstName);
- //Then
- StepVerifier
- .create(allByFirstName)
- .expectNext(matchingPerson)
- .verifyComplete();
-
- }, matchingPerson, nonMatchingPerson);
- }
-
- private void wrap(final Runnable runnable, final Person... people) {
- try {
- runnable.run();
- } finally {
- for (final Person person : people) {
- personRepository
- .delete(person)
- .subscribe();
- }
- }
- }
-}
\ No newline at end of file
diff --git a/persistence-modules/spring-data-mongodb-reactive/src/test/java/com/baeldung/couchbase/domain/repository/n1ql/N1QLSortingPersonRepositoryLiveTest.java b/persistence-modules/spring-data-mongodb-reactive/src/test/java/com/baeldung/couchbase/domain/repository/n1ql/N1QLSortingPersonRepositoryLiveTest.java
deleted file mode 100644
index 8c6ce137f1..0000000000
--- a/persistence-modules/spring-data-mongodb-reactive/src/test/java/com/baeldung/couchbase/domain/repository/n1ql/N1QLSortingPersonRepositoryLiveTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package com.baeldung.couchbase.domain.repository.n1ql;
-
-import com.baeldung.couchbase.domain.Person;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.data.domain.Sort;
-import org.springframework.test.context.junit4.SpringRunner;
-import reactor.core.publisher.Flux;
-import reactor.test.StepVerifier;
-
-import java.util.UUID;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(properties = {"spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration"})
-public class N1QLSortingPersonRepositoryLiveTest {
-
- @Autowired private N1QLSortingPersonRepository personRepository;
-
- @Test
- public void shouldFindAll_sortedByFirstName() {
- //Given
- final Person firstPerson = new Person(UUID.randomUUID(), "John");
- final Person secondPerson = new Person(UUID.randomUUID(), "Mikki");
- wrap(() -> {
- personRepository
- .save(firstPerson)
- .subscribe();
- personRepository
- .save(secondPerson)
- .subscribe();
- //When
- final Flux allByFirstName = personRepository.findAll(Sort.by(Sort.Direction.DESC, "firstName"));
- //Then
- StepVerifier
- .create(allByFirstName)
- .expectNextMatches(person -> person
- .getFirstName()
- .equals(secondPerson.getFirstName()))
- .expectNextMatches(person -> person
- .getFirstName()
- .equals(firstPerson.getFirstName()))
- .verifyComplete();
- }, firstPerson, secondPerson);
- }
-
- //workaround for deleteAll()
- private void wrap(final Runnable runnable, final Person... people) {
- try {
- runnable.run();
- } finally {
- for (final Person person : people) {
- personRepository
- .delete(person)
- .subscribe();
- }
- }
- }
-}
\ No newline at end of file
diff --git a/persistence-modules/spring-data-mongodb-reactive/src/test/java/com/baeldung/couchbase/domain/repository/view/ViewPersonRepositoryIntegrationTest.java b/persistence-modules/spring-data-mongodb-reactive/src/test/java/com/baeldung/couchbase/domain/repository/view/ViewPersonRepositoryIntegrationTest.java
deleted file mode 100644
index 15688e1b80..0000000000
--- a/persistence-modules/spring-data-mongodb-reactive/src/test/java/com/baeldung/couchbase/domain/repository/view/ViewPersonRepositoryIntegrationTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package com.baeldung.couchbase.domain.repository.view;
-
-import com.baeldung.couchbase.configuration.CouchbaseProperties;
-import com.baeldung.couchbase.configuration.ViewReactiveCouchbaseConfiguration;
-import com.baeldung.couchbase.domain.Person;
-import com.baeldung.couchbase.domain.repository.CouchbaseMockConfiguration;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Mono;
-import reactor.test.StepVerifier;
-
-import java.util.UUID;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest(properties = { "spring.couchbase.port=10010", "spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration,org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration" },
- classes = { CouchbaseMockConfiguration.class, ViewReactiveCouchbaseConfiguration.class, CouchbaseProperties.class })
-public class ViewPersonRepositoryIntegrationTest {
-
- @Autowired private ViewPersonRepository personRepository;
-
- @Test
- public void shouldSavePerson_findById_thenDeleteIt() {
- //Given
- final UUID id = UUID.randomUUID();
- final Person person = new Person(id, "John");
- wrap(() -> {
- personRepository
- .save(person)
- .subscribe();
- //When
- final Mono byId = personRepository.findById(id);
- //Then
- StepVerifier
- .create(byId)
- .expectNextMatches(result -> result
- .getId()
- .equals(id))
- .expectComplete()
- .verify();
- }, person);
- }
-
- @Test
- public void shouldFindAll_thenDeleteIt() {
- //Given
- final Person person = new Person(UUID.randomUUID(), "John");
- final Person secondPerson = new Person(UUID.randomUUID(), "Mikki");
- wrap(() -> {
- personRepository
- .save(person)
- .subscribe();
- personRepository
- .save(secondPerson)
- .subscribe();
- //When
- final Flux all = personRepository.findAll();
- //Then
- StepVerifier
- .create(all)
- .expectNextCount(2)
- .verifyComplete();
- }, person, secondPerson);
- }
-
- private void wrap(final Runnable runnable, final Person... people) {
- try {
- runnable.run();
- } finally {
- for (final Person person : people) {
- personRepository
- .delete(person)
- .subscribe();
- }
- }
- }
-}
\ No newline at end of file
diff --git a/persistence-modules/spring-data-mongodb-reactive/src/test/java/com/baeldung/r2dbc/R2dbcApplicationIntegrationTest.java b/persistence-modules/spring-data-mongodb-reactive/src/test/java/com/baeldung/r2dbc/R2dbcApplicationIntegrationTest.java
deleted file mode 100644
index 1af570587e..0000000000
--- a/persistence-modules/spring-data-mongodb-reactive/src/test/java/com/baeldung/r2dbc/R2dbcApplicationIntegrationTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package com.baeldung.r2dbc;
-
-
-import com.baeldung.r2dbc.model.Player;
-import com.baeldung.r2dbc.repository.PlayerRepository;
-import io.r2dbc.h2.H2ConnectionFactory;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.data.r2dbc.core.DatabaseClient;
-import org.springframework.test.context.junit4.SpringRunner;
-import reactor.core.publisher.Flux;
-import reactor.core.publisher.Hooks;
-import reactor.core.publisher.Mono;
-import reactor.test.StepVerifier;
-
-import java.util.Arrays;
-import java.util.List;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest
-public class R2dbcApplicationIntegrationTest {
-
-
- @Autowired
- PlayerRepository playerRepository;
-
- @Autowired
- DatabaseClient client;
-
- @Autowired
- H2ConnectionFactory factory;
-
-
- @Before
- public void setup() {
-
- Hooks.onOperatorDebug();
-
- List statements = Arrays.asList(//
- "DROP TABLE IF EXISTS player;",
- "CREATE table player (id INT AUTO_INCREMENT NOT NULL, name VARCHAR2, age INT NOT NULL);");
-
- statements.forEach(it -> client.execute(it) //
- .fetch() //
- .rowsUpdated() //
- .as(StepVerifier::create) //
- .expectNextCount(1) //
- .verifyComplete());
-
- }
-
- @Test
- public void whenDeleteAll_then0IsExpected() {
-
-
- playerRepository.deleteAll()
- .as(StepVerifier::create)
- .expectNextCount(0)
- .verifyComplete();
- }
-
- @Test
- public void whenInsert6_then6AreExpected() {
-
- insertPlayers();
-
- playerRepository.findAll()
- .as(StepVerifier::create)
- .expectNextCount(6)
- .verifyComplete();
- }
-
- @Test
- public void whenSearchForCR7_then1IsExpected() {
-
- insertPlayers();
-
- playerRepository.findAllByName("CR7")
- .as(StepVerifier::create)
- .expectNextCount(1)
- .verifyComplete();
- }
-
- @Test
- public void whenSearchFor32YearsOld_then2AreExpected() {
- insertPlayers();
-
- playerRepository.findByAge(32)
- .as(StepVerifier::create)
- .expectNextCount(2)
- .verifyComplete();
- }
-
- @Test
- public void whenBatchHas2Operations_then2AreExpected() {
- Mono.from(factory.create())
- .flatMapMany(connection -> Flux.from(connection
- .createBatch()
- .add("select * from player")
- .add("select * from player")
- .execute()))
- .as(StepVerifier::create)
- .expectNextCount(2)
- .verifyComplete();
-
- }
-
- private void insertPlayers() {
- List players = Arrays.asList(
- new Player(null, "Kaka", 37),
- new Player(null, "Messi", 32),
- new Player(null, "Mbappé", 20),
- new Player(null, "CR7", 34),
- new Player(null, "Lewandowski", 30),
- new Player(null, "Cavani", 32)
- );
-
- playerRepository.saveAll(players).subscribe();
- }
-}
-
diff --git a/persistence-modules/spring-data-mongodb-reactive/src/test/java/com/baeldung/tailablecursor/service/ErrorLogsCounterManualTest.java b/persistence-modules/spring-data-mongodb-reactive/src/test/java/com/baeldung/tailablecursor/service/ErrorLogsCounterManualTest.java
index 5e20d3ec79..e3feda5777 100644
--- a/persistence-modules/spring-data-mongodb-reactive/src/test/java/com/baeldung/tailablecursor/service/ErrorLogsCounterManualTest.java
+++ b/persistence-modules/spring-data-mongodb-reactive/src/test/java/com/baeldung/tailablecursor/service/ErrorLogsCounterManualTest.java
@@ -1,18 +1,11 @@
package com.baeldung.tailablecursor.service;
-import com.baeldung.tailablecursor.domain.Log;
-import com.baeldung.tailablecursor.domain.LogLevel;
-import com.mongodb.MongoClient;
-import com.mongodb.client.MongoCollection;
-import com.mongodb.client.MongoDatabase;
-import com.mongodb.client.model.CreateCollectionOptions;
-import de.flapdoodle.embed.mongo.MongodExecutable;
-import de.flapdoodle.embed.mongo.MongodProcess;
-import de.flapdoodle.embed.mongo.MongodStarter;
-import de.flapdoodle.embed.mongo.config.MongodConfigBuilder;
-import de.flapdoodle.embed.mongo.config.Net;
-import de.flapdoodle.embed.mongo.distribution.Version;
-import de.flapdoodle.embed.process.runtime.Network;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
+import java.io.IOException;
+import java.util.stream.IntStream;
+
import org.bson.Document;
import org.junit.After;
import org.junit.Before;
@@ -20,11 +13,22 @@ import org.junit.Test;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.util.SocketUtils;
-import java.io.IOException;
-import java.util.stream.IntStream;
+import com.baeldung.tailablecursor.domain.Log;
+import com.baeldung.tailablecursor.domain.LogLevel;
+import com.mongodb.client.MongoClient;
+import com.mongodb.client.MongoClients;
+import com.mongodb.client.MongoCollection;
+import com.mongodb.client.MongoDatabase;
+import com.mongodb.client.model.CreateCollectionOptions;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
+import de.flapdoodle.embed.mongo.MongodExecutable;
+import de.flapdoodle.embed.mongo.MongodProcess;
+import de.flapdoodle.embed.mongo.MongodStarter;
+import de.flapdoodle.embed.mongo.config.ImmutableMongodConfig;
+import de.flapdoodle.embed.mongo.config.MongodConfig;
+import de.flapdoodle.embed.mongo.config.Net;
+import de.flapdoodle.embed.mongo.distribution.Version;
+import de.flapdoodle.embed.process.runtime.Network;
public class ErrorLogsCounterManualTest {
@@ -35,6 +39,8 @@ public class ErrorLogsCounterManualTest {
private static final MongodStarter starter = MongodStarter.getDefaultInstance();
private static final int MAX_DOCUMENTS_IN_COLLECTION = 3;
+
+ private static final String CONNECTION_STRING = "mongodb://%s:%d";
private ErrorLogsCounter errorLogsCounter;
private MongodExecutable mongodExecutable;
@@ -54,13 +60,18 @@ public class ErrorLogsCounterManualTest {
}
private MongoTemplate initMongoTemplate() throws IOException {
- mongodExecutable = starter.prepare(new MongodConfigBuilder()
- .version(Version.Main.PRODUCTION)
- .net(new Net(SERVER, PORT, Network.localhostIsIPv6()))
- .build());
+
+
+ final ImmutableMongodConfig mongodConfig = MongodConfig.builder()
+ .version(Version.Main.PRODUCTION)
+ .net(new Net(SERVER, PORT, Network.localhostIsIPv6()))
+ .build();
+
+ mongodExecutable = starter.prepare(mongodConfig);
mongoDaemon = mongodExecutable.start();
-
- MongoClient mongoClient = new MongoClient(SERVER, PORT);
+
+ MongoClient mongoClient = MongoClients.create(String.format(CONNECTION_STRING, SERVER, PORT));
+
db = mongoClient.getDatabase(DB_NAME);
return new MongoTemplate(mongoClient, DB_NAME);