Revert "DATACOUCH-661 - Fix integrations tests from 650. (#281)"

This reverts commit d300d76add.
This commit is contained in:
Michael Nitschinger
2021-02-17 09:36:45 +01:00
parent 5165f026b7
commit 4b75425f71
2 changed files with 24 additions and 67 deletions

View File

@@ -46,43 +46,4 @@ public class Airport {
public String getIcao() {
return icao;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{ id: ");
sb.append(getId());
sb.append(", iata: ");
sb.append(iata);
sb.append(", icao: ");
sb.append(icao);
sb.append(" }");
return sb.toString();
}
public boolean equals(Object o) {
if (o == null) {
return false;
}
if (!(o instanceof Airport)) {
return false;
}
Airport that = (Airport) o;
if (diff(this.id,that.id)) {
return false;
}
if (diff(this.iata,that.iata)) {
return false;
}
if (diff(this.icao,that.icao)) {
return false;
}
return true;
}
private boolean diff(String s1, String s2){
if ((s1 == null && s2 != null) || !s1.equals(s2)) {
return true;
}
return false;
}
}

View File

@@ -16,22 +16,7 @@
package org.springframework.data.couchbase.repository;
import static java.util.Arrays.asList;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import reactor.core.publisher.Flux;
import reactor.test.StepVerifier;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.stream.Collectors;
import com.couchbase.client.core.error.IndexExistsException;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -50,8 +35,18 @@ import org.springframework.data.couchbase.util.ClusterAwareIntegrationTests;
import org.springframework.data.couchbase.util.ClusterType;
import org.springframework.data.couchbase.util.IgnoreWhen;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import reactor.test.StepVerifier;
import com.couchbase.client.core.error.IndexExistsException;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.stream.Collectors;
import static java.util.Arrays.*;
import static org.assertj.core.api.Assertions.*;
import static org.junit.jupiter.api.Assertions.*;
/**
* template class for Reactive Couchbase operations
@@ -63,10 +58,13 @@ import com.couchbase.client.core.error.IndexExistsException;
@IgnoreWhen(missesCapabilities = Capabilities.QUERY, clusterTypes = ClusterType.MOCKED)
public class ReactiveCouchbaseRepositoryQueryIntegrationTests extends ClusterAwareIntegrationTests {
@Autowired CouchbaseClientFactory clientFactory;
@Autowired
CouchbaseClientFactory clientFactory;
@Autowired ReactiveAirportRepository airportRepository; // intellij flags "Could not Autowire", but it runs ok.
@Autowired ReactiveUserRepository userRepository; // intellij flags "Could not Autowire", but it runs ok.
@Autowired
ReactiveAirportRepository airportRepository; // intellij flags "Could not Autowire", but it runs ok.
@Autowired
ReactiveUserRepository userRepository; // intellij flags "Could not Autowire", but it runs ok.
@BeforeEach
void beforeEach() {
@@ -121,7 +119,7 @@ public class ReactiveCouchbaseRepositoryQueryIntegrationTests extends ClusterAwa
@Test
void count() {
String[] iatas = { "JFK", "IAD", "SFO", "SJC", "SEA", "LAX", "PHX" };
String[] iatas = {"JFK", "IAD", "SFO", "SJC", "SEA", "LAX", "PHX"};
Future[] future = new Future[iatas.length];
ExecutorService executorService = Executors.newFixedThreadPool(iatas.length);
try {
@@ -131,7 +129,7 @@ public class ReactiveCouchbaseRepositoryQueryIntegrationTests extends ClusterAwa
airportRepository.save(airport).block();
}
Long airportCount = airportRepository.count().block();
Long airportCount = airportCount = airportRepository.count().block();
assertEquals(iatas.length, airportCount);
airportCount = airportRepository.countByIataIn("JFK", "IAD", "SFO").block();
@@ -156,7 +154,7 @@ public class ReactiveCouchbaseRepositoryQueryIntegrationTests extends ClusterAwa
}
@Test
// DATACOUCH-650
// DATACOUCH-650
void deleteAllById() {
Airport vienna = new Airport("airports::vie", "vie", "LOWW");
@@ -164,15 +162,13 @@ public class ReactiveCouchbaseRepositoryQueryIntegrationTests extends ClusterAwa
Airport losAngeles = new Airport("airports::lax", "lax", "KLAX");
try {
airportRepository.saveAll(asList(vienna, frankfurt, losAngeles)).as(StepVerifier::create)
.expectNext(vienna, frankfurt, losAngeles).verifyComplete();
airportRepository.saveAll(asList(vienna, frankfurt, losAngeles)).as(StepVerifier::create).verifyComplete();
airportRepository.deleteAllById(asList(vienna.getId(), losAngeles.getId())).as(StepVerifier::create)
.verifyComplete();
airportRepository.deleteAllById(asList(vienna.getId(), losAngeles.getId())).as(StepVerifier::create).verifyComplete();
airportRepository.findAll().as(StepVerifier::create).expectNext(frankfurt).verifyComplete();
} finally {
airportRepository.deleteAll().block();
airportRepository.deleteAll();
}
}