Search in sources :

Example 41 with Status

use of site.ycsb.Status in project YCSB by brianfrankcooper.

the class AsyncHBaseTest method testReadMissingRow.

@Test
public void testReadMissingRow() throws Exception {
    final HashMap<String, ByteIterator> result = new HashMap<String, ByteIterator>();
    final Status status = client.read(tableName, "Missing row", null, result);
    assertEquals(Status.NOT_FOUND, status);
    assertEquals(0, result.size());
}
Also used : Status(site.ycsb.Status) ByteIterator(site.ycsb.ByteIterator) StringByteIterator(site.ycsb.StringByteIterator) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 42 with Status

use of site.ycsb.Status in project YCSB by brianfrankcooper.

the class CassandraCQLClientTest method testDelete.

@Test
public void testDelete() throws Exception {
    insertRow();
    final Status status = client.delete(TABLE, DEFAULT_ROW_KEY);
    assertThat(status, is(Status.OK));
    // Verify result
    final Select selectStmt = QueryBuilder.select("field0", "field1").from(TABLE).where(QueryBuilder.eq(CassandraCQLClient.YCSB_KEY, DEFAULT_ROW_KEY)).limit(1);
    final ResultSet rs = session.execute(selectStmt);
    final Row row = rs.one();
    assertThat(row, nullValue());
}
Also used : Status(site.ycsb.Status) Select(com.datastax.driver.core.querybuilder.Select) ResultSet(com.datastax.driver.core.ResultSet) Row(com.datastax.driver.core.Row) Test(org.junit.Test)

Example 43 with Status

use of site.ycsb.Status in project YCSB by brianfrankcooper.

the class CassandraCQLClientTest method testReadSingleColumn.

@Test
public void testReadSingleColumn() throws Exception {
    insertRow();
    final HashMap<String, ByteIterator> result = new HashMap<String, ByteIterator>();
    final Set<String> fields = Sets.newHashSet("field1");
    final Status status = client.read(TABLE, DEFAULT_ROW_KEY, fields, result);
    assertThat(status, is(Status.OK));
    assertThat(result.entrySet(), hasSize(1));
    final Map<String, String> strResult = StringByteIterator.getStringMap(result);
    assertThat(strResult, hasEntry("field1", "value2"));
}
Also used : Status(site.ycsb.Status) ByteIterator(site.ycsb.ByteIterator) StringByteIterator(site.ycsb.StringByteIterator) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 44 with Status

use of site.ycsb.Status in project gora by apache.

the class GoraClientTest method testInsert.

/**
 * files are auto-generated. I have the code to add the license file
 * accordingly Test insert.
 *
 * @throws GoraException
 *           the gora exception
 */
@Test
public void testInsert() throws GoraException {
    Status result1 = benchmarkClient.insert(Constants.TEST_TABLE, Constants.TEST_KEY_1, DATA_TO_INSERT);
    Status result2 = benchmarkClient.insert(Constants.TEST_TABLE, Constants.TEST_KEY_2, DATA_TO_INSERT);
    Status result3 = benchmarkClient.insert(Constants.TEST_TABLE, Constants.TEST_KEY_3, DATA_TO_INSERT);
    assertEquals(Status.OK, result1);
    assertEquals(Status.OK, result2);
    assertEquals(Status.OK, result3);
}
Also used : Status(site.ycsb.Status) Test(org.junit.Test)

Example 45 with Status

use of site.ycsb.Status in project gora by apache.

the class GoraClientTest method testCorrectness.

@Test
public void testCorrectness() {
    Status result = benchmarkClient.insert(Constants.TEST_TABLE, Constants.TEST_KEY_4, INTEGER_DATA);
    assertEquals(result, Status.OK);
    try {
        User user = readRecord(Constants.TEST_KEY_4);
        assertEquals(190, sum(user));
    } catch (GoraException e) {
        LOG.info("There is a problem reading record from the datastore", e.getMessage(), e);
    }
}
Also used : Status(site.ycsb.Status) GoraException(org.apache.gora.util.GoraException) User(org.apache.gora.benchmark.generated.User) Test(org.junit.Test)

Aggregations

Status (site.ycsb.Status)101 Test (org.junit.Test)80 ByteIterator (site.ycsb.ByteIterator)62 HashMap (java.util.HashMap)60 StringByteIterator (site.ycsb.StringByteIterator)60 ResultSet (com.datastax.driver.core.ResultSet)6 Row (com.datastax.driver.core.Row)6 Select (com.datastax.driver.core.querybuilder.Select)6 Vector (java.util.Vector)6 ByteArrayByteIterator (site.ycsb.ByteArrayByteIterator)5 DBException (site.ycsb.DBException)5 Assume.assumeNoException (org.junit.Assume.assumeNoException)4 DB (site.ycsb.DB)4 Get (org.apache.hadoop.hbase.client.Get)3 Put (org.apache.hadoop.hbase.client.Put)3 Result (org.apache.hadoop.hbase.client.Result)3 DatastoreException (com.google.datastore.v1.client.DatastoreException)2 Map (java.util.Map)2 User (org.apache.gora.benchmark.generated.User)2 NumericByteIterator (site.ycsb.NumericByteIterator)2