Skip to content

Commit

Permalink
#46: Updated swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
bednar committed Aug 1, 2019
1 parent 86514ab commit 6609d27
Show file tree
Hide file tree
Showing 67 changed files with 6,969 additions and 768 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
package com.influxdb.client.kotlin

import com.influxdb.LogLevel
import com.influxdb.client.domain.Check
import com.influxdb.client.domain.HealthCheck

/**
* The reference Kotlin client that allows query and write for the InfluxDB 2.0 by Kotlin Channel coroutines.
Expand All @@ -43,7 +43,7 @@ interface InfluxDBClientKotlin {
*
* @return health of an instance
*/
fun health(): Check
fun health(): HealthCheck

/**
* Gets the [LogLevel] that is used for logging requests and responses.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ package com.influxdb.client.kotlin.internal

import com.influxdb.LogLevel
import com.influxdb.client.InfluxDBClientOptions
import com.influxdb.client.domain.Check
import com.influxdb.client.domain.HealthCheck
import com.influxdb.client.internal.AbstractInfluxDBClient
import com.influxdb.client.kotlin.InfluxDBClientKotlin
import com.influxdb.client.kotlin.QueryKotlinApi
Expand All @@ -38,7 +38,7 @@ internal class InfluxDBClientKotlinImpl(options: InfluxDBClientOptions) : Abstra
return QueryKotlinApiImpl(retrofit.create<QueryService>(QueryService::class.java))
}

override fun health(): Check {
override fun health(): HealthCheck {
return health(healthService.getHealth(null))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ internal class QueryKotlinApiImpl(private val service: QueryService) : AbstractQ
val channel = Channel<String>()

val queryCall = service.postQueryResponseBody(null, "application/json",
null, orgID, query)
null, null, orgID, query)

val consumer = BiConsumer { cancellable: Cancellable, line: String ->

Expand All @@ -145,7 +145,7 @@ internal class QueryKotlinApiImpl(private val service: QueryService) : AbstractQ
val channel = Channel<T>()

val queryCall = service.postQueryResponseBody(null, "application/json",
null, orgID, query)
null, null, orgID, query)

val responseConsumer = object : FluxResponseConsumer {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
package com.influxdb.client.kotlin

import com.influxdb.LogLevel
import com.influxdb.client.domain.Check
import com.influxdb.client.domain.HealthCheck
import org.assertj.core.api.Assertions
import org.junit.jupiter.api.Test
import org.junit.platform.runner.JUnitPlatform
Expand All @@ -47,7 +47,7 @@ internal class ITInfluxDBClientKotlin : AbstractITInfluxDBClientKotlin() {
val health = influxDBClient.health()

Assertions.assertThat(health).isNotNull
Assertions.assertThat(health.status).isEqualTo(Check.StatusEnum.PASS)
Assertions.assertThat(health.status).isEqualTo(HealthCheck.StatusEnum.PASS)
Assertions.assertThat(health.message).isEqualTo("ready for queries and writes")
}

Expand All @@ -60,7 +60,7 @@ internal class ITInfluxDBClientKotlin : AbstractITInfluxDBClientKotlin() {
val health = clientNotRunning.health()

Assertions.assertThat(health).isNotNull
Assertions.assertThat(health.status).isEqualTo(Check.StatusEnum.FAIL)
Assertions.assertThat(health.status).isEqualTo(HealthCheck.StatusEnum.FAIL)
Assertions.assertThat(health.message).startsWith("Failed to connect to")

clientNotRunning.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.influxdb.LogLevel;
import com.influxdb.client.InfluxDBClient;
import com.influxdb.client.WriteOptions;
import com.influxdb.client.domain.Check;
import com.influxdb.client.domain.HealthCheck;

import io.reactivex.Single;

Expand Down Expand Up @@ -68,7 +68,7 @@ public interface InfluxDBClientReactive extends AutoCloseable {
* @return health of an instance
*/
@Nonnull
Single<Check> health();
Single<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 @@ -27,7 +27,7 @@
import com.influxdb.LogLevel;
import com.influxdb.client.InfluxDBClientOptions;
import com.influxdb.client.WriteOptions;
import com.influxdb.client.domain.Check;
import com.influxdb.client.domain.HealthCheck;
import com.influxdb.client.internal.AbstractInfluxDBClient;
import com.influxdb.client.reactive.InfluxDBClientReactive;
import com.influxdb.client.reactive.QueryReactiveApi;
Expand Down Expand Up @@ -70,7 +70,7 @@ public WriteReactiveApi getWriteReactiveApi(@Nonnull final WriteOptions writeOpt

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

return Single.fromCallable(() -> health(healthService.getHealth(null)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public Flowable<FluxRecord> query(@Nonnull final Publisher<String> queryStream,
return Flowable
.fromPublisher(queryStream)
.map(it -> service.postQueryResponseBody(null, "application/json",
null, orgID, new Query().query(it).dialect(AbstractInfluxDBClient.DEFAULT_DIALECT)))
null, null, orgID, new Query().query(it).dialect(AbstractInfluxDBClient.DEFAULT_DIALECT)))
.flatMap(queryCall -> {

Observable<FluxRecord> observable = Observable.create(subscriber -> {
Expand Down Expand Up @@ -181,7 +181,7 @@ public Flowable<String> queryRaw(@Nonnull final Publisher<String> queryStream,
return Flowable
.fromPublisher(queryStream)
.map(it -> service.postQueryResponseBody(null, "application/json",
null, orgID, new Query().query(it).dialect(dialect)))
null, null, orgID, new Query().query(it).dialect(dialect)))
.flatMap(queryCall -> {

Observable<String> observable = Observable.create(subscriber -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
package com.influxdb.client.reactive;

import com.influxdb.LogLevel;
import com.influxdb.client.domain.Check;
import com.influxdb.client.domain.HealthCheck;

import io.reactivex.Single;
import org.assertj.core.api.Assertions;
Expand Down Expand Up @@ -51,15 +51,15 @@ void writeClient() {
@Test
void health() {

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

check
.test()
.assertNoErrors()
.assertValue(it -> {

Assertions.assertThat(it).isNotNull();
Assertions.assertThat(it.getStatus()).isEqualTo(Check.StatusEnum.PASS);
Assertions.assertThat(it.getStatus()).isEqualTo(HealthCheck.StatusEnum.PASS);
Assertions.assertThat(it.getMessage()).isEqualTo("ready for queries and writes");

return true;
Expand All @@ -70,15 +70,15 @@ void health() {
void healthNotRunningInstance() throws Exception {

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

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

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

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
package com.influxdb.client.scala

import com.influxdb.LogLevel
import com.influxdb.client.domain.Check
import com.influxdb.client.domain.HealthCheck
import javax.annotation.Nonnull

/**
Expand All @@ -44,7 +44,7 @@ trait InfluxDBClientScala {
*
* @return health of an instance
*/
@Nonnull def health: Check
@Nonnull def health: HealthCheck

/**
* Gets the [[LogLevel]] that is used for logging requests and responses.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ package com.influxdb.client.scala.internal
import akka.stream.OverflowStrategy
import com.influxdb.LogLevel
import com.influxdb.client.InfluxDBClientOptions
import com.influxdb.client.domain.Check
import com.influxdb.client.domain.HealthCheck
import com.influxdb.client.internal.AbstractInfluxDBClient
import com.influxdb.client.scala.{InfluxDBClientScala, QueryScalaApi}
import com.influxdb.client.service.QueryService
Expand All @@ -48,7 +48,7 @@ class InfluxDBClientScalaImpl(@Nonnull options: InfluxDBClientOptions,
*
* @return health of an instance
*/
override def health: Check = health(healthService.getHealth(null))
override def health: HealthCheck = health(healthService.getHealth(null))

/**
* Gets the [[LogLevel]] that is used for logging requests and responses.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class QueryScalaApiImpl(@Nonnull service: QueryService,
.single(query)
.map(_ => service
.postQueryResponseBody(null, "application/json",
null, orgID, query))
null, null, orgID, query))
.flatMapConcat(queryCall => {
Source.queue[FluxRecord](bufferSize, overflowStrategy)
.mapMaterializedValue(queue => {
Expand Down Expand Up @@ -191,7 +191,7 @@ class QueryScalaApiImpl(@Nonnull service: QueryService,
.single(query)
.map(it => service
.postQueryResponseBody(null, "application/json",
null, orgID, query))
null, null, orgID, query))
.flatMapConcat(queryCall => {
Source.queue[String](bufferSize, overflowStrategy)
.mapMaterializedValue(queue => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
package com.influxdb.client.scala

import com.influxdb.LogLevel
import com.influxdb.client.domain.Check
import com.influxdb.client.domain.HealthCheck
import org.scalatest.Matchers

/**
Expand All @@ -44,7 +44,7 @@ class ITInfluxDBClientScala extends AbstractITQueryScalaApi with Matchers {
val health = influxDBClient.health

health should not be null
health.getStatus should be(Check.StatusEnum.PASS)
health.getStatus should be(HealthCheck.StatusEnum.PASS)
health.getMessage should be("ready for queries and writes")
}

Expand All @@ -55,7 +55,7 @@ class ITInfluxDBClientScala extends AbstractITQueryScalaApi with Matchers {
val health = client.health

health should not be null
health.getStatus should be(Check.StatusEnum.FAIL)
health.getStatus should be(HealthCheck.StatusEnum.FAIL)
health.getMessage should startWith("Failed to connect to")

client.close()
Expand Down
Loading

0 comments on commit 6609d27

Please sign in to comment.