Search in sources :

Example 1 with JsonIndex

use of com.cloudant.client.api.query.JsonIndex in project java-cloudant by cloudant.

the class IndexTests method testNotNullIndexNamesAndFields.

@Test
public void testNotNullIndexNamesAndFields() {
    List<JsonIndex> indices = db.listIndexes().jsonIndexes();
    assertNotNull(indices);
    assert (indices.size() > 0);
    for (JsonIndex i : indices) {
        assertNotNull(i.getName());
        assertNotNull(i.getFields());
        List<JsonIndex.Field> flds = i.getFields();
        assertTrue(flds.size() > 0, "The fields should not be empty");
        for (JsonIndex.Field field : flds) {
            assertNotNull(field.getName(), "The field name should not be null");
            assertNotNull(field.getOrder(), "The sort order should not be null");
        }
    }
}
Also used : IndexField(com.cloudant.client.api.model.IndexField) JsonIndex(com.cloudant.client.api.query.JsonIndex) Test(org.junit.jupiter.api.Test)

Example 2 with JsonIndex

use of com.cloudant.client.api.query.JsonIndex in project java-cloudant by cloudant.

the class IndexListTests method listComplexJsonIndex.

@Test
public void listComplexJsonIndex() throws Exception {
    enqueueList(JSON_COMPLEX);
    List<JsonIndex> indexes = db.listIndexes().jsonIndexes();
    assertEquals(1, indexes.size(), "There should be 1 JSON index");
    JsonIndex complex = indexes.get(0);
    assertComplexJson(complex);
}
Also used : JsonIndex(com.cloudant.client.api.query.JsonIndex) Test(org.junit.jupiter.api.Test)

Example 3 with JsonIndex

use of com.cloudant.client.api.query.JsonIndex in project java-cloudant by cloudant.

the class IndexListTests method listSimpleJsonIndex.

@Test
public void listSimpleJsonIndex() throws Exception {
    enqueueList(JSON_SIMPLE);
    List<JsonIndex> indexes = db.listIndexes().jsonIndexes();
    assertEquals(1, indexes.size(), "There should be 1 JSON index");
    JsonIndex simple = indexes.get(0);
    assertSimpleJson(simple);
}
Also used : JsonIndex(com.cloudant.client.api.query.JsonIndex) Test(org.junit.jupiter.api.Test)

Example 4 with JsonIndex

use of com.cloudant.client.api.query.JsonIndex in project java-cloudant by cloudant.

the class IndexListTests method listMultipleJsonIndexes.

@Test
public void listMultipleJsonIndexes() throws Exception {
    enqueueList(JSON_SIMPLE, JSON_COMPLEX);
    List<JsonIndex> indexes = db.listIndexes().jsonIndexes();
    assertEquals(2, indexes.size(), "There should be 2 JSON indexes");
    JsonIndex simple = indexes.get(0);
    assertSimpleJson(simple);
    JsonIndex complex = indexes.get(1);
    assertComplexJson(complex);
}
Also used : JsonIndex(com.cloudant.client.api.query.JsonIndex) Test(org.junit.jupiter.api.Test)

Aggregations

JsonIndex (com.cloudant.client.api.query.JsonIndex)4 Test (org.junit.jupiter.api.Test)4 IndexField (com.cloudant.client.api.model.IndexField)1