Search in sources :

Example 1 with Json

use of org.apache.cassandra.cql3.Json in project cassandra by apache.

the class JsonTest method testDurationJsonRoundtrip.

@Test
public void testDurationJsonRoundtrip() throws Throwable {
    createTable("CREATE TABLE %s (pk int PRIMARY KEY, d duration)");
    execute("INSERT INTO %s (pk, d) VALUES (1, 6h40m)");
    UntypedResultSet res = execute("SELECT JSON * FROM %s WHERE pk = 1");
    UntypedResultSet.Row r = res.one();
    String json = r.getString("[json]");
    execute("DELETE FROM %s WHERE pk = 1");
    execute("INSERT INTO %s JSON '" + json + "'");
    res = execute("SELECT JSON * FROM %s WHERE pk = 1");
    assertEquals(json, res.one().getString("[json]"));
}
Also used : UntypedResultSet(org.apache.cassandra.cql3.UntypedResultSet) Test(org.junit.Test)

Aggregations

UntypedResultSet (org.apache.cassandra.cql3.UntypedResultSet)1 Test (org.junit.Test)1