Skip to content

Commit

Permalink
feat: upgrade dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
rhajek committed Apr 1, 2022
1 parent 7a6d40a commit 966bbb2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import com.influxdb.client.InfluxDBClient;
import com.influxdb.client.domain.HealthCheck;

import io.reactivex.rxjava3.core.Single;
import org.reactivestreams.Publisher;

/**
* The reference RxJava client for the <a href="https://github.com/influxdata/influxdb">InfluxDB 2.0</a>
Expand Down Expand Up @@ -68,7 +68,7 @@ public interface InfluxDBClientReactive extends AutoCloseable {
* @return health of an instance
*/
@Nonnull
Single<HealthCheck> health();
Publisher<HealthCheck> health();

/**
* @return the {@link LogLevel} that is used for logging requests and responses
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
import com.influxdb.client.service.WriteService;
import com.influxdb.utils.Arguments;

import io.reactivex.rxjava3.core.Single;
import io.reactivex.rxjava3.core.Flowable;
import org.reactivestreams.Publisher;
import retrofit2.adapter.rxjava3.RxJava3CallAdapterFactory;

/**
Expand Down Expand Up @@ -72,9 +73,9 @@ public WriteReactiveApi getWriteReactiveApi(@Nonnull final WriteOptionsReactive

@Nonnull
@Override
public Single<HealthCheck> health() {
public Publisher<HealthCheck> health() {

return Single.fromCallable(() -> health(healthService.getHealth(null)));
return Flowable.fromCallable(() -> health(healthService.getHealth(null)));
}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.junit.jupiter.api.Test;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.runner.RunWith;
import org.reactivestreams.Publisher;

/**
* @author Jakub Bednar (bednar@github) (20/11/2018 08:06)
Expand All @@ -51,9 +52,9 @@ void writeClient() {
@Test
void health() {

Single<HealthCheck> check = influxDBClient.health();
Publisher<HealthCheck> check = influxDBClient.health();

check
Single.fromPublisher(check)
.test()
.assertNoErrors()
.assertValue(it -> {
Expand All @@ -67,22 +68,22 @@ void health() {
}

@Test
void healthNotRunningInstance() throws Exception {
void healthNotRunningInstance() {

InfluxDBClientReactive clientNotRunning = InfluxDBClientReactiveFactory.create("http://localhost:8099");
Single<HealthCheck> health = clientNotRunning.health();
Publisher<HealthCheck> health = clientNotRunning.health();

health
.test()
.assertNoErrors()
.assertValue(it -> {
Single.fromPublisher(health)
.test()
.assertNoErrors()
.assertValue(it -> {

Assertions.assertThat(it).isNotNull();
Assertions.assertThat(it.getStatus()).isEqualTo(HealthCheck.StatusEnum.FAIL);
Assertions.assertThat(it.getMessage()).startsWith("Failed to connect to");
Assertions.assertThat(it).isNotNull();
Assertions.assertThat(it.getStatus()).isEqualTo(HealthCheck.StatusEnum.FAIL);
Assertions.assertThat(it.getMessage()).startsWith("Failed to connect to");

return true;
});
return true;
});

clientNotRunning.close();
}
Expand Down

0 comments on commit 966bbb2

Please sign in to comment.