Search in sources :

Example 36 with StringByteIterator

use of site.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(site.ycsb.Status) ByteIterator(site.ycsb.ByteIterator) StringByteIterator(site.ycsb.StringByteIterator) HashMap(java.util.HashMap) StringByteIterator(site.ycsb.StringByteIterator) Test(org.junit.Test)

Example 37 with StringByteIterator

use of site.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(site.ycsb.Status) ByteIterator(site.ycsb.ByteIterator) StringByteIterator(site.ycsb.StringByteIterator) HashMap(java.util.HashMap) StringByteIterator(site.ycsb.StringByteIterator) Test(org.junit.Test)

Example 38 with StringByteIterator

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

the class RestClientTest method insert_200.

// Insert success.
@Test
public void insert_200() {
    HashMap<String, ByteIterator> data = new HashMap<String, ByteIterator>();
    data.put(DATA_TAG, new StringByteIterator(INPUT_DATA));
    Status status = rc.insert(null, VALID_RESOURCE, data);
    assertEquals(Status.OK, status);
}
Also used : Status(site.ycsb.Status) ByteIterator(site.ycsb.ByteIterator) StringByteIterator(site.ycsb.StringByteIterator) HashMap(java.util.HashMap) StringByteIterator(site.ycsb.StringByteIterator) Test(org.junit.Test)

Example 39 with StringByteIterator

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

the class VoltDBClientTest method insertAndReadTest.

@Test
public void insertAndReadTest() {
    Assume.assumeTrue(haveDb);
    try {
        // Create some test data
        final String insertKey = INSERT_TEST_KEY;
        final Set<String> columns = getColumnNameMap();
        // Insert row
        HashMap<String, ByteIterator> insertMap = new HashMap<String, ByteIterator>();
        for (int i = 0; i < NUM_FIELDS; i++) {
            insertMap.put(FIELD_PREFIX + i, new StringByteIterator(buildDeterministicValue(insertKey, FIELD_PREFIX + i)));
        }
        voltClient.insert(TABLE_NAME, insertKey, insertMap);
        // Create a object to put retrieved row in...
        Map<String, ByteIterator> testResult = new HashMap<String, ByteIterator>();
        // Read row...
        Status s = voltClient.read(TABLE_NAME, insertKey, columns, testResult);
        if (!s.equals(Status.OK)) {
            fail("Didn't get OK on read.");
        }
        if (!compareContents(insertMap, testResult)) {
            fail("Returned data not the same as inserted data");
        }
    } catch (Exception e) {
        e.printStackTrace();
        fail("Failed insertTest");
    }
}
Also used : Status(site.ycsb.Status) ByteIterator(site.ycsb.ByteIterator) StringByteIterator(site.ycsb.StringByteIterator) HashMap(java.util.HashMap) StringByteIterator(site.ycsb.StringByteIterator) Assume.assumeNoException(org.junit.Assume.assumeNoException) DBException(site.ycsb.DBException)

Example 40 with StringByteIterator

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

the class VoltDBClientTest method insertDeleteAndReadTest.

@Test
public void insertDeleteAndReadTest() {
    Assume.assumeTrue(haveDb);
    try {
        // Create some test data
        final String insertKey = INSERT_DELETE_AND_READ_TEST_KEY;
        final Set<String> columns = getColumnNameMap();
        // Insert row
        HashMap<String, ByteIterator> insertMap = new HashMap<String, ByteIterator>();
        for (int i = 0; i < NUM_FIELDS; i++) {
            insertMap.put(FIELD_PREFIX + i, new StringByteIterator(buildDeterministicValue(insertKey, FIELD_PREFIX + i)));
        }
        voltClient.insert(TABLE_NAME, insertKey, insertMap);
        // Create a object to put retrieved row in...
        Map<String, ByteIterator> testResult = new HashMap<String, ByteIterator>();
        // Read row...
        Status s = voltClient.read(TABLE_NAME, insertKey, columns, testResult);
        if (!s.equals(Status.OK)) {
            fail("Didn't get OK on read.");
        }
        if (!compareContents(insertMap, testResult)) {
            fail("Returned data not the same as inserted data");
        }
        voltClient.delete(TABLE_NAME, insertKey);
        // Create another object to put retrieved row in...
        Map<String, ByteIterator> testResultAfterDelete = new HashMap<String, ByteIterator>();
        // Read row...
        voltClient.read(TABLE_NAME, insertKey, columns, testResultAfterDelete);
        if (testResultAfterDelete.size() > 0) {
            fail("testResultAfterDelete has value.");
        }
    } catch (Exception e) {
        e.printStackTrace();
        fail("Failed insertDeleteAndReadTest");
    }
}
Also used : Status(site.ycsb.Status) ByteIterator(site.ycsb.ByteIterator) StringByteIterator(site.ycsb.StringByteIterator) HashMap(java.util.HashMap) StringByteIterator(site.ycsb.StringByteIterator) Assume.assumeNoException(org.junit.Assume.assumeNoException) DBException(site.ycsb.DBException)

Aggregations

StringByteIterator (site.ycsb.StringByteIterator)49 ByteIterator (site.ycsb.ByteIterator)32 HashMap (java.util.HashMap)31 Status (site.ycsb.Status)19 DBException (site.ycsb.DBException)15 Test (org.junit.Test)12 Map (java.util.Map)8 IOException (java.io.IOException)5 Assume.assumeNoException (org.junit.Assume.assumeNoException)4 UnknownHostException (java.net.UnknownHostException)3 SearchResponse (org.elasticsearch.action.search.SearchResponse)3 SearchHit (org.elasticsearch.search.SearchHit)3 JsonObject (com.couchbase.client.java.document.json.JsonObject)2 Collections.emptyMap (java.util.Collections.emptyMap)2 User (org.apache.gora.benchmark.generated.User)2 GoraException (org.apache.gora.util.GoraException)2 SolrQuery (org.apache.solr.client.solrj.SolrQuery)2 SolrServerException (org.apache.solr.client.solrj.SolrServerException)2 QueryResponse (org.apache.solr.client.solrj.response.QueryResponse)2 SolrDocumentList (org.apache.solr.common.SolrDocumentList)2