Search in sources :

Example 26 with Response

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

the class DocumentsCRUDTest method saveWithIdContainSlash.

@Test
public void saveWithIdContainSlash() {
    String idWithSlash = "a/b/" + generateUUID();
    Response response = db.save(new Foo(idWithSlash));
    assertEquals(idWithSlash, response.getId());
}
Also used : Response(com.cloudant.client.api.model.Response) Test(org.junit.jupiter.api.Test)

Example 27 with Response

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

the class DocumentsCRUDTest method findWithParams.

@Test
public void findWithParams() {
    Response response = db.save(new Foo());
    Foo foo = db.find(Foo.class, response.getId(), new Params().revsInfo());
    assertNotNull(foo);
}
Also used : Response(com.cloudant.client.api.model.Response) Params(com.cloudant.client.api.model.Params) Test(org.junit.jupiter.api.Test)

Example 28 with Response

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

the class DocumentsCRUDTest method saveObjectPost.

@Test
public void saveObjectPost() {
    // database generated id will be assigned
    Response response = db.post(new Foo());
    assertNotNull(response.getId());
}
Also used : Response(com.cloudant.client.api.model.Response) Test(org.junit.jupiter.api.Test)

Example 29 with Response

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

the class DocumentsCRUDTest method deleteByIdContainSlash.

@Test
public void deleteByIdContainSlash() {
    String idWithSlash = "a/" + generateUUID();
    Response response = db.save(new Bar(idWithSlash));
    Response responseRemove = db.remove(response.getId(), response.getRev());
    assertEquals(idWithSlash, responseRemove.getId());
}
Also used : Response(com.cloudant.client.api.model.Response) Test(org.junit.jupiter.api.Test)

Example 30 with Response

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

the class DocumentsCRUDTest method findInputstream.

@Test
public void findInputstream() throws IOException {
    Response response = db.save(new Foo());
    InputStream inputStream = db.find(response.getId());
    assertTrue(inputStream.read() != -1);
    inputStream.close();
}
Also used : Response(com.cloudant.client.api.model.Response) InputStream(java.io.InputStream) Test(org.junit.jupiter.api.Test)

Aggregations

Response (com.cloudant.client.api.model.Response)41 Test (org.junit.jupiter.api.Test)40 InputStream (java.io.InputStream)7 MockResponse (okhttp3.mockwebserver.MockResponse)7 ByteArrayInputStream (java.io.ByteArrayInputStream)6 ByteArrayOutputStream (java.io.ByteArrayOutputStream)6 Document (com.cloudant.client.api.model.Document)5 Params (com.cloudant.client.api.model.Params)5 DesignDocument (com.cloudant.client.api.model.DesignDocument)4 JsonObject (com.google.gson.JsonObject)4 ReplicatorDocument (com.cloudant.client.api.model.ReplicatorDocument)3 Attachment (com.cloudant.client.api.model.Attachment)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Changes (com.cloudant.client.api.Changes)1 Database (com.cloudant.client.api.Database)1 ChangesResult (com.cloudant.client.api.model.ChangesResult)1 Row (com.cloudant.client.api.model.ChangesResult.Row)1 DbInfo (com.cloudant.client.api.model.DbInfo)1 URIBase (com.cloudant.client.internal.URIBase)1