Search in sources :

Example 1 with DbInfo

use of com.cloudant.client.api.model.DbInfo in project java-cloudant by cloudant.

the class DBServerTest method dbInfo.

@Test
public void dbInfo() {
    DbInfo dbInfo = db.info();
    assertNotNull(dbInfo);
}
Also used : DbInfo(com.cloudant.client.api.model.DbInfo) Test(org.junit.jupiter.api.Test)

Example 2 with DbInfo

use of com.cloudant.client.api.model.DbInfo in project java-cloudant by cloudant.

the class ChangeNotificationsTest method changes_continuousFeed.

@Test
public void changes_continuousFeed() {
    db.save(new Foo());
    DbInfo dbInfo = db.info();
    String since = dbInfo.getUpdateSeq();
    Changes changes = db.changes().includeDocs(true).since(since).heartBeat(30000).continuousChanges();
    Response response = db.save(new Foo());
    while (changes.hasNext()) {
        ChangesResult.Row feed = changes.next();
        final JsonObject feedObject = feed.getDoc();
        final String docId = feed.getId();
        assertEquals(response.getId(), docId);
        assertNotNull(feedObject);
        changes.stop();
    }
}
Also used : Changes(com.cloudant.client.api.Changes) Response(com.cloudant.client.api.model.Response) MockResponse(okhttp3.mockwebserver.MockResponse) Row(com.cloudant.client.api.model.ChangesResult.Row) JsonObject(com.google.gson.JsonObject) ChangesResult(com.cloudant.client.api.model.ChangesResult) DbInfo(com.cloudant.client.api.model.DbInfo) Test(org.junit.jupiter.api.Test)

Aggregations

DbInfo (com.cloudant.client.api.model.DbInfo)2 Test (org.junit.jupiter.api.Test)2 Changes (com.cloudant.client.api.Changes)1 ChangesResult (com.cloudant.client.api.model.ChangesResult)1 Row (com.cloudant.client.api.model.ChangesResult.Row)1 Response (com.cloudant.client.api.model.Response)1 JsonObject (com.google.gson.JsonObject)1 MockResponse (okhttp3.mockwebserver.MockResponse)1