Search in sources :

Example 76 with ByteIterator

use of com.yahoo.ycsb.ByteIterator in project YCSB by brianfrankcooper.

the class OrientDBClientTest method insertTest.

@Test
public void insertTest() {
    String insertKey = "user0";
    Map<String, ByteIterator> insertMap = insertRow(insertKey);
    OPartitionedDatabasePool pool = orientDBClient.getDatabasePool();
    try (ODatabaseDocumentTx db = pool.acquire()) {
        ODictionary<ORecord> dictionary = db.getDictionary();
        ODocument result = dictionary.get(insertKey);
        assertTrue("Assert a row was inserted.", result != null);
        for (int i = 0; i < NUM_FIELDS; i++) {
            assertEquals("Assert all inserted columns have correct values.", result.field(FIELD_PREFIX + i), insertMap.get(FIELD_PREFIX + i).toString());
        }
    }
}
Also used : StringByteIterator(com.yahoo.ycsb.StringByteIterator) ByteIterator(com.yahoo.ycsb.ByteIterator) OPartitionedDatabasePool(com.orientechnologies.orient.core.db.OPartitionedDatabasePool) ORecord(com.orientechnologies.orient.core.record.ORecord) ODatabaseDocumentTx(com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx) ODocument(com.orientechnologies.orient.core.record.impl.ODocument)

Example 77 with ByteIterator

use of com.yahoo.ycsb.ByteIterator in project YCSB by brianfrankcooper.

the class RadosClientTest method compareMap.

private void compareMap(HashMap<String, ByteIterator> src, HashMap<String, ByteIterator> dest) {
    assertEquals(src.size(), dest.size());
    Set setSrc = src.entrySet();
    Iterator<Map.Entry> itSrc = setSrc.iterator();
    for (int i = 0; i < 10; i++) {
        Map.Entry<String, ByteIterator> entrySrc = itSrc.next();
        assertEquals(entrySrc.getValue().toString(), dest.get(entrySrc.getKey()).toString());
    }
}
Also used : Set(java.util.Set) StringByteIterator(com.yahoo.ycsb.StringByteIterator) ByteIterator(com.yahoo.ycsb.ByteIterator) HashMap(java.util.HashMap) Map(java.util.Map)

Example 78 with ByteIterator

use of com.yahoo.ycsb.ByteIterator in project YCSB by brianfrankcooper.

the class RadosClientTest method updateTest.

@Test
public void updateTest() {
    radosclient.insert(TABLE_NAME, KEY2, DATA);
    Status result = radosclient.update(TABLE_NAME, KEY2, DATA_UPDATED);
    assertEquals(Status.OK, result);
    HashMap<String, ByteIterator> ret = new HashMap<String, ByteIterator>(10);
    radosclient.read(TABLE_NAME, KEY2, DATA.keySet(), ret);
    compareMap(DATA_UPDATED, ret);
    radosclient.delete(TABLE_NAME, KEY2);
}
Also used : Status(com.yahoo.ycsb.Status) StringByteIterator(com.yahoo.ycsb.StringByteIterator) ByteIterator(com.yahoo.ycsb.ByteIterator) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 79 with ByteIterator

use of com.yahoo.ycsb.ByteIterator in project YCSB by brianfrankcooper.

the class RestClientTest method read_200.

// Read success.
@Test
public void read_200() {
    HashMap<String, ByteIterator> result = new HashMap<String, ByteIterator>();
    Status status = rc.read(null, VALID_RESOURCE, null, result);
    assertEquals(Status.OK, status);
    assertEquals(result.get(RESPONSE_TAG).toString(), "HTTP GET response to: " + VALID_RESOURCE);
}
Also used : Status(com.yahoo.ycsb.Status) StringByteIterator(com.yahoo.ycsb.StringByteIterator) ByteIterator(com.yahoo.ycsb.ByteIterator) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 80 with ByteIterator

use of com.yahoo.ycsb.ByteIterator in project YCSB by brianfrankcooper.

the class RestClientTest method read_404.

//Not found error.
@Test
public void read_404() {
    HashMap<String, ByteIterator> result = new HashMap<String, ByteIterator>();
    Status status = rc.read(null, ABSENT_RESOURCE, null, result);
    assertEquals(Status.NOT_FOUND, status);
}
Also used : Status(com.yahoo.ycsb.Status) StringByteIterator(com.yahoo.ycsb.StringByteIterator) ByteIterator(com.yahoo.ycsb.ByteIterator) HashMap(java.util.HashMap) Test(org.junit.Test)

Aggregations

ByteIterator (com.yahoo.ycsb.ByteIterator)87 HashMap (java.util.HashMap)70 StringByteIterator (com.yahoo.ycsb.StringByteIterator)52 Status (com.yahoo.ycsb.Status)33 ByteArrayByteIterator (com.yahoo.ycsb.ByteArrayByteIterator)30 Test (org.junit.Test)30 DBException (com.yahoo.ycsb.DBException)20 Map (java.util.Map)14 IOException (java.io.IOException)8 EntityProperty (com.microsoft.azure.storage.table.EntityProperty)5 Vector (java.util.Vector)5 BaseDocument (com.arangodb.entity.BaseDocument)4 DynamicTableEntity (com.microsoft.azure.storage.table.DynamicTableEntity)4 DB (com.yahoo.ycsb.DB)4 ByteBuffer (java.nio.ByteBuffer)4 ArrayList (java.util.ArrayList)4 Put (org.apache.hadoop.hbase.client.Put)4 MongoCollection (com.allanbank.mongodb.MongoCollection)3 DocumentBuilder (com.allanbank.mongodb.bson.builder.DocumentBuilder)3 ArangoDBException (com.arangodb.ArangoDBException)3