Thanks! I will look into it.

On 05/15/2015 06:24 PM, James Taylor wrote:
You'll want to derive from BaseHBaseManagedTimeIT. The
BaseConnectionlessQueryTest class is for compile-time only or negative
tests as it doesn't spin up any mini cluster.

Thanks,
James

On Fri, May 15, 2015 at 5:41 AM, Ron van der Vegt
<ron.van.der.v...@openindex.io> wrote:
Hello everyone,

I'm currently developing an Rest API which should query a phoenix table, and
return it in JSON. Currently have no issues with building this API, but it
would be really nice if I could write unittests with dummy data to test our
created API calls.

I was getting into the right direction, I hope, by extending the
BaseConnectionlessQueryTest class and setup a test database:

String ddl = "CREATE TABLE test (id VARCHAR not null primary key, test_value
CHAR(16)";
createTestTable(getUrl(), ddl, (byte[][]) null, (Long) null);

And it looks like I could also upsert some data:

Properties props = new Properties();
PhoenixConnection conn =
(PhoenixConnection)DriverManager.getConnection("jdbc:phoenix:none;test=true",
props);
PreparedStatement statement = conn.prepareStatement("UPSERT INTO test(id)
VALUES ('meh')");
statement.execute();

But when I want to select data:

PreparedStatement statement = conn.prepareStatement("SELECT * FROM test");
ResultSet rs = statement.executeQuery();
while (rs.next()) {
   System.out.println(rs.getString("ID"));
}

I am get an UnsupportedOperationException. Could someone please explain to
me what I'm doing wrong, or that my use case is possible somehow?

Thanks in advice!

Ron

Reply via email to