Search in sources :

Example 16 with StringByteIterator

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

the class RestClientTest method update_404.

@Test
public void update_404() {
    HashMap<String, ByteIterator> data = new HashMap<String, ByteIterator>();
    data.put(DATA_TAG, new StringByteIterator(INPUT_DATA));
    Status status = rc.update(null, ABSENT_RESOURCE, data);
    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) StringByteIterator(com.yahoo.ycsb.StringByteIterator) Test(org.junit.Test)

Example 17 with StringByteIterator

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

the class RestClientTest method update_403.

@Test
public void update_403() {
    HashMap<String, ByteIterator> data = new HashMap<String, ByteIterator>();
    data.put(DATA_TAG, new StringByteIterator(INPUT_DATA));
    Status status = rc.update(null, UNAUTHORIZED_RESOURCE, data);
    assertEquals(Status.FORBIDDEN, status);
}
Also used : Status(com.yahoo.ycsb.Status) StringByteIterator(com.yahoo.ycsb.StringByteIterator) ByteIterator(com.yahoo.ycsb.ByteIterator) HashMap(java.util.HashMap) StringByteIterator(com.yahoo.ycsb.StringByteIterator) Test(org.junit.Test)

Example 18 with StringByteIterator

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

the class RestClientTest method insert_403.

@Test
public void insert_403() {
    HashMap<String, ByteIterator> data = new HashMap<String, ByteIterator>();
    data.put(DATA_TAG, new StringByteIterator(INPUT_DATA));
    Status status = rc.insert(null, UNAUTHORIZED_RESOURCE, data);
    assertEquals(Status.FORBIDDEN, status);
}
Also used : Status(com.yahoo.ycsb.Status) StringByteIterator(com.yahoo.ycsb.StringByteIterator) ByteIterator(com.yahoo.ycsb.ByteIterator) HashMap(java.util.HashMap) StringByteIterator(com.yahoo.ycsb.StringByteIterator) Test(org.junit.Test)

Example 19 with StringByteIterator

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

the class RestClientTest method insert_500.

@Test
public void insert_500() {
    HashMap<String, ByteIterator> data = new HashMap<String, ByteIterator>();
    data.put(DATA_TAG, new StringByteIterator(INPUT_DATA));
    Status status = rc.insert(null, INVALID_RESOURCE, data);
    assertEquals(Status.ERROR, status);
}
Also used : Status(com.yahoo.ycsb.Status) StringByteIterator(com.yahoo.ycsb.StringByteIterator) ByteIterator(com.yahoo.ycsb.ByteIterator) HashMap(java.util.HashMap) StringByteIterator(com.yahoo.ycsb.StringByteIterator) Test(org.junit.Test)

Example 20 with StringByteIterator

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

the class OrientDBClientTest method updateTest.

@Test
public void updateTest() {
    String preupdateString = "preupdate";
    String user0 = "user0";
    String user1 = "user1";
    String user2 = "user2";
    OPartitionedDatabasePool pool = orientDBClient.getDatabasePool();
    try (ODatabaseDocumentTx db = pool.acquire()) {
        // Manually insert three documents
        for (String key : Arrays.asList(user0, user1, user2)) {
            ODocument doc = new ODocument(CLASS);
            for (int i = 0; i < NUM_FIELDS; i++) {
                doc.field(FIELD_PREFIX + i, preupdateString);
            }
            doc.save();
            ODictionary<ORecord> dictionary = db.getDictionary();
            dictionary.put(key, doc);
        }
    }
    HashMap<String, ByteIterator> updateMap = new HashMap<>();
    for (int i = 0; i < NUM_FIELDS; i++) {
        updateMap.put(FIELD_PREFIX + i, new StringByteIterator(buildDeterministicValue(user1, FIELD_PREFIX + i)));
    }
    orientDBClient.update(CLASS, user1, updateMap);
    try (ODatabaseDocumentTx db = pool.acquire()) {
        ODictionary<ORecord> dictionary = db.getDictionary();
        // Ensure that user0 record was not changed
        ODocument result = dictionary.get(user0);
        for (int i = 0; i < NUM_FIELDS; i++) {
            assertEquals("Assert first row fields contain preupdateString", result.field(FIELD_PREFIX + i), preupdateString);
        }
        // Check that all the columns have expected values for user1 record
        result = dictionary.get(user1);
        for (int i = 0; i < NUM_FIELDS; i++) {
            assertEquals("Assert updated row fields are correct", result.field(FIELD_PREFIX + i), updateMap.get(FIELD_PREFIX + i).toString());
        }
        // Ensure that user2 record was not changed
        result = dictionary.get(user2);
        for (int i = 0; i < NUM_FIELDS; i++) {
            assertEquals("Assert third row fields contain preupdateString", result.field(FIELD_PREFIX + i), preupdateString);
        }
    }
}
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) StringByteIterator(com.yahoo.ycsb.StringByteIterator) ODatabaseDocumentTx(com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx) ODocument(com.orientechnologies.orient.core.record.impl.ODocument)

Aggregations

StringByteIterator (com.yahoo.ycsb.StringByteIterator)33 ByteIterator (com.yahoo.ycsb.ByteIterator)21 HashMap (java.util.HashMap)17 Status (com.yahoo.ycsb.Status)13 Test (org.junit.Test)9 DBException (com.yahoo.ycsb.DBException)5 IOException (java.io.IOException)5 SolrQuery (org.apache.solr.client.solrj.SolrQuery)4 SolrServerException (org.apache.solr.client.solrj.SolrServerException)4 QueryResponse (org.apache.solr.client.solrj.response.QueryResponse)4 SolrDocumentList (org.apache.solr.common.SolrDocumentList)4 Map (java.util.Map)3 JsonObject (com.couchbase.client.java.document.json.JsonObject)2 SolrDocument (org.apache.solr.common.SolrDocument)2 ReadOp (com.ceph.rados.ReadOp)1 ReadResult (com.ceph.rados.ReadOp.ReadResult)1 RadosException (com.ceph.rados.exceptions.RadosException)1 RadosObjectInfo (com.ceph.rados.jna.RadosObjectInfo)1 JsonNode (com.couchbase.client.deps.com.fasterxml.jackson.databind.JsonNode)1 TemporaryFailureException (com.couchbase.client.java.error.TemporaryFailureException)1